$group $group_list='&groups='; foreach($groups as $group){ $group_list.="$group%0D%0A"; } //Trim the last 6 characters, wich are "%0D%0A", off of the last group $group_list=substr($group_list, 0, strlen($group_list)-6); $reply=file_get_contents(''.$list_server.'?action=CHECKTOKENS&checktokens='.$callsign.'%3D'.$token.''.$group_list.''); //If we got a TOKBAD, return false, because the token can't be right if(strpos($reply, 'TOKBAD: ')) return false; //Here's where it gets tricky: making sure the user is in all groups specified $group_list=''; foreach($groups as $group){ $group_list.=":$group"; } if(strpos($reply, "TOKGOOD: $callsign$group_list")){ return true; }else{ return false; } } ?>