Question : How to make simple PHP IF function for the following simple scenario ?

Hi,

I would like to request an assistant.

I would like to have the following scenario :

if $description contain string "Domain" and also string ".my" , and also the $newuid is one of the following  :

azira
admin
fazli

Then the script will continue, otherwise produce error message.

Attaches is my current script, but it limit only to "azira" for $newuid .

Appreciates if anybody can alter this for me.

Thank you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
if ( strstr("$description", "Domain") && strstr("$description", ".my") && $newuid !=="azira" ) {

echo "<b><font color='red' size='3'> Only Azira can run this job</font></b>";
flush;
$result = update_queue_status("3",$qid,"Only Azira can run this job");
echo "<br />" ;
break;
}

else {}

Answer : How to make simple PHP IF function for the following simple scenario ?

Try this

$allowedUsers = array("azira", "admin", "fazli");
if ( strstr($description, "Domain") && strstr($description, ".my") && !in_array($newuid, $allowedUsers) {

This way you will be able to add or subtract allowed users only adding to or subtracting elements from the array.

Sorry, but can you say what was the problem and how you have solved it?

Bye
Random Solutions  
 
programming4us programming4us