I need help with the following code.
Code that is executed if the user logs in with correct username & password (validate.php):
----------
$_SESSION['letmein'] = true;
$result = mysql_query("SELECT id, username AS uuname FROM user where username='$uname'",$connection);
if ($myrow = mysql_fetch_array($result)) {
$_SESSION["id"]=$myrow['id'];
$_SESSION["username"]=$myrow['uuname'];
header("Location: start.php?option=main");
---------
Code that is executed at top of surf.php:
<?
session_start();
require 'include.inc';
if (!isset($_SESSION['letmein'])){
header ("Location: index.php?invalid=PLEASE LOGIN");
}
----
I need a cookie placed that will automatically log a user in when they visit their surf.php link, the links look like this:
http://www.ANYSITE.com/surf.php?userid=384&username=od
Any help? Thanks in advance!
Need Help with Cookies in PHP
Moderator: General Moderators
-
optimumdiscounts
- Forum Newbie
- Posts: 1
- Joined: Fri Jun 13, 2003 5:55 am
- Location: Illinois