drmota Posted January 31, 2011 Share Posted January 31, 2011 Hey guys, If my php looks like this: (notify if errors) <?php $user=$_POST['user']; $pass=$_POST['pass']; if(($user=="testing") && ($pass=="testing123")) echo "Access Granted"; if other echo "Access Denied!" ?> If after the "Access Granted" It could redirect the user to another webpage, index2.html for instance. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/226241-redirecting-in-php/ Share on other sites More sharing options...
coupe-r Posted January 31, 2011 Share Posted January 31, 2011 echo '<meta HTTP-EQUIV="REFRESH" content="5"; url="index2.html">'; content = 5 seconds Quote Link to comment https://forums.phpfreaks.com/topic/226241-redirecting-in-php/#findComment-1167878 Share on other sites More sharing options...
atrum Posted January 31, 2011 Share Posted January 31, 2011 <?php $user=$_POST['user']; $pass=$_POST['pass']; if(($user=="testing") && ($pass=="testing123")){ echo "Access Granted"; header("Location: http://domain.com/another_webpage/"); }else{ if other echo "Access Denied!" } ?> Something like that should get ya started. Quote Link to comment https://forums.phpfreaks.com/topic/226241-redirecting-in-php/#findComment-1167881 Share on other sites More sharing options...
litebearer Posted January 31, 2011 Share Posted January 31, 2011 note: when using header CRITICAL that NOTHING was output to browser prior to the header statement Quote Link to comment https://forums.phpfreaks.com/topic/226241-redirecting-in-php/#findComment-1167882 Share on other sites More sharing options...
atrum Posted January 31, 2011 Share Posted January 31, 2011 note: when using header CRITICAL that NOTHING was output to browser prior to the header statement Good point. Quote Link to comment https://forums.phpfreaks.com/topic/226241-redirecting-in-php/#findComment-1167884 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.