dropfaith Posted January 6, 2009 Share Posted January 6, 2009 its on line 73 this scripott is part of a huge user system i have that was working up until a few days ago i had someone else working on things a bit for me now its all messed up well the user system at least this is line 69 thru 76 73 being this !valid_email($email) || $password != $password2 || user_exists($username)) function registerNewUser($username, $password, $password2, $email) { global $seed; if (!valid_username($username) || !valid_password($password) !valid_email($email) || $password != $password2 || user_exists($username)) { return false; } <?php ##### User Functions ##### function changePassword($username,$currentpassword,$newpassword,$newpassword2){ global $seed; if (!valid_username($username) || !user_exists($username)) { return false; } if (! valid_password($newpassword) || ($newpassword != $newpassword2)){ return false; } // we get the current password from the database $query = sprintf("SELECT password FROM login WHERE username = '%s' LIMIT 1", mysql_real_escape_string($username)); $result = mysql_query($query); $row= mysql_fetch_row($result); // compare it with the password the user entered, if they don't match, we return false, he needs to enter the correct password. if ($row[0] != sha1($currentpassword.$seed)){ return false; } // now we update the password in the database $query = sprintf("update login set password = '%s' where username = '%s'", mysql_real_escape_string(sha1($newpassword.$seed)), mysql_real_escape_string($username)); if (mysql_query($query)) { return true; }else {return false;} return false; } function user_exists($username) { if (!valid_username($username)) { return false; } $query = sprintf("SELECT loginid FROM login WHERE username = '%s' LIMIT 1", mysql_real_escape_string($username)); $result = mysql_query($query); if (mysql_num_rows($result) > 0) { return true; } else { return false; } return false; } function activateUser($uid, $actcode) { $query = sprintf("select activated from login where loginid = '%s' and actcode = '%s' and activated = 0 limit 1", mysql_real_escape_string($uid), mysql_real_escape_string($actcode)); $result = mysql_query($query); if (mysql_num_rows($result) == 1) { $sql = sprintf("update login set activated = '1' where loginid = '%s' and actcode = '%s'", mysql_real_escape_string($uid), mysql_real_escape_string($actcode)); if (mysql_query($sql)) { return true; } else { return false; } } else { return false; } } function registerNewUser($username, $password, $password2, $email) { global $seed; if (!valid_username($username) || !valid_password($password) !valid_email($email) || $password != $password2 || user_exists($username)) { return false; } $code = generate_code(20); $sql = sprintf("insert into login (username,password,email,actcode) value ('%s','%s','%s','%s')", mysql_real_escape_string($username), mysql_real_escape_string(sha1($password . $seed)) , mysql_real_escape_string($email), mysql_real_escape_string($code)); if (mysql_query($sql)) { $id = mysql_insert_id(); if (sendActivationEmail($username, $password, $id, $email, $code)) { return true; } else { return false; } } else { return false; } return false; } function lostPassword($username, $email) { global $seed; if (!valid_username($username) || !user_exists($username) || !valid_email($email)) { return false; } $query = sprintf("select loginid from login where username = '%s' and email = '%s' limit 1", $username, $email); $result = mysql_query($query); if (mysql_num_rows($result) != 1) { return false; } $newpass = generate_code(; $query = sprintf("update login set password = '%s' where username = '%s'", mysql_real_escape_string(sha1($newpass.$seed)), mysql_real_escape_string($username)); if (mysql_query($query)) { if (sendLostPasswordEmail($username, $email, $newpass)) { return true; } else { return false; } } else { return false; } return false; } ?> Link to comment https://forums.phpfreaks.com/topic/139664-solved-parse-error-syntax-error-unexpected-in/ Share on other sites More sharing options...
DarkWater Posted January 6, 2009 Share Posted January 6, 2009 if (!valid_username($username) || !valid_password($password) || !valid_email($email) || $password != $password2 || user_exists($username)) { You left the || off of !valid_password($password). The code above is the fixed version; compare it to yours. Link to comment https://forums.phpfreaks.com/topic/139664-solved-parse-error-syntax-error-unexpected-in/#findComment-730730 Share on other sites More sharing options...
dropfaith Posted January 6, 2009 Author Share Posted January 6, 2009 your awesome saved me a ton of time and that tiny error was cuaseing the entire issue for my log in system.. Link to comment https://forums.phpfreaks.com/topic/139664-solved-parse-error-syntax-error-unexpected-in/#findComment-731099 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.