View Single Post
  #9 (permalink)  
Old 08-15-03, 05:37 PM
YourPHPPro's Avatar
YourPHPPro YourPHPPro is offline
Community VIP
 
Join Date: Aug 2003
Posts: 430
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
$username = $_POST['username'];
$password = $_POST['password'];

include ("dbconnect.php");// supplies credentials to connect to Database

$sql = "SELECT * FROM logins ";
$sql .= "WHERE user='".$username."';";
Also, you would need to do some checking on the 'username'. It is not a good idea to query user supplied information from a DB without checking it.

One way to do it would be something like this:

Quote:
$SQL = "SELECT Users_ID, Users_Access FROM users WHERE Users_Name=" . Custom_StripText($login) . " AND Users_Password=" . Custom_StripText($password);
$db->query($SQL);
$Result = $db->next_record();
if($Result) {
SetSession("UserID", $Result("Users_ID"));
SetSession("UserLogin", $login);
SetSession("UserPassword", $password);
SetSession("AccessLevel", $Result("Users_Access"));
}

Last edited by YourPHPPro; 08-15-03 at 05:57 PM.
Reply With Quote