You're saying it's a bad code just because I was wrong about error reporting?
Nope, if you actually read what I wrote I said it's bad code as you don't do any proper checks on what is being run and always tell the user the mysql_error which they don't need to know.
Quote:
Originally Posted by renan7899
It's a basic script, but it does the job.
Just because it is simple doesn't mean it should be lazily written or give excess information the user doesn't need to see.
29-09-11
hrace009
Re: Change pass script pls?
Quote:
Originally Posted by renan7899
You're saying it's a bad code just because I was wrong about error reporting?
It's a basic script, but it does the job.
"I may dislike you due to stupid thing you do..."
I like and dislike many people here, but I don't need to put my personal feelings in a post, you shouldn't too. Hell, you were complaining even about the red text above.
Quote:
Originally Posted by das7002
Nope, if you actually read what I wrote I said it's bad code as you don't do any proper checks on what is being run and always tell the user the mysql_error which they don't need to know.
Just because it is simple doesn't mean it should be lazily written or give excess information the user doesn't need to see.
stop fighting at people thread :closedeyes: and back to topic, perhaps someone can fix this script
30-09-11
Pilad
Re: Change pass script pls?
Quote:
Originally Posted by hrace009
i was modified 343 change password script with 4 digits PIN as security code, but i don't get it working.
IF ($CountNewPassword < 5 OR $CountNewPassword > 10) {
echo "<font color=red>Password Must be at least 5 Characters, and no more than 10. </font><br><input type='button' onClick=location.href='index.php' value='Try Again / Change Your Account Password'></input><br><br>";
}
ELSE {
// Make sure New Password fields match
IF ( $NewPassword !== $ConfirmNew ) {
echo "<font color=red>Confirm New Password Failed. <font color=white>New Password</font> and <font color=white>Confirm New Password</font> Fields Must Match. Please Try Again.</font><br><input type='button' onClick=location.href='index.php' value='Try Again / Change Your Account Password'></input><br><br>";
}
ELSE {
//Count Pin Length
$Pin = strlen($Pin);
IF ($Pin < 4 OR $Pin > 4) {
echo "<font color=red>Pin must have 4 digits.</font><br><input type='button' onClick=location.href='index.php' value='Try Again / Change Your Account Password'></input><br><br>";
}
ELSE {
$GetAccountInfo = Mysql_Query("SELECT * FROM users WHERE name = '$UserName'");
$GetAccountNum = Mysql_Num_Rows($GetAccountInfo);
IF ($GetAccountNum == 1) {
$GetAccountArray = Mysql_Fetch_Array($GetAccountInfo);
$GetPassword = $GetAccountArray['passwd'];
$GetEmail = $GetAccountArray['email'];
$GetPin = $GetAccountArray['qq'];
$GetPassword = addslashes($GetPassword);
$GetEmail = addslashes($GetEmail);
$GetPin = addslashes($GetPin);
$rs = mysql_query("SELECT fn_varbintohexsubstring (1,'$GetPassword',1,0) AS result");
$rs2 = mysql_query("SELECT '$GetEmail' AS result2");
$rs3 = mysql_query("SELECT '$GetPin' AS result3");
$GetResult = Mysql_Fetch_Array($rs);
$GetResultEmail = Mysql_Fetch_Array($rs2);
$GetResultPin = Mysql_Fetch_Array($rs3);
$CheckPassword = $GetResult['result'];
$CheckEmail = $GetResultEmail['result2'];
$CheckPin = $GetResultPin['result3'];
IF ($EMail == $CheckEmail) {
IF ($Pin == $CheckPin) {
IF ($EncryptOldPassword == $CheckPassword) {
Mysql_Query("CALL changePasswd ($GetAccountInfo->quoteSmart'$UserName', $EncryptNewPassword)");
Mysql_Query("CALL changePasswd2 ($GetAccountInfo->quoteSmart'$UserName', $EncryptNewPassword)");
echo "<font color='green' size='+2'>Password for Account: <font color=red>$UserName</font> has been changed</font><br><input type='button' onClick=location.href='index.php' value='Go Back'></input><br><br>";
}
ELSE {
echo "<font color=red>Account Information is Incorrect! </font><br><input type='button' onClick=location.href='index.php' value='Try Again / Change Your Account Password'></input><br><br>";
}
}
}
ELSE {
echo "<font color=red>Account Information is Incorrect! </font><br><input type='button' onClick=location.href='index.php' value='Try Again / Change Your Account Password'></input><br><br>";
}
}
}
}
}
}
?>
connector.php
PHP Code:
<?php
/*---343 change password script---*/
/*-------Config MySQL Database-------*/
$DB_Host = "localhost"; // localhost or your IP for MySQL
$DB_User = "root"; // Database username
$DB_Password = "root"; // Database password
$DB_Name = "data"; // Database name
$ServerIP = "localhost"; // WAN IP (Public IP) or DOMAIN NAME of your Server
$LanIP = "localhost"; // LAN IP of your Server
$ServerPort = "29000"; // PW Server Port
$top=50; // How many top players to show (on rank page)