echo "<div class='notice signup'>Passwords do not match. </div>"; include "sign_up.php"; exit; } else { if ($state_id == "empty") { echo "<div class='notice signup'>Some info is missing. </div>"; include "sign_up.php"; exit; } else { $password = hash('SHA512', $password); $sql_add = "INSERT INTO users (username, password, profile_img, city, email, bio, country, state_id, date_registered)\n VALUES ('{$username}', '{$password}', '{$image}' , '{$city}', '{$email}', '{$bio}', '{$country}', {$state_id}, '{$formattedDate}');"; $results_add = $mysqli->query($sql_add); if (!$results_add) { exit($mysqli->error); } generateEmail($email, $username, $notHashed); // sends confirmation email after signup } } } function generateEmail($to, $username, $password) { $to = $to; $subject = "Registration confirmation."; $msg = "Hey, " . $username . "! \r\n We are happy to inform you that you've been successfully added to our system!\n \r\nYour password is " . $password . ". Feel free to contact us and ask questions! \n\n Best Regards, \n ShareToLive Administration"; $header = "From:administrator@sharetolive.com"; if (mail($to, $subject, $msg, $header)) { // successfully sent } else { echo "Error: Email not sent"; }
exit; } else { if ($password != $passwordTwo) { echo "<div class='notice signup'>The passwords do not match. </div>"; include "password_edit.php"; //post_edit.php?post_id=12 exit; } else { $password = hash('SHA512', $password); $sql = "UPDATE users\n SET password = '******'\n WHERE users.user_id = {$user_id}"; $results = $mysqli->query($sql); $rowForEmail = $results->fetch_array(MYSQLI_ASSOC); if (!$results) { exit($mysqli->error . " Could not change the password. "); } generateEmail($rowForEmail['email'], $rowForEmail['username'], $notHashed); $username = $_SESSION['username']; $user_id = $_SESSION['user_id']; session_destroy(); } } function generateEmail($to, $username, $password) { $to = $to; $subject = "Registration confirmation."; $msg = "Hey, " . $username . "! \r\n Your new password is " . $password . "\n \r\nYour password is " . $password . ". Feel free to contact us and ask questions! \n\n Best Regards, \n ShareToLive Administration"; $header = "From:administrator@sharetolive.com"; if (mail($to, $subject, $msg, $header)) { // successfully sent } else { echo "Error: Email not sent";
} $queryJob = $db->Query("SELECT jobid, position, location, contact_email FROM job WHERE onlineuser_onlineuserid='" . $user->onlineuserId . "' AND dt_expire>'" . date("Y-m-d") . "'"); if ($db->Rows() <= 0) { // you will only reach here if the current user does not have a live job exit; } $jobCount = $db->Rows(); if ($jobCount == 1) { $jobId = mysql_fetch_row($queryJob); $jobId = $jobId[0]; } else { $jobId = ""; } $job_contact_email = mysql_fetch_row($queryJob); $job_contact_email = $job_contact_email[3]; $emailMessage = generateEmail("*****", "*****", "<span id=\"jobId\">{$jobId}</span>", "<span id=\"job_contact_email\">{$job_contact_email}</span>"); mysql_data_seek($queryJob, 0); $options = ""; $js = ""; for ($i = 0; $i < $jobCount; $i++) { $data = mysql_fetch_row($queryJob); $options .= "<option value=\"" . $data[0] . "\">"; $options .= $data[1] . " - " . $data[2]; $options .= "</option>"; $js .= "jobData['" . $data[0] . "']=\"" . $data[3] . "\";\n"; } require "top.php"; ?> <script language="JavaScript"> var jobData=new Array();