This code works fine on *.nix machine, yet on my windows server it doesn't function. I've migrated many of my sites to my new windows server, but the code doesn't work. The templated files are not drawn. I have tryed to modify the code, but without any success. I have another version that uses the 'switch' function instead of the if. The file calls for a URL as follows: ?act=step1 -> should show step1 template ?act=step1do -> should show step1do template etc... But it's as if the $act isn't being passed. <?php $allowed = false; if (isset($_POST['pass']) && ($_POST['pass']!='')) { if ($_POST['pass']==$admin_pass) { setcookie("admin",md5($_POST['pass'])); $allowed = true; } } else $allowed = ($_COOKIE['admin']==md5($admin_pass)); $tmpl = new StyleObject(); $cheats = new CheatObject(); if (!$allowed) { $tmpl->drawteplate("admin_pass.htm"); exit(); } $tmpl->drawteplate("admin_main.htm"); if ($act == "step1") { $tmpl->drawteplate("admin_step1.htm"); } elseif ($act == "step1do") { if ($_POST['resent']==1) $tmp = $game->get_gameslist($_POST['url']); else $tmp = $game->get_gameslist($_POST['url']."?".$_POST['letter']); $tmpl->setvariable("count",$tmp); $tmpl->drawteplate("admin_step1do.htm"); } elseif ($act == "step2") { $tmpl->setvariable("list",$game->getneededlist()); $tmpl->drawteplate("admin_step2.htm"); } elseif ($act == "step2do") { $tmpl->setvariable("number",$game->addnew()); $tmpl->drawteplate('admin_step2do.htm'); } elseif($act == "manual") { $tmpl->drawteplate("admin_manual.htm"); } elseif ($act == "manualdo") { if ($cheats->add_game($_POST['title'],$_POST['cont'])) $tmpl->setvariable("msg","Game added!"); else $tmpl->setvariable("msg","This game already exist!"); $tmpl->drawteplate("admin_manualdo.htm"); } ?> PHP:
Where do you set the $act variable? If you've been relying on register globals on your *nix box, you should add $act = $_GET['act'] to see if that helps.
It's not that he didn't think to set it... he just assumed register globals to be on. jfontestad: in the nicest possible way, you have to stop that right now! By now *every* PHP developer should know how nasty and insecure register globals is. It's a security nightmare and I find it hard to believe that people don't know this. On top of that, I'm 99% sure that register_globals isn't even going to exist in the next major release of PHP, so you may as well get used to it...
ha... Thanks twistmyarm... hahaha like the username too... very unique. I'm just used to coding for a *.nix enviornment where globals were always on. Then I switched to windows... and didn't even think of it. But thanks you guys.