note 49744 added to ref.session
| From: | php-general at lists dot php dot net | Date: | Mon, 07 Feb 2005 17:37:18 +0000 |
| Subject: | note 49744 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84625@lists.php.net to get a copy of this message | ||
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 ?
----
Manual Page -- http://www.php.net/manual/en/ref.session.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49744
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49744&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49744&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49744&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49744&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49744&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49744&report=yes
Search -- http://master.php.net/manage/user-notes.php