[PHP] อยากทราบวิธีการเปลี่ยนรหัสผ่านโดยไม่ส่ง E-mail
Code (PHP)
<?php
ob_start();
session_start();
include './connectdb.php';
?>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="login">
<h1>Welcome!</h1>
<form method="POST">
<div class="field-wrap">
<label>
Username<span class="req"></span>
</label>
<input type="text" name="usernameid" required autocomplete="off"/>
</div>
<div class="field-wrap">
<label>
New Password<span class="req"></span>
</label>
<input type="password" name="newpass" required autocomplete="off"/>
</div>
<div class="field-wrap">
<label>
Confirm Password<span class="req"></span>
</label>
<input type="password" name="confirmpass" required autocomplete="off"/>
</div>
<button type="submit" name="login" class="button button-block"/>Log In</button>
</form>
</div>
<?php
if(isset($_POST['forgot'])){
$usernameid=$_POST['usernameid'];
$newpass= ($_POST['newpassword']);
$confirmpass= ($_POST['confirmpass']);
if($newpass != $confirmpass){
echo "<font color=\"white\">***Password is not correct***</font>";
}
else {
$sql_check = "SELECT * FROM `user` WHERE `username`=$usernameid";
$query_check = mysqli_query($link, $sql_check);
$result = mysqli_fetch_array($query_check);
if(mysqli_num_rows($query_check)==1){
$sql = "update user set password='$newpass' where username='$usernameid'"; //"INSERT INTO `user`(`username`, `password`) VALUES ($username,$pass)";
$query = mysqli_query($link, $sql);
header("location:index.php");
}
else {
echo "<font color=\"white\">***Password is already***</font>";
}
}
}
?>
</body>
</html>
มือใหม่มากๆเลยค่ะ... ไม่เออเร่อ ไม่แก้ให้ด้วย...
Date :
2018-12-05 19:21:19
By :
ny2003
Load balance : Server 03