Whalenut Posted July 24, 2007 Share Posted July 24, 2007 Hi I´m what you would call a newbie with PHP coding, but i have made a login script using sessions. Now my problem is that when I use firefox or Netscape i have to log in twice to actually log in. My question is: Is there something wrong with my script? <?php if(empty($_POST['AnvId']) or empty($_POST['LosenOrd']) ) { echo "fyll i båda fälten"; //saying: fill both fields! } else { include('pics/detdu.php'); $AnvId = str_replace("'","''",$_POST['AnvId']); $LosenOrd = str_replace("'","''",$_POST['LosenOrd']); $cxn = mysql_connect($host, $user, $dbLogin); mysql_select_db($dBase); $sql = 'select link from users where user="'.trim($AnvId).'" and password="'.trim($LosenOrd).'";'; $result = mysql_query($sql); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); if ($row[0] == "") { header("Location:http://www.whalenut.se/design/index.php"); } else { session_start(); $_SESSION['AnvId'] == $_POST['AnvId']; header("Location:$row[0]"); } } ?> I´m am thankfull for any type of constructive answers and/or comments Quote Link to comment Share on other sites More sharing options...
envexlabs Posted July 24, 2007 Share Posted July 24, 2007 Hey, I think it has something to do with setting POST variables into your SESSIONS, and refreshing using PHP_SELF. Quote Link to comment 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.