include($_SERVER['DOCUMENT_ROOT'].'/booking/common_pages/book_top.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/Connections/conn.php');
//require_once($_SERVER['DOCUMENT_ROOT'].'/mailer/mail_test.php');
function randomString($randStringLength)
{
$timestring = microtime();
$secondsSinceEpoch=(integer) substr($timestring, strrpos($timestring, " "), 100);
$microseconds=(double) $timestring;
$seed = mt_rand(0,1000000000) + 10000000 * $microseconds + $secondsSinceEpoch;
mt_srand($seed);
$randstring = "";
for($i=0; $i < $randStringLength; $i++)
{
$randstring .= chr(ord('A') + mt_rand(0, 25));
$randstring .= chr(ord('0') + mt_rand(0, 9));
$randstring .= chr(ord('a') + mt_rand(0, 25));
}
return($randstring);
}
//print_r ($_POST);
$error=0;
if (trim($_POST[username]))
{
mysql_select_db($database_conn, $conn);
$query_user = "SELECT userid, u_name, u_surname, email FROM users WHERE username='".trim($_POST[username])."'";
$user = mysql_query($query_user, $conn) or die(mysql_error());
$row_user = mysql_fetch_assoc($user);
$totalRows_user = mysql_num_rows($user);
if ( $totalRows_user == 1)
{
$password = randomString(3);
//print_r ($row_user);
$htmlbody = "
Hello ".$row_user[u_name]." ".$row_user[u_surname].",
Your new password is :
".$password."
You can always change your password via
My Details link after you succesfully login.
Please click on the link below to confirm your retrival of new password.
http://www.eggyachting.com/booking/confirmation.php?id=".$row_user[userid]."
E.G.G. Yachting Online Booking System Copyright©2000-2006 |
";
//$subject = "E.G.G. Yachting Online Booking System : Your New Password";
//include($_SERVER['DOCUMENT_ROOT'].'/booking/mail_content/crew_list.php');
//$to[0][email]=$row_user[email]; $to[0][name]=$row_user[u_name]." ".$row_user[u_surname];
//$message_error = "Warning : An error occured while mailing crew list to Sales Office, evethough it is saved to system. Please contact with operation@eggyachting.com and inform about this error message.
";
//$message_success = "Confirmation : Crew List is updated and sent to Sales Office. Please don't forget to update if it becomes necessary in the future to prevent any incenvenience.
";
//$to=$row_user[u_name]." ".$row_user[u_surname]." <".$row_user[email].">";
//$headers = 'MIME-Version: 1.0' . "\r\n";
//$headers .= 'Content-type: text/html; charset=iso-8859-9' . "\r\n";
//$headers .= 'From:EGG Yachting Booking System ' . "\r\n";
//$headers .= 'Bcc: goker@eggyachting.com, salesadmin@eggyachting.com, account@eggyachting.com, eggyachting@eggyachting.com, operation@eggyachting.com' . "\r\n";
//$ernur = mail($to, $subject, $htmlbody, $headers);
//if ($ernur) { echo $message_success;} else {echo $message_error;}
include($_SERVER['DOCUMENT_ROOT'].'/PHPMailer-master/gmailsendegg.php');
//Set who the message is to be sent to
$mail->addAddress(($row_user[u_name]." ".$row_user[u_surname]), $row_user[email]);
$mail->addBCC('goker@eggyachting.com', 'Goker Tuncay');
$mail->addBCC('salesadmin@eggyachting.com', 'Sales Admin');
$mail->addBCC('account@eggyachting.com', 'Account');
$mail->addBCC('operation@eggyachting.com', 'Operation');
$mail->addBCC('eggyachting@eggyachting.com', 'EGG Yachting');
//$mail->addAddress('ernur.kaya@gmail.com', 'Ernur Kaya');
//$mail->addBCC('ek@sherpa.com.tr', 'Sherpa');
//Set the subject line
$mail->Subject = "E.G.G. Yachting Online Booking System : Your New Password";
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->Body = $htmlbody;
//Replace the plain text body with one created manually
//$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) { echo $message_error . $mail->ErrorInfo;
} else {echo $message_success;}
if ($sent=1)
{
$update = "UPDATE users SET confirm='n' WHERE userid = '".$row_user[userid]."'";
mysql_query($update);
//echo $update;
if (mysql_error()) { echo mysql_error();}
echo "Your new password has been sent to "
.$row_user[email]."
If this email is not correct please contact with your sales office
";
}
}
else
{
echo "Error : Invalid or wrong username. The username is not found in DB."; $error=1;
}
}
if ( !trim($_POST[username]) or $error==1)
{
?>
}
include($_SERVER['DOCUMENT_ROOT'].'/booking/common_pages/book_buttom.php'); ?>