note 49744 rejected from ref.session by irchtml
| From: | irchtml@php.net | Date: | Wed, 02 Mar 2005 15:19:19 +0000 |
| Subject: | note 49744 rejected from ref.session by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-85781@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I'm having toubles using sessions on my local (XP)machine.
I'm using a loginscript that works fine on line but it won't work at home.
here's the code:
if (!empty($_POST)){
include("dbconnection.php");
$query = "SELECT * FROM table WHERE nick='" . $_POST["nick"] ."'
AND wachtwoord='". $_POST["wachtwoord"]. "'";
$result = mysql_query($query) or die("FOUT : " . mysql_error());
if (mysql_num_rows($result) > 0){
// nick gevonden, registreer gegevens in session
while (list($id, $nick, $email, $wachtwoord, $club) = mysql_fetch_row($result)){
$nick = $_POST["nick"];
$wachtwoord = $_POST["wachtwoord"];
session_register("id");
session_register("nick");
session_register("wachtwoord");
session_register("club");
// Doorsturen
if ($nick=="x" AND $wachtwoord="x"){
header("Location: menu.php");
exit();}
else {
header("Location: target.php");
}
exit(); }
}else{
This redirection works perfectly but the information in the session is lost in the next script where
is verified is a session exist and the data exist in a database.
<?php
if (!isset($_SESSION["wachtwoord"])){
$tekst = "<center><h2>JNot logged in !</h2>
<a href=\"login.php\">Login</a> or <a
href=\"reg.php\">register</a></center>";
echo($tekst);
exit();
}
?>
I'm just getting a session file for each time I run a script in stead of reusing the session
data.
Can anybody help ?