mikey.rr Posted October 28, 2007 Share Posted October 28, 2007 Well, I'm making a CMS...and I started on it today. I have the very basic member login system down...but I have a little problem. How do I make a page redirect? Not with the header thing either... My examples: This is if someone enters 'index.php'. It will automatically, and hopefully instantly, redirect them to 'index.php?act=index'. elseif(empty($act)) { //somehow redirect to index.php?act=index here } And this is in the login validation file... If they login correctly, it sets a session variable to 1, meaning you are logged in throughout the site. Then, it redirects them back to index.php?act=index. But I can't figure out how to do that either... } else { $_SESSION['logged_in'] = '1'; $_SESSION['username'] = $username; echo 'Thank you for logging in, '.$username; echo "<br /><b><font size='2'><a href='?act=index'>Click here to return to the index</a></font></b>"; //I'd like to replace the above line with the redirect } Help please? Quote Link to comment https://forums.phpfreaks.com/topic/75064-redirect-help/ Share on other sites More sharing options...
joeysarsenal Posted October 28, 2007 Share Posted October 28, 2007 best way to redirect is threw headers i found. if($result) { if(mysql_num_rows($result)>0) { //Login Successful session_regenerate_id(); $member=mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID']=$member['member_id']; session_write_close(); header("location: ../Loginsucces.htm"); exit(); }else { //Login failed header("location: ../loginfailed.htm"); exit(); } Quote Link to comment https://forums.phpfreaks.com/topic/75064-redirect-help/#findComment-379650 Share on other sites More sharing options...
mikey.rr Posted October 28, 2007 Author Share Posted October 28, 2007 Oh wow I'm stupid. I just had to do this: <script type="text/javascript"> <!-- window.location = "?act=index" //--> </script> But how would I be able to delay that a few seconds? Quote Link to comment https://forums.phpfreaks.com/topic/75064-redirect-help/#findComment-379653 Share on other sites More sharing options...
GingerRobot Posted October 28, 2007 Share Posted October 28, 2007 Use the HTML meta tag: <meta http-equiv="refresh" content="2;url=http://www.google.com"> Would redirect to google after 2 seconds. Quote Link to comment https://forums.phpfreaks.com/topic/75064-redirect-help/#findComment-379715 Share on other sites More sharing options...
LemonInflux Posted October 28, 2007 Share Posted October 28, 2007 They don't work in IE6, apparently. Another reason people should get firefox, I guess. Quote Link to comment https://forums.phpfreaks.com/topic/75064-redirect-help/#findComment-379717 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.