Warning: sprintf() [function.sprintf]: Too few arguments in C:\AppServ\www\Members\reg.php on line 61
Query was empty
<?php require_once('Connections/members_conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
  $MM_dupKeyRedirect="index.php";
  $loginUsername = $_POST['Username'];
  $LoginRS__query = sprintf("SELECT Username FROM members WHERE Username=%s", GetSQLValueString($loginUsername, "text"));
  mysql_select_db($database_members_conn, $members_conn);
  $LoginRS=mysql_query($LoginRS__query, $members_conn) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);  //if there is a row in the database, the username was found - can not add the requested username
  if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO members (Username,Password,Email,Authcode) VALUES (%s, %s,%s,%s)",  第61行
                       GetSQLValueString($_POST['Username'], "text"),
                       GetSQLValueString(md5($_POST['Password']), "text"));
   GetSQLValueString($_POST['Email'],"text");
   GetSQLValueString($_POST['Authcode'],"text");
   mysql_select_db($database_members_conn, $members_conn);
  $Result1 = mysql_query($insertSQL, $members_conn) or die(mysql_error());
  
  $Url="http://localhost/Members/auth.php?Username=" . $_POST['Username']
            . "$Authcode=" . $_POST['Authcode'];

$Body=$_POST['Username'] . "您好!<br>"
     ."欢迎在 My  注册<br>"
."若您没有注册请忽略这封确认信件<br>"
."<a href=" . $Url . ">"
."点击这里激活你的帐号</a>";

  $From= "From:" . "=?UTF-8?B?".base64_encode("zhanghui")."?="."
  <[email protected]> \n\r";
  $Type= "Content-Type: text/html; charset=UTF-8\n\r"
     ."Content-Transfer-Encoding: 8bit\n\b";
  $Header=$From.$Type;
  $Subject="=?UTF-8?B?".base64_encode("zhanghui-[My ]注册通知")."?=";
  
  mail($_POST[ 'Email'], $Subject, $Body, $Header);
  
  $insertGoTo= "index.php";  
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?><?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}if (isset($_POST['Username'])) {
  $loginUsername=$_POST['Username'];
  $password=md5($_POST['Password']);
  $MM_fldUserAuthorization = "State";
  $MM_redirectLoginSuccess = "main.php";
  $MM_redirectLoginFailed = "index.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_members_conn, $members_conn);
  
  $LoginRS__query=sprintf("SELECT Username, Password, State FROM members WHERE Username=%s AND Password=%s",
  GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $members_conn) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    
    $loginStrGroup  = mysql_result($LoginRS,0,'State');
    
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;           if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?><!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>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head><body>
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
  <p align="center"><font size="+3">会员系统 </font></p>
  <div align="center">
    <table width="401" border="1" cellpadding="5">
      <tr>
        <th colspan="2" scope="col">用户注册</th>
      </tr>
      <tr>
        <td width="115" height="47"><div align="right">用户名:</div></td>
        <td width="254">          <label></label>
          <label> </label>
          <span id="sprytextfield1">
          <label>
          <input name="Username" type="text" id="Username" />
          </label>
          <span class="textfieldRequiredMsg">需要提供一个值。</span> <br />
          请输入5-15位的用户名</span></td>
      </tr>
      <tr>
        <td height="48"> <div align="right">密码:</div></td>
        <td><span id="sprytextfield2">
        <input name="Password" type="text" id="Password" />
        <span class="textfieldRequiredMsg">需要提供一个值。</span><span class="textfieldMinCharsMsg"><br />
        请输入6-16位的密码</span><span class="textfieldMaxCharsMsg"></span></span></td>
      </tr>
      <tr>
        <td height="38"><div align="right">邮箱:</div></td>
        <td><span id="sprytextfield3">
          <input name="Email" type="text" id="Email" value="" />
          <br />
          必须输入邮箱
        </span></td>
      </tr>
      <tr>
        <td colspan="2"><div align="right">
          <a href="index.php">
          <input name="Authcode" type="hidden" id="Authcode" value="<?php echo $authcode=substr(md5(uniqid(rand())),0,8);?>" />
          登陆
          <label>
          <input name="button" type="submit" id="button" value="注册" />
          </label>
          </a>
          <label></label>
          <label></label>
        </div></td>
      </tr>
      </table>
  </div>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <input type="hidden" name="MM_insert" value="form1" />
</form><label></label>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["change"], minChars:5, maxChars:15});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:6, maxChars:15, validateOn:["change"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email", {validateOn:["change"]});
//-->
</script>
</body>
</html>