Project Report of Electricity Billing System
Page - 93
change_password();
}
####Function check user#######
function check_login()
{
$user_user=$_REQUEST[user_user];
$user_password=$_REQUEST[user_password];
$SQL="SELECT * FROM user WHERE user_username = '$user_user' AND user_password =
'$user_password'";
$rs = mysql_query($SQL) or die(mysql_error());
if(mysql_num_rows($rs))
{
$_SESSION[login]=1;
$_SESSION['user_details'] = mysql_fetch_assoc($rs);
header("Location:../index.php");
}
Project Report of Electricity Billing System
Page - 94
else
{
header("Location:../login.php?msg=Invalid User and Password.");
}
}
####Function logout####
function logout()
{
$_SESSION[login]=0;
$_SESSION['user_details'] = 0;
header("Location:../login.php?msg=Logout Successfullly.");
}
#####Function for changing the password ####
function change_password() {
$R = $_REQUEST;
if($R['user_confirm_password'] != $R['user_new_password']) {
Project Report of Electricity Billing System
Page - 95
header("Location:../change-password.php?msg=Your new passsword and confirm
password does not match!!!");
exit;
}
$SQL = "UPDATE `user` SET user_password = '$R[user_new_password]' WHERE `user_id` =
".$_SESSION['user_details']['user_id'];
$rs = mysql_query($SQL) or die(mysql_error());
header("Location:../change-password.php?msg=Your Password Changed Successfully !!!");
print $SQL;
die;
}
?>
|