<?php 
include '../comm/conn.php';
include '../comm/checkpostandget.php';
include 'check.php';
include '../comm/config.php';

$link = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$link) {
	die('数据库链接出错: ' . mysql_error());
}
else
{
	$sql="select * from user where ddusername='".$username."'";
	mysql_select_db($dbname);
	$rs = mysql_query($sql);
	while ($row = mysql_fetch_array($rs)){
		$yjs=$row[yjs];
		$zfb=$row[zfb];
		$txstate=$row[txstate];
	}	
	$sql1="select * from websetting where id=1";
	mysql_select_db($dbname);
	$rs1 = mysql_query($sql1);
	while ($row1 = mysql_fetch_array($rs1)){
		$txyf=$row1[txyf];
	}	
	$txyf1=intval($txyf);
	$yjs1=intval($yjs);
	if($txstate==1)
	{
		header('Location: ../comm/error.php?err=8');
		exit;
	}
	if($txyf1-$yjs1>0)
	{
		header('Location: ../comm/error.php?err=5');
		exit;
	}
}
?><!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" />
<title>申请提现 - <?php echo $usercenter;?> - <?php echo $webtitle;?></title>
<link href="../images/style1.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE4 {color: #FF3300}
-->
</style>
<script language="javascript" type="text/javascript">
function checktxje()
{
		var str1 = document.getElementById("txje").value; 
		var str2 = document.getElementById("ktx").value;    
        if(str1.length!=0)
		{     
			if(str1>str2)
			{    
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>金额不能大于可提现金额</font>';
				return false;
			}
			else
			{
				document.getElementById("cktxje").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>提现金额正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("cktxje").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写提现金额</font>';
				return false;
		}
} 
function checkzfb1()
{
		var str = document.getElementById("zfb1").value;    
        if(str.length!=0)
		{    
			reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;    
			if(!reg.test(str))
			{    
				document.getElementById("ckzfb1").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>支付宝格式填写错误，请检查</font>';
				return false;
			}
			else
			{
				document.getElementById("ckzfb1").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝格式正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("ckzfb1").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
				return false;
		}
} 
function checkzfb2()
{
		var str1 = document.getElementById("zfb1").value;
		var str2 = document.getElementById("zfb2").value;    
        if(str2.length!=0)
		{    
			if(str1!=str2)
			{    
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>两次支付宝填写不一样，请检查</font>';
				return false;
			}
			else
			{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/dui.gif alt="正确" align=absmiddle /> <font color=#009900>支付宝确认正确</font>';
				return true;
			}
		}
		else
		{
				document.getElementById("ckzfb2").innerHTML = '<img src=../images/cuo.gif alt="错误" align=absmiddle /> <font color=#ff0000>请填写支付宝</font>';
				return false;
		}
} 
function checkall()
{
	if(!checktxje()||!checkzfb1()||!checkzfb2())
	{
		return false;
	}
	else
	{
		return true;
	}
}
</script>
</head>

<body topmargin="0" leftmargin="0">
<?php
include("../comm/header.php");
?>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="2">
          <table cellspacing="0" width="100%" height="248" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 申请提现</strong></td>
            </tr>
            <tr>
              <td width="100%" height="216" colspan="2"><form id="form1" name="form1" action="savetixian.php" method="post" onsubmit="return checkall()">
                <table width="538" border="0" align="center" cellpadding="5" cellspacing="0" style="border:1px  solid #b6e0f8;">
                  <tr>
                    <td width="526" height="54" bgcolor="f2faff">注意：您提交的提现金额将<span class="STYLE4">在24小时内</span>自动支付到您提供的支付宝内，请登录支付宝查收！</td>
                  </tr>
                </table>
                <table width="695" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="226" height="30" align="right"  class="bigtext">可提现金额：</td>
                  <td colspan="2"  class="bigtext">&nbsp;&nbsp;<span class="large-green"><?php echo $yjs?></span>&nbsp;&nbsp;元 
                    <input type="hidden" name="ktx" value="<?php echo $yjs?>" />
</td>
                </tr>
                <tr>
                  <td height="30" align="right"  class="bigtext">申请提现：</td>
                  <td height="30">&nbsp;&nbsp;<input name="txje" type="text" size="15" maxlength="10" class="btn3" value="<?php echo $yjs?>" onblur="checktxje();"/>
                    &nbsp;&nbsp;<span class="bigtext">元</span></td>
                  <td height="30" class="bigtext" id="cktxje">请填写，金额小于 <span class="large-green"><?php echo $yjs?></span> 元</td>
                </tr>
                <tr>
                  <td height="30" align="right"  class="bigtext">支付宝账号：</td>
                  <td width="202" height="30">&nbsp;&nbsp;<input type="text" name="zfb1" class="btn3" onblur="checkzfb1();" value="<?php echo $zfb?>" /></td>
                  <td width="267" class="bigtext" id="ckzfb1">请正确填写支付宝账号<?php
echo $txyf;
?></td>
                </tr>
                <tr>
                  <td height="30" align="right"  class="bigtext">确认支付宝账号：</td>
                  <td height="30">&nbsp;&nbsp;<input type="text" name="zfb2" class="btn3"onblur="checkzfb2();" /></td>
                  <td height="30" class="bigtext" id="ckzfb2">请再次确认支付宝账号</td>
                </tr>
                <tr>
                  <td height="30" align="right">&nbsp;</td>
                  <td height="30" colspan="2">&nbsp;&nbsp;<input type="submit" name="Submit" value=" 申请提现 " class="btn2" /></td>
                </tr>
              </table>
              </form></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
<?php
include("../comm/footer.php");
?>
</body>
</html>
<?php mysql_close($link);?>