<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("conn.php");

$id=intval($_GET["id"]);
$userid=intval($_GET["userid"]);
$photo_name=ftbbs_request(trim($_GET["photo_name"]));

if ($_POST["pwd1"]!=""){
   $id=intval($_POST["id"]);
   $userid=intval($_POST["userid"]);
   $photo_name=ftbbs_request(trim($_POST["photo_name"]));
   $pwd=ftbbs_request(trim($_POST["pwd1"]));
   $sql="select * from {$tablepre}ftblog_type where sign=2 and userid=".$userid." and blogtype='".$photo_name."' and alumpwd='".$pwd."'";
   $rs=mysql_query($sql);
   $row = mysql_fetch_array($rs);
   $numrows = mysql_num_rows($rs);
   if ($numrows!=0){
   $_SESSION["passok"]=$_POST["pwd1"];
   $_SESSION["userid"]=$userid;
   header("Location:disphoto.php?id=".$id."&userid=".$userid."&photo_name=".$photo_name."&sign=2");
   }
   else{
   echo "<center><br><br><br><br><br>你的密码不正确,请重新输入</center>";
   exit;
   }
}
?>
<HTML>
<HEAD>
<TITLE>相册密码确认</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8>">
<link rel="stylesheet" type="text/css" href="css/ftbbs01.css">
<script language="JavaScript">
function OK(){
  var str1="";
  var strurl=document.form1.pwd1.value;
  if (strurl=="")
  {
  	alert("请输入密码！");
	document.form1.pwd1.focus();
	return false;
  }
  else
  { 
    document.form1.submit()
    window.close();
  }
}
</script>
</head>
<BODY bgColor=menu topmargin=15 leftmargin=15 >
<form name="form1" method="post" action="">
<table width=100% border="0" align="center" cellpadding="0" cellspacing="2">
  <tr><td>
<FIELDSET align=left>
        <LEGEND align=left>密码确认</LEGEND>
        <table width="100%" border="0" align=center cellpadding="0" cellspacing="3">
          <tr> 
            <td colspan="2">密    &nbsp;&nbsp;&nbsp;码： 
              <input name="pwd1" type="password" id="pwd1" value='' size=10 maxlength="10">
              <input name="id" type="hidden" id="id" value="<?=$id?>">
              <input name="userid" type="hidden" id="userid" value="<?=$userid?>"> 
              <input name="photo_name" type="hidden" id="photo_name" value="<?=$photo_name?>"> 
            </td>
          </tr>
        </table>
</fieldset>
</td>
      <td width=80 align="center" valign="middle"> 
        <input name="cmdOK" type="button" id="cmdOK" value="  确定  " onClick="OK();">
      </td>
    </tr>
</table>
</form>
</body>
</html>