sle09 Posted July 18, 2008 Share Posted July 18, 2008 how would i make this define('ADMIN_LOGIN', 'sle09'); // administrator's login sle09 is the admin how would i make it so admin can be sle09 or jjsbsjn Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/ Share on other sites More sharing options...
awpti Posted July 18, 2008 Share Posted July 18, 2008 Dunno. Contact they fellow that made the webapp. Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593166 Share on other sites More sharing options...
apotterdd Posted July 18, 2008 Share Posted July 18, 2008 Try this define(ADMIN_LOGIN 'sle09', 'jjsbsjn'); I'm not entirely sure if that would work or not. Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593175 Share on other sites More sharing options...
awpti Posted July 18, 2008 Share Posted July 18, 2008 You really should check the manual before offering answers. bool define ( string $name , mixed $value [, bool $case_insensitive ] ) Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593181 Share on other sites More sharing options...
PFMaBiSmAd Posted July 18, 2008 Share Posted July 18, 2008 Your existing code is designed to test a single value. Something like - define('ADMIN_LOGIN', 'sle09'); // administrator's login .... if($some_variable == ADMIN_LOGIN){ // match found } To allow it to test multiple values would require that you change the logic to place the multiple values into an array and then use the in_array() function to test if a value matches an entry in the array. Something like - $admins = array('sle09','jjsbsjn'); .... if(in_array($some_variable, $admins)){ // match found } Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593288 Share on other sites More sharing options...
samshel Posted July 18, 2008 Share Posted July 18, 2008 or better use DB tables... Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593293 Share on other sites More sharing options...
PFMaBiSmAd Posted July 18, 2008 Share Posted July 18, 2008 True. But if the OP needs help with code that is using a defined constant, then they are not ready to use a database. Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-593735 Share on other sites More sharing options...
TempleDMDKrazd Posted July 19, 2008 Share Posted July 19, 2008 Your existing code is designed to test a single value. Something like - define('ADMIN_LOGIN', 'sle09'); // administrator's login .... if($some_variable == ADMIN_LOGIN){ // match found } To allow it to test multiple values would require that you change the logic to place the multiple values into an array and then use the in_array() function to test if a value matches an entry in the array. Something like - $admins = array('sle09','jjsbsjn'); .... if(in_array($some_variable, $admins)){ // match found } best answer is here! Link to comment https://forums.phpfreaks.com/topic/115380-defineadmin_login-sle09-administrators-login/#findComment-594044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.