User Login with PDO
| From: | Mian Shahzad | Date: | Mon, 11 Apr 2011 20:13:57 +0000 |
| Subject: | User Login with PDO | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-10836@lists.php.net to get a copy of this message | ||
Hello
as we make user login system with this regular php code
how can we do the same thing with PDO extensions?
<?php
include("../includes/connectdb.php");
$UserName = $_POST['UserName'];
$UserPassword = $_POST['Pasword'];
$strSql = "select UserID,UserName from users where UserName='$UserName' and
UserPassword ='$UserPassword'";
$resultlogin=mysql_query($strSql);
$intCountRecord=mysql_num_rows($resultlogin);
if($intCountRecord==1)
{
session_start();
$_SESSION['username']=$UserName;
$_SESSION['password']=$Password;
header("Location:index.php");
}
else
{
echo("Login Successful");
}
?>