i have a php snippet saying: if this session variable is this, change the header location to this.
the session variables arent working, however.
must the pages be linked?
$query = mysql_query("SELECT * FROM `username` WHERE `password` = '$pword' AND `username` = '$uname'");
$exsists = 0;
WHILE($rows = mysql_fetch_array($query)){
$exsists = 1;
break;
}
if ($exsists){
$_SESSION['usern23']=$uname;
$_SESSION['logged']=1;
header('Location: logged2.php');
}
$_SESSION['usern'] wont show up on logged2.php
No they do not have to be linked, but you need to have session_start()
at the top of your code on both pages.
Take a look at the documentation to read about session_start()
Also:
After the header('Location: logged2.php');
nothing else should be executed. When your script reaches that line, it will redirect you and you will never see the message you have next.
You should use session_write_close();
to save a session before doing a redirect.