vendredi 26 octobre 2018

How can I make a IF ELSE statement in PHP from a response of JSON?

Guys I want to echo that when I get as response 0: 'YOU ARE NOT BANNED' and if I get as response 1: 'YOU ARE BANNED' info: I get the response in form of JSON state : 0 OR 1 0 for not banned and 1 for banned

This is how the problem looks like:

    <?php if (strstr($characters['message']['state']) == 1) {
      echo "YOU ARE BANNED";
} else if (strstr($characters['message']['state']) == 0) {
       echo "YOU ARE NOT BANNED";
};

I always get YOU ARE NOT BANNED even if the response from JSON is 1 Pleas help me :/

I use the first <?php because it is inside a HTML(wich is inside a php file)... Yhea I know not so good but I need it to be like this format...

Aucun commentaire:

Enregistrer un commentaire