<?php
/**
 * @version        Somao_Search X1.0 9:23 2012-1-1 Somao $
 * @package        Somao_Search.Site
 * @copyright      Copyright (c) 2009 - 2012, Somao, Inc.
 * @license        http://www.somao123.com/
 * @link           http://www.somao.cc/
 */
require("global.php");
$user_name=HtmlReplace($_POST["user_name"]);
?>
<!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=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title><?php echo $config["name"];?>推广平台--找回密码</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>
<script src="css/WebResource.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</script>
</head>
<body>
<div id="wrapper" class="area">
  <div id="head"><a href="./"><img src="css/logo2.png" alt="" width="164" height="54" border="0"></a></div>
  <div id="logArea">
    <div class="loginCard">
      <div class="passportc">
        <form name="form1" method="post" action="" onsubmit="javascript:return WebForm_OnSubmit();" id="form1">
        <div class="pptitle"></div>
          <div class="ppcontent">
            <ul class="card">
            <?php
		  if(empty($user_name))
		  {
		  ?>
          
              <li class="np">
                <label for="entered_login">用户名：</label>
                <input name="user_name" type="text" id="user_name" class="ppinput" />
              </li>
              <li style="color:#999999">
                <span id="RequiredFieldValidator1" style="color:Red;display:none;">不能为空！<br></span>
                用于登陆的账户名称</li>
                <li>
                <input type="submit" name="Button1" value="下一步" id="Button1" class="sign" />
                <input type="reset" value="重新填写" name="B12" Class="sign" />
              </li>
          <?php
		}
		else
		{
		   $user=$db->get_one("select * from ve123_member where user_name='".$user_name."'");
		   if(empty($user))
		   {
		       echo "<font class=\"error\">".$user_name."&nbsp;&nbsp;用户不存在.</font><br><br><a href=\"?\">返回第一步</a>";
		   }
		   else
		   {
		       $answer=HtmlReplace(trim($_POST["answer"]));
		       ?>
              <li class="np">
                <label for="password">问题：</label>
				<input type="text" name="user_name" value="<?php echo $user_name;?>"  readonly class="ppinput" >
              </li>
              
              <li class="np">
                <label for="password">答案：</label>
                <input name="answer" type="text" id="answer" class="ppinput" />
              </li>
                <li>
                <input type="submit" name="Button1" value="下一步" id="Button1" class="sign" />
                <input type="reset" value="重新填写" name="B12" Class="sign" />
              </li>
          <?php
			   if(!empty($answer))
			   {
			      $sql="select * from ve123_member where user_name='".$user_name."' and answer='$answer'";//echo $sql;
			      $row=$db->get_one($sql);
				  if(empty($row))
				  {
				      echo "<br><br><font class=\"error\">找回密码答案不正确!</font>";
				  }
				  else
				  {
				      ?>
                       <br>
					  <br>
					  3．回复正确<br>
					  3．请输入新的密码：<input type="text" name="password">
					  <input type="submit" name="Submit" value="确定">
					  <?php
					  $password=HtmlReplace(trim($_POST["password"]));
					  if(!empty($password))
					  {
					     $array=array('password'=>md5($password));
					     $db->update("ve123_member",$array,"user_name='".$user_name."'and answer='$answer'");
					     echo "<br>恭喜,修改成功!&nbsp;&nbsp;<a href=\"login.php\">点击登录</a>";
					  }
				  }
			   }
		   }
		
		}
		?>
                
              
            </ul>
            <div class="line"></div>
            <ul>
              <li>还没有注册推广帐号？</li>
              <li><a class="loginBtn1" href="reg.php">立即注册</a></li>
            </ul>
          </div>
        </form>
      </div>
    </div>
    <div class="regPro">
      <div class="fpic"><img src="css/655x330.jpg" width="655" height="330" alt="泽许系列软件" /></div>
      <div class="log"><strong>我们在努力建设：</strong><span>[2011-2014]</span>泽许搜索！</div>
    </div>
  </div>
</div>