<?
$adminemail=strtolower(trim($_POST['adminemail']));
$ls=trim($_POST['ls']);
$admin=$_POST['admin'];

if($ls=="forget")
{
  		require_once('inc/conn.php');
		$opendb=new mydb();
		$sqlstr="select * from ls_config where  email='".$adminemail."'";
		$query1=$opendb->query($sqlstr);
		$rows=mysql_fetch_assoc($query1);
		$myrows=mysql_num_rows($query1); 
		
		$sqlstradmin="select * from ls_admin where adminName='".$admin."'";
		$queryadmin=$opendb->query($sqlstradmin);
		$rowsadmin=mysql_fetch_assoc($queryadmin);
		$adminnum=mysql_num_rows($queryadmin);
		
		if($adminnum==0)
		{
			echo "
					<script>
						alert(' 对不起，用户名错误，无法找回密码！');
						location='index.php';	
					</script>
					";
		}


		if($myrows==0)
		{
			echo "
					<script>
						alert(' 对不起，Email地址错误，无法找回密码！');
						location='index.php';	
					</script>
					";
		}
	else
	{
	$username=$rowsadmin['adminName'];
	$userpwd=$rowsadmin['adminPwd'];
	$website=$rowsconfig['website'];
	$companyname=$rowsconfig['companyName'];
	$manager=$rowsconfig['manager'];
	

	$subject=$website."网站后台管理员用户名，密码";
	$content=$subject." :\n用户名: ".$username."\n"."密码： ".$userpwd."\n\n \请保存好您的密码。";
	
	$Receiptor=$adminemail;
	$Name=$userrealname;
	$Subject=$subject;
	$Content=$content;
	//echo $content;
	if(mail($Receiptor,$Subject,$Content))
	{
		echo "
		<script>
			alert('密码已经发送到您的网站邮箱，请注意查收，谢谢使用蓝帆外贸网站引擎。');
			location='index.php';	
		</script>
		";

	}
	
	}
	
 } 

 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>找回密码</title>
</head>

<body>
</body>
</html>
