I need help completing the code to reset the password
Discussion on I need help completing the code to reset the password within the SRO PServer Questions & Answers forum part of the SRO Private Server category.
Register for handling an error during the holding at, please go to support.
These are the codes for the buttons
PHP Code:
case "lostpw": // Register case start on here
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if(!$_POST) //if there is no post send here
{
?>
$email = anti_injection($_POST["email"]);
$passwordcheck = odbc_num_rows(odbc_exec($connectacc, "SELECT * FROM dbo.TB_User WHERE StrUserID = '$userID' AND password = '$oldencrypt'"));
$emailcheck = odbc_num_rows(odbc_exec($connectacc, "SELECT * FROM dbo.TB_User WHERE StrUserID = '$userID' AND email = '$email'"));
if($userID == "" || $newpassword == "" || $newpassword2 == "" || $email == ""){
echo "<div class='error'>Please fill all fields</div>";
}else if ($newpassword != $newpassword2) {
echo "<div class='error'>Password does not match!</div>";
}else if (strlen($newpassword) <= "3" || strlen($newpassword) >= "21") {
echo "<div class='error'>Password should be between 4 and 21 characters</div>";
}else if (strlen($newpassword2) <= "3" || strlen($newpassword2) >= "21") {
echo "<div class='error'>Password should be between 4 and 21 characters</div>";
}else if(!filter_var($email,FILTER_VALIDATE_EMAIL)){
echo "<div class='error'>Email is not valid!</div>";
} else if($emailcheck == "0"){
echo "<div class='error'>Email is incorrect!</div>";
} else {
if(odbc_exec($connectacc, "UPDATE dbo.TB_User SET password = '$encrypt' WHERE StrUserID = '$userID'"))
{
echo "<div class='ok'>Password is changed successful! , Please take Care of your informations </div>";
}
else
{
echo "<div class='error'>Register for handling an error during the holding at, please go to support.</div>";
}
}
}
}
?>
<?php
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
break; // Default case finish on here
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
<?php
include('db.php');
if (isset($_GET["key"]) && isset($_GET["email"]) && isset($_GET["action"])
&& ($_GET["action"]=="reset") && !isset($_POST["action"])){
$key = $_GET["key"];
$email = $_GET["email"];
$curDate = date("Y-m-d H:i:s");
$query = mysqli_query($con,
"SELECT * FROM `password_reset_temp` WHERE `key`='".$key."' and `email`='".$email."';"
);
$row = mysqli_num_rows($query);
if ($row==""){
$error .= '<h2>Invalid Link</h2>
<p>The link is invalid/expired. Either you did not copy the correct link
from the email, or you have already used the key in which case it is
deactivated.</p>
<p><a href="https://www.allphptricks.com/forgot-password/index.php">
Click here</a> to reset password.</p>';
}else{
$row = mysqli_fetch_assoc($query);
$expDate = $row['expDate'];
if ($expDate >= $curDate){
?>
<br />
<form method="post" action="" name="update">
<input type="hidden" name="action" value="update" />
<br /><br />
<label><strong>Enter New Password:</strong></label><br />
<input type="password" name="pass1" maxlength="15" required />
<br /><br />
<label><strong>Re-Enter New Password:</strong></label><br />
<input type="password" name="pass2" maxlength="15" required/>
<br /><br />
<input type="hidden" name="email" value="<?php echo $email;?>"/>
<input type="submit" value="Reset Password" />
</form>
<?php
}else{
$error .= "<h2>Link Expired</h2>
<p>The link is expired. You are trying to use the expired link which
as valid only 24 hours (1 days after request).<br /><br /></p>";
}
}
if($error!=""){
echo "<div class='error'>".$error."</div><br />";
}
} // isset email key validate end
if(isset($_POST["email"]) && isset($_POST["action"]) &&
($_POST["action"]=="update")){
$error="";
$pass1 = mysqli_real_escape_string($con,$_POST["pass1"]);
$pass2 = mysqli_real_escape_string($con,$_POST["pass2"]);
$email = $_POST["email"];
$curDate = date("Y-m-d H:i:s");
if ($pass1!=$pass2){
$error.= "<p>Password do not match, both password should be same.<br /><br /></p>";
}
if($error!=""){
echo "<div class='error'>".$error."</div><br />";
}else{
$pass1 = md5($pass1);
mysqli_query($con,
"UPDATE `users` SET `password`='".$pass1."', `trn_date`='".$curDate."'
WHERE `email`='".$email."';"
);
mysqli_query($con,"DELETE FROM `password_reset_temp` WHERE `email`='".$email."';");
echo '<div class="error"><p>Congratulations! Your password has been updated successfully.</p>
<p><a href="https://www.sample.com/forgot-password/login.php">
Click here</a> to Login.</p></div><br />';
}
}
?>
Need help with reset acc password 07/07/2012 - Shaiya Private Server - 3 Replies Hello Elitepvpers! I'm need php script for reset account password. Thanks :handsdown:
Need help with completing my 5165 source 06/27/2010 - CO2 Private Server - 0 Replies hello guys, i have co pserver 5165
well my source is not 100% complete, i need some help
1-ShopFlag system "i can sit but i can't put items for sell, i tryied all the prices and it doesn't worked"
http://img641.imageshack.us/img641/8131/shopflag. png
2- Flower System: it's not existing, there is the flowers in VIP shop, but i cant send, and femele can't get flowers
3- Nobility: i'm trying to clean it, well i enter in Nobility.dat, i delete all what's written, so i start server,...