<div class="postui post-title">	
	<h2>AI UITAT PAROLA?</h2>
</div>
<div class="postui post-con">
	<div class="con-wrap">	
	
<?php

function GeneratePassword() {
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double)microtime()*1000000);
    $i = 0;
    $pass = '' ;

    while ($i <= 7) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;

    }

    return $pass;

}
	$cont = replace($_GET['cont']);
	$rec = replace($_GET['cod']);
	if(isset($_GET) && $_GET['cont']!=NULL & strlen($rec) == 32)
	{
		$ch1 = mysql_query("Select * from account.account where login='$cont' AND passlost_token='$rec'") or die(mysql_error());
		if(mysql_num_rows($ch1) == 1)
		{
			$acr = mysql_fetch_object($ch1);
			$email =$acr->email;
			$new_pass = GeneratePassword();
			mysql_query("Update account.account set password=PASSWORD('$new_pass') where login='$cont'") or die(mysql_error());
			mysql_query("Update account.account set passlost_token='1' where login='$cont'") or die(mysql_error());
			$to      = $email;
			$subject = 'Noua ta parola!';
			$message = "Salut ".$cont. "\r\n" ."
			Noua ta parola este: ".$new_pass."\r\n" ."";
			new mail($to, $subject, $message);
			echo succes("Un email cu noua ta parola a fost trimis la adresa $email.");
		}
		
	}
?>
<?php recuperare_pw()?>

<form action="" method="POST" >

<table width="54%" border="0">
  <tr>
    <td width="73%"><label for="username"><b><a>Nume de utilizator: *</a></b></label></td>
    <td width="27%"><input type="text" id="username" name="username"  value="" maxlength="16" class="fui txt"/></td>
  </tr>
  <tr>
    <td><label for="email"><b><a>Email: *</a></b></label></td>
    <td><input type="text" id="email" name="email" value="" maxlength="64"  class="fui txt"/></td>
  </tr>
  <tr>
    <td><label for="asd"><b><a>Cuvant de siguranta: *</a></b></label></td>
    <td><img src="inc/spam.php" alt="SPAM"/>
    <input type="text" id="norobot" name="norobot" maxlength="4"  value=""  class="fui txt"/></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input id="submitBtn" type="submit" name="recuperare" value="TRIMITE" class="fui btn log"/></td>
  </tr>
</table>
</form>


</div>                
</div>
<div class='postui post-end'></div>	