Paste: rempahtoo2
Author: | xander |
Mode: | php |
Date: | Mon, 17 Jan 2011 10:11:58 |
Plain Text |
<?php
$host="localhost";
$username="root";
$password="kikilala123";
$db_name="test";
$tbl_name="members";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:admin/index.php");
}
else {
echo "Wrong Username or Password";
}
?>
New Annotation