PHP login with MYSQL Question?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux