$_SESSION is better than $_COOKIE ( more secure)

Bastien

From: JeRRy <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Subject: [PHP-DB] PHP login with MYSQL Question?
Date: Fri, 18 Nov 2005 22:34:08 +1100 (EST)

Hi,

Okay I created a user/pass login area. I created the following code. Now I want the secure area to send a cookie to the users PC we can track so I can make multiple pages without the need for the user to login to each page individually. I want to know what is the best method/code to use as a cookie with the following code. Thanks for the help in advance!

  <?
$password=$_POST['pass'];
mysql_connect ("localhost", "db_username", "db_password") or die ('My SQL Error: ' . mysql_error());
mysql_select_db ("db_dbname");
$stuff = mysql_query("SELECT * FROM `users` WHERE userName='".$userName."' AND userPass='".$userPass."'") or die("MySQL Login Error: ".mysql_error());
if (mysql_num_rows($stuff) > 0) {
$row=mysql_num_rows($stuff);
echo "You are logged in to Admin as $userName <br> <small>Beta Version</small><br><br>";
}
else{
echo ("<title>Incorrect</title><body bgcolor='black' text='red' alink='blue' vlink='blue' link='blue'> <center><br><br><br>Incorrect Password!<br><br><a href='login.php'>try again</a></center> ");
}
  ?>

  J


---------------------------------
 ____________________________________________________
---------------------------------
Do you Yahoo!?
  Never miss an Instant Message - Yahoo! Messenger for SMS

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

Reply via email to