LostAngel Posted July 14, 2008 Share Posted July 14, 2008 Hello again, I have the following check: <?php session_start(); echo $_SESSION['count']; if ( $_SESSION['count'] == "1" ) { echo "logged in right!<br />"; } <im guessing the redirect code goes here> ?> I want the page to redirect to www.website.com IF $_SESSION['count'] is not 1...when I put a basic html redirect above, it redirected no matter what. I used this code: echo "<META http-equiv=\"Refresh\" content=\"0; url=http://website.com\">"; Link to comment https://forums.phpfreaks.com/topic/114716-check-variable-value-if-not-1-then-redirect/ Share on other sites More sharing options...
MatthewJ Posted July 14, 2008 Share Posted July 14, 2008 <?php session_start(); if ( $_SESSION['count'] == "1" ) { header("Location: www.website.com"); } ?> Link to comment https://forums.phpfreaks.com/topic/114716-check-variable-value-if-not-1-then-redirect/#findComment-589885 Share on other sites More sharing options...
LooieENG Posted July 14, 2008 Share Posted July 14, 2008 Also, for the HTML redirect to work, it would need to go INSIDE your IF statement Link to comment https://forums.phpfreaks.com/topic/114716-check-variable-value-if-not-1-then-redirect/#findComment-589887 Share on other sites More sharing options...
papaface Posted July 14, 2008 Share Posted July 14, 2008 <?php session_start(); if ( $_SESSION['count'] == "1" ) { header("Location: www.website.com"); } ?> Should be:[<?php session_start(); if ( $_SESSION['count'] != "1" ) { header("Location: http://www.website.com"); } ?> Link to comment https://forums.phpfreaks.com/topic/114716-check-variable-value-if-not-1-then-redirect/#findComment-589893 Share on other sites More sharing options...
MatthewJ Posted July 14, 2008 Share Posted July 14, 2008 @papaface....Yeah, what he said Link to comment https://forums.phpfreaks.com/topic/114716-check-variable-value-if-not-1-then-redirect/#findComment-589911 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.