<?php
require 'include/announcements.php'; // ITECHBIDS Configuration File
require 'include/itechbids.php'; // Server compatibility Patch
require 'include/argvs.php'; // Server compatibility Patch
	if ($_POST['canSend']==1)
{
$passwordhelp=$_POST['txtEmail'];
$day=$_POST[cboday];
$month=$_POST[cbomonth];
$year=$_POST[txtYear];

$dob=$year."-".$month."-".$day;
	$sql="select * from member_details where user_name='$passwordhelp' and date_of_birth='$dob'";
	$result=mysql_query($sql);
	
	    $admin="select * from genaralsettings where set_id=3"; //sitename -> id=1
	    $admin_res=mysql_query($admin);
	    $admin_rec=mysql_fetch_array($admin_res);
	    $mailfrom=$admin_rec[set_value];

 function createRandomPassword() {
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
   srand((double)microtime()*1000000);
    $i = 0;
    $npass = '' ;
    while ($i <= 7) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $npass = $npass . $tmp;
        $i++;
    }
    return $npass;
}

// Usage

$password = createRandomPassword();
$passwordm=seccheck($password);

	
	if (mysql_num_rows($result) > 0)
	{
$sq="update member_details set password='$passwordm' where user_name='$passwordhelp'";
$result2=mysql_query($sq);

	$row = mysql_fetch_array($result);
	$username = $row["user_name"];
	$mailto =$row[email] ;
	$admin="select * from genaralsettings where set_id=3";
	$admin_res=mysql_query($admin);
	$admin_row=mysql_fetch_array($admin_res);
	$mailfrom=$admin_row[set_value];
	$mailsubject = "Your Login Info";
	$mailbody = "Dear User Here is your Login Info<br>";
	$mailbody .= "User Name: ".$username;
	$mailbody .= "<br>Password : ".$password;
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .= "From: ". $mailfrom."\r\n";
	mail($mailto,$mailsubject,$mailbody,$headers);	
	$status = 1; // send successfully
	$sent_message = "Your Login info has been sent to your Email Id";
	}
else
{
$status = 2; // send failure;
}
}
require 'themes/forgot.tpl';
?>
