<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name="user"; // Table name
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'];
$time = time();
$check = $_POST['checkbox'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE user_id='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1)
{
if($check)
{
setcookie('myusername', $username, $time + 3600); // Sets the cookie username
setcookie('mypassword', $password, $time + 3600); // Sets the cookie password
}
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password / You don't fill the box correctly ";
}
?>
I'm new in PHP, now i'm trying to make a menu log in with remember me..there is no error in code above, but the password and username can't be remember...
Is there someone can help me?please i need ur help..thx..