change password
<?php
if(isset($_POST['change']))
{
include"include/connection.php";
$query='select * from enabler_register where username="'.$_SESSION['username'].'"and password="'.$_POST['pass'].'"';
$res=mysqli_query($con,$query);
if(mysqli_num_rows($res)>0)
{
if(strlen($_POST['pass1'])>=6)
{
if($_POST['pass1']==$_POST['pass2'])
{
$query1='update enabler_register set password="'.$_POST['pass1'].'" ,password="'.$_POST['pass2'].'"
where username="'.$_SESSION['username'].'"';
$res1=mysqli_query($con,$query1);
//echo $query1;
if($res1)
{
echo"<script>";
echo"alert('Password Change Successfully');";
echo"</script>";
}
else
{
echo"Error";
}
}
else
{
echo"<script>";
echo"alert('confirm Password is not match with new Password');";
echo"</script>";
}
}
else
{
echo"<script>";
echo"alert('Password Length must be Greater than or equal to 6');";
echo"</script>";
}
}
else
{
echo"<script>";
echo"alert('Old password is wrong. Please Enter valid Password');";
echo"</script>";
}
}
?>
if(isset($_POST['change']))
{
include"include/connection.php";
$query='select * from enabler_register where username="'.$_SESSION['username'].'"and password="'.$_POST['pass'].'"';
$res=mysqli_query($con,$query);
if(mysqli_num_rows($res)>0)
{
if(strlen($_POST['pass1'])>=6)
{
if($_POST['pass1']==$_POST['pass2'])
{
$query1='update enabler_register set password="'.$_POST['pass1'].'" ,password="'.$_POST['pass2'].'"
where username="'.$_SESSION['username'].'"';
$res1=mysqli_query($con,$query1);
//echo $query1;
if($res1)
{
echo"<script>";
echo"alert('Password Change Successfully');";
echo"</script>";
}
else
{
echo"Error";
}
}
else
{
echo"<script>";
echo"alert('confirm Password is not match with new Password');";
echo"</script>";
}
}
else
{
echo"<script>";
echo"alert('Password Length must be Greater than or equal to 6');";
echo"</script>";
}
}
else
{
echo"<script>";
echo"alert('Old password is wrong. Please Enter valid Password');";
echo"</script>";
}
}
?>
Comments
Post a Comment