function User_Validate_New_Email($account_id, $email, $bd) { if (User_Validate_Email($email)) { $query = "SELECT * FROM accounts wHERE (email = '{$email}') AND (account_id <> '{$account_id}')\n\t\t\tAND (role = 'User')"; $result = $bd->Query($query); if ($result) { if ($bd->NumberOfRows($result)) { return 0; } else { return 1; } } else { return 0; } } else { return 0; } }
} else { $image_enable .= "0"; } } if (!User_Authenticate_Password($account_id, $cur_password, $bd)) { $error[$num_errors++] = "The Current Password is Wrong"; } switch (User_Validate_Simple_Field($name, 50)) { case 0: $error[$num_errors++] = "The name is blank"; break; case -1: $error[$num_errors++] = "The name length is more than 50 characters"; break; } switch (User_Validate_Email($email, 70)) { case 0: $error[$num_errors++] = "The e-mail is invalid"; break; case -1: $error[$num_errors++] = "The e-mail length is more than 70 characters"; break; case 1: $person = List_People('', '', $email, '', '', $bd); if ($person) { if ($person[0][0] != $account_id) { $error[$num_errors++] = "This E-mail is already in use"; } } break; }
$ip_address = $_SERVER['REMOTE_ADDR']; $sess_id = Create_Session($_REQUEST['id'], 'default', $ip_address, 0, $bd); $crypt_sess_id = md5($sess_id); $complete_sess_id = $crypt_sess_id . $sess_id; if ($is_admin) { header("location: adm_main.php?sess_id={$complete_sess_id}"); exit; } else { header("location: main.php?sess_id={$complete_sess_id}"); exit; } } } // If the user asked to be mailed his password if (isset($_REQUEST['send']) && $_REQUEST['send'] == "Sogin") { $email = User_Validate_Email($_REQUEST['email']); $email_sql = $bd->GetTextFieldValue($email); $query = "SELECT accounts.account_id, accounts.name, people.email, people.password\n\t\tFROM accounts, people WHERE people.email={$email_sql} and (accounts.account_id = people.account_id)"; $result = $bd->Query($query); if ($result != 0 && $bd->NumberOfRows($result) != 0) { $user = $bd->FetchResult($result, 0, 'account_id'); $curr_passwd = $bd->FetchResult($result, 0, 'password'); $conf = 0; $limit = strlen($curr_passwd); for ($i = 0; $i < $limit; $i++) { $conf += ord($curr_passwd[$i]); } $addr = $cfg['url'] . "passwd_recovery.php?user="******"&conf=" . $conf; $mail_admin = $cfg['admin_email']; $institution = $cfg['institution_acronym']; $mail_content = "There is a solicitation of password recovering on your account at No Risk Planning. \nIf you really asked for it, click on the following link {$addr} to get your login and password. \n\n";