<?php
include("postget.php");
include_once("common.php");
//checklevel(1,$_REQUEST['clientid']);
if($_POST["email"]<>"") {
	$email=$_POST['email'];
	$query="SELECT email,password,clientid,preflang FROM hd_clients WHERE email='$email'";
	$q=mysql_query($query,$db_link);
	$row=mysql_fetch_array($q);

	if ($row[email]==$email) {
		$subject=_INFORMATION_OF_ACCESS;

//		$body=$texts[9][1];
		$body=texto('DATA_ACCESS_TO_THE_ACCOUNT',$row['preflang']);

		$body=stripslashes($body);

		$body=str_replace('%URL%','<a href="'.$config[1][1].'">'.$config[1][1].'</a>',$body);
		$body=str_replace('%USER%',$row[clientid],$body);
		$body=str_replace('%PASS%',decrypt($row[password]),$body);


		if (!preg_match("/<table/i",$body)) {
			$body=nl2br($body);
		}

//		if(mail($row[email],$subject,$body,$headers."From:$mfrom\nReply-To:$mreplyto")) {
		if(mail2client($subject,$body,'admin',$row[email],1)) {
			messagetop(_EMAIL." "._SENTmale,"","login.php",1);
		}else{
			messagetop(_ERROR,"Failed to connect to mailserver","login.php",0);
		}

	}else{
		messagetop(_ERROR,_EMAIL." "._NOT_FOUND,"login.php",0);
	}
}else{
	messagetop(_ERROR,_EMAIL." "._NOT_FOUND,"login.php",0);
}
?>