vendredi 21 octobre 2016

IF and or in expression > cant get it to work

Can someone help me with this?

I am trying to show some content which is seperate for US or AU visitors. I am geolocating the IP and also using a PHP session (so that the user can switch countries if required)

if ( ($jsonobj->countryCode == "AU" || ($_SESSION['username'] == "AU")) && ( ($jsonobj->countryCode !== "US") || ($_SESSION['username'] !== "US")) ) {
echo 'australian content'; } if ( ($jsonobj->countryCode == "US" || ($_SESSION['username'] == "US")) && ( ($jsonobj->countryCode !== "AU") || ($_SESSION['username'] !== "AU")) ) {
echo 'us content'; } 

I cant get it to work - basically i want the flexibility that either auto by IP to show content or they can manually switch it. Any ideas?

Aucun commentaire:

Enregistrer un commentaire