bsamson Posted May 12, 2007 Share Posted May 12, 2007 Hello, I have a script that I have wrote ... that I cannot seem to be able to figure out ... here it is ... This code works if the IP address is a match, BUT if it is not a match why does this code not use the DEFAULT switch?? Please, any assistance would be greatly appreciated! $ip = $REMOTE_ADDR; switch ($ip) { case '***********': setcookie("nym_loc", "Great Northern", time()+3600); setcookie("nym_fst", "NCB11620-4", time()+3600); setcookie("nym_pre", "42871", time()+3600); break; case '*********': setcookie("nym_loc", "Shoppingtown", time()+3600); setcookie("nym_fst", "NCB11620-6", time()+3600); setcookie("nym_pre", "42872", time()+3600); break; case '**********': setcookie("nym_loc", "Liverpool", time()+3600); setcookie("nym_fst", "NCB11620-1", time()+3600); setcookie("nym_pre", "42639", time()+3600); break; case '*********': setcookie("nym_loc", "Camillus", time()+3600); setcookie("nym_fst", "NCB11620-8", time()+3600); setcookie("nym_pre", "42876", time()+3600); break; case '**********': setcookie("nym_loc", "Colonie", time()+3600); setcookie("nym_fst", "NCB11620-7", time()+3600); setcookie("nym_pre", "42874", time()+3600); break; case '************': setcookie("nym_loc", "Vestal", time()+3600); setcookie("nym_fst", "NCB11620-2", time()+3600); setcookie("nym_pre", "vestalpc", time()+3600); break; case '*********': setcookie("nym_loc", "New Hartford", time()+3600); setcookie("nym_fst", "NCB11620-10", time()+3600); setcookie("nym_pre", "51885", time()+3600); break; case '**********': setcookie("nym_loc", "Canadaigua", time()+3600); setcookie("nym_fst", "NCB11620-12", time()+3600); setcookie("nym_pre", "canpc", time()+3600); break; case '***********': setcookie("nym_loc", "Cortland", time()+3600); setcookie("nym_fst", "NCB11620-14", time()+3600); setcookie("nym_pre", "cortlandpc", time()+3600); break; case '***********': setcookie("nym_loc", "Watertown", time()+3600); setcookie("nym_fst", "NCB11620-11", time()+3600); setcookie("nym_pre", "51886", time()+3600); break; case '**********': setcookie("nym_loc", "Guest", time()+3600); setcookie("nym_fst", "_____________________", time()+3600); setcookie("nym_pre", "_____________________", time()+3600); break; default: header('http://www.mydomain.com/login.php'); break; } Link to comment https://forums.phpfreaks.com/topic/51010-switch-issue/ Share on other sites More sharing options...
MadTechie Posted May 12, 2007 Share Posted May 12, 2007 any errors? try <?php default: die("HEADER TEST"); break; } ?> Link to comment https://forums.phpfreaks.com/topic/51010-switch-issue/#findComment-250996 Share on other sites More sharing options...
bsamson Posted May 12, 2007 Author Share Posted May 12, 2007 hmmm ... when I added that code ... it displayed HEADER TEST. Any ideas why what I had didn't work? <?php default: header('http://www.mydomain.com/login.php'); break; ?> Link to comment https://forums.phpfreaks.com/topic/51010-switch-issue/#findComment-251003 Share on other sites More sharing options...
bsamson Posted May 12, 2007 Author Share Posted May 12, 2007 OOPS ... 3 hours of trying to figure this out ... and as usual ... something silly ... header('Location: http://1234.domain.com/login.php'); not header('http://1234.domain.com/login.php'); Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/51010-switch-issue/#findComment-251005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.