List Info

Thread: note 68495 added to function.setcookie




note 68495 added to function.setcookie
user name
2006-07-29 22:51:14
i have a problem with my set cookie code it just isnt
working.. please help me if u can:

} 
if ($_POST[login]) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST[password]); 
// the above lines set variables with the submitted
information. 
$info = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data[password] != $password) { 
// the password was not the user's password! 
echo "Incorrect username or password!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id], time()+3600);  /*
expire in 1 hour */
setcookie("pass", $user[password], time()+3600,
"/~rasmus/",
".bretx-designs.x1topsites.com", 1); 
// the above lines set 2 cookies. 1 with the user's id and
another with his/her password. 
echo ("Thank You! You will be 
redirected"); 
// modify the above line...add in your site url instead of
yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("
Welcome $logged[username]

- <a href=\"editprofile.php\">Edit
Profile

- <a href=\"members.php\">Member List

- <a href=\"logout.php\">Logout");

} 
?>
----
Server IP: 216.235.15.211
Probable Submitter: 24.222.215.148
----
X-Spam-Status: No, hits=3.3 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER,
	HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- h
ttp://www.php.net/manual/en/function.setcookie.php
Edit        -- http://master.p
hp.net/note/edit/68495
Del: integrated  -- ht
tp://master.php.net/note/delete/68495/integrated
Del: useless     -- http:
//master.php.net/note/delete/68495/useless
Del: bad code    -- http
://master.php.net/note/delete/68495/bad+code
Del: spam        -- http://m
aster.php.net/note/delete/68495/spam
Del: non-english -- h
ttp://master.php.net/note/delete/68495/non-english
Del: in docs     -- http:
//master.php.net/note/delete/68495/in+docs
Del: other reasons-- http://master
.php.net/note/delete/68495
Reject      -- http://master
.php.net/note/reject/68495
Search      -- http://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 68495 deleted from function.setcookie by betz
user name
2006-07-30 13:13:52
Note Submitter: bret 

----

i have a problem with my set cookie code it just isnt
working.. please help me if u can:

} 
if ($_POST[login]) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST[password]); 
// the above lines set variables with the submitted
information. 
$info = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data[password] != $password) { 
// the password was not the user's password! 
echo "Incorrect username or password!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE
username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id], time()+3600);  /*
expire in 1 hour */
setcookie("pass", $user[password], time()+3600,
"/~rasmus/",
".bretx-designs.x1topsites.com", 1); 
// the above lines set 2 cookies. 1 with the user's id and
another with his/her password. 
echo ("Thank You! You will be 
redirected"); 
// modify the above line...add in your site url instead of
yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("
Welcome $logged[username]

- <a href=\"editprofile.php\">Edit
Profile

- <a href=\"members.php\">Member List

- <a href=\"logout.php\">Logout");

} 
?>

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )