pmg206 Posted April 18, 2008 Share Posted April 18, 2008 I'm trying to write around a unique qualifier on a PHP 4.0.x web page login screen. Currently, each of a few logins direct folks to a specific page unique to them. Worked fine until the company started to grow, and the intent is to allow roles of folks (users, managers, admins) to all view the same single page, but maintaining their individual logins (so sharing a login to accomplish landing on the same page isn't an option). The thought was to change the != Joe in the existing code (below) to something like a != (Joe,Tom,Jack), but the correct operator for a "not in list" has been elusive in the PHP documentation (can't imagine why searching for "in" operator brings back hundreds of responses, y'know, since "in" is such an uncommon term). We did try setting up groups (1, 2, 3, etc.) in the access table, but it seems the login tool keys off of the username as the access control piece. So the question is if (a) such a thing is practical to do a not-in-list sort of thing, or if not (b) if there's a different login tool out there one can suggest, and I'll push The Power That Be that change is for the better. Thanks! // Determine user page view if(!isset($HTTP_COOKIE_VARS['our_yummy_cookie'])){ header("Location: login_or_leave.php"); } else { if($HTTP_COOKIE_VARS['our_yummy_cookie'] != Tony){ header("Location: dashboard2.php"); } } Link to comment https://forums.phpfreaks.com/topic/101747-solved-not-equal-okay-a-quotnot-inquot-operator/ Share on other sites More sharing options...
unidox Posted April 18, 2008 Share Posted April 18, 2008 Use the split function to separate it into an array, then then do it that way. Link to comment https://forums.phpfreaks.com/topic/101747-solved-not-equal-okay-a-quotnot-inquot-operator/#findComment-520568 Share on other sites More sharing options...
effigy Posted April 18, 2008 Share Posted April 18, 2008 if (!in_array($name, array('Joe', 'Tom', 'Jack'))) { ... } Link to comment https://forums.phpfreaks.com/topic/101747-solved-not-equal-okay-a-quotnot-inquot-operator/#findComment-520574 Share on other sites More sharing options...
pmg206 Posted April 18, 2008 Author Share Posted April 18, 2008 Awesome, thank you! Worked perfectly! Link to comment https://forums.phpfreaks.com/topic/101747-solved-not-equal-okay-a-quotnot-inquot-operator/#findComment-520577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.