$sql="select count(*) from table where userid=".$userid;
$rs=mysql_query($sql);
if($rs[0]>0)//有值
{
echo "<script language=\"javascript\">";
echo "alert(\"此用户已经被注册了\");";
echo "history.back();";//返回到刚才提交的页面,要求用户继续填写一个没有注册的echo "</script>";
}else
{
echo "<script language=\"javascript\">";
echo "location.href=\"\";";//到注册的页面,或者就是本页面进行注册
echo "</script>";
}

解决方案 »

  1.   

    <?php Session_Start();?>
    <?php require_once('../../Connections/easyjianp.php'); ?>
    <?php require_once('../../include/submail/mailsub.php'); ?>
    <?php
    $mmstr_Recordset1 = "1";
    $mmstr_Recordset1 =session_id(); 
    mysql_select_db($database_easyjianp, $easyjianp);
    $query_Recordset1 = sprintf("SELECT usercount, password, wenti, daan, email FROM ebuy_user where sessjudge='%s' ORDER BY id DESC", $mmstr_Recordset1);
    $Recordset1 = mysql_query($query_Recordset1, $easyjianp) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);
    $totalRows_Recordset1 = mysql_num_rows($Recordset1);
    ?>
    <?php
    $colname_recordjudge = "1";
    if (isset($HTTP_POST_VARS['usercount'])) {
      $colname_recordjudge = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['usercount'] : addslashes($HTTP_POST_VARS['usercount']);
    }
    $mmstr_recordjudge = "1";
    if (isset($HTTP_POST_VARS['email'])) {
      $mmstr_recordjudge = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['email'] : addslashes($HTTP_POST_VARS['email']);
    }
    mysql_select_db($database_easyjianp, $easyjianp);
    $query_recordjudge = sprintf("SELECT * FROM ebuy_user WHERE usercount = '%s' or email='%s'", $colname_recordjudge,$mmstr_recordjudge);
    $recordjudge = mysql_query($query_recordjudge, $easyjianp) or die(mysql_error());
    $row_recordjudge = mysql_fetch_assoc($recordjudge);
    $totalRows_recordjudge = mysql_num_rows($recordjudge);
      

  2.   

    mysql_select_db($database_easyjianp, $easyjianp);
    $query_method = "SELECT * FROM method ORDER BY orderby ASC";
    $method = mysql_query($query_method, $easyjianp) or die(mysql_error());
    $row_method = mysql_fetch_assoc($method);
    $totalRows_method = mysql_num_rows($method);
    if ($totalRows_recordjudge == 0)
    {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
    }$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
    if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
      $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
    }if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) 
    {  
      $insertSQL = sprintf("INSERT INTO ebuy_user (usercount, name, password, male, wenti, daan, city, address, postcode, tell1, tell2, zheng1, zheng2, birth, email, zhong, zhong1, zhong2, zhong3, zhong4, ifdo,method, udate,sessjudge) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,%s, %s,%s)",
                           GetSQLValueString($HTTP_POST_VARS['usercount'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['name'], "text"),
                           GetSQLValueString(md5($HTTP_POST_VARS['password']), "text"),
                           GetSQLValueString($HTTP_POST_VARS['male'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['wenti'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['daan'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['city'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['address'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['postcode'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['tell1'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['tell2'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zheng1'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zheng2'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['birth'].-$HTTP_POST_VARS['birth2'].-$HTTP_POST_VARS['birth3'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['email'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zhong'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zhong1'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zhong2'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zhong3'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['zhong4'], "text"),
                           GetSQLValueString($HTTP_POST_VARS['ifdo'], "text"),
       GetSQLValueString($HTTP_POST_VARS['method'], "text"),
                            GetSQLValueString($HTTP_POST_VARS['udate'], "date"),
       GetSQLValueString($HTTP_POST_VARS['sessjudge'], "text"));
      mysql_select_db($database_easyjianp, $easyjianp);
      $Result1 = mysql_query($insertSQL, $easyjianp) or die(mysql_error());  $insertGoTo = "zlwhok.php";
      
      mysql_select_db($database_easyjianp, $easyjianp);
    $query_rsjian511 = sprintf("select econtent from cemail where eid=%s",2);
    $rsjian511 = mysql_query($query_rsjian511, $easyjianp) or die(mysql_error());
    $row_rsjian511 = mysql_fetch_assoc($rsjian511);
    $totalRows_rsjian511 = mysql_num_rows($rsjian511);

    $sql="select count(*) from table where userid=".$userid;
    $rs=mysql_query($sql);
    if($rs[0]>0)//有值
    {
    echo "<script language=\"javascript\">";
    echo "alert(\"此用户已经被注册了\");";
    echo "history.back();";//返回到刚才提交的页面,要求用户继续填写一个没有注册的echo "</script>";
    }else
    {
    echo "<script language=\"javascript\">";
    echo "location.href=\"\";";//到注册的页面,或者就是本页面进行注册
    echo "</script>";
    }
      

  3.   

    <td><a href="password.php"><img src="../../images/hyzx/hy2.jpg" width="177" height="42" border="0"></a></td>
                      </tr>
                      <tr> 
                        <td><a href="ordertickts.php"><img src="../../images/hyzx/hy3.jpg" width="177" height="42" border="0"></a></td>
                      </tr>
                      <tr> 
                        <td><a href="integral.php"><img src="../../images/hyzx/hy4.jpg" width="177" height="42" border="0"></a></td>
                      </tr>
                      <tr> 
                        <td><a href="cancel.php"><img src="../../images/hyzx/hy5.jpg" width="177" height="42" border="0"></a></td>
                      </tr>
                      <tr> 
                        <td><a href="#"><img src="../../images/hyzx/hy6.jpg" width="177" height="42" border="0"></a></td>
                      </tr>
                      <tr> 
                        <td height="2"><img src="../../images/hyzx/h005.gif" width="177" height="3"></td>
                      </tr>
                      <tr>
                        <td><table width="175" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="ACABAC">
                            <tr>
                              <td><div align="center">
                                  <table width="173" height="255" border="0" cellpadding="0" cellspacing="1" bgcolor="D9D9D9">
                                    <tr>
                                      <td height="262">&nbsp;</td>
                                    </tr>
                                  </table>
                                </div></td>
                            </tr>
                          </table></td>
                      </tr>
                      <tr> 
                        <td height="2"><img src="../../images/hyzx/h005.gif" width="177" height="3"></td>
                      </tr>
                    </table></td>
                  <td width="601" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td><img src="../../images/khfw/k032.gif" width="601" height="88"></td>
                      </tr>
                      <tr> 
                        <td><img src="../../images/hyzx/h006.gif" width="601" height="3"></td>
                      </tr>
                      <tr> 
                        <td valign="top">
    <div align="center">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr> 
                                <td><img src="../../images/hyzx/h012.gif" width="601" height="11"></td>
                              </tr>
                              <tr>
                                <td valign="top" background="../../images/hyzx/h015.gif">
    <div align="center"> 
                                    <table width="94%" border="0" cellspacing="0" cellpadding="0">
                                      <form name="form1" method="POST" action="<?php echo $editFormAction; ?>" onSubmit="return checkinput();">
                                        <tr> 
                                          <td height="0" valign="top" bgcolor="#CCCCCC"><table width="100%" height="413" border="0" cellpadding="0" cellspacing="1">
                                              <tr> 
                                                <td height="25" colspan="2" bgcolor="#EFEFEF"><div align="center">&Oacute;&Atilde;&raquo;§×&cent;&sup2;á&Ecirc;§°&Uuml;&pound;&not;&cedil;&Atilde;&Oacute;&Atilde;&raquo;§&Atilde;&ucirc;&raquo;ò&Otilde;&szlig;&Oacute;&Ecirc;&Iuml;&auml;&Ograve;&Ntilde;&frac34;&shy;±&raquo;×&cent;&sup2;á<FONT 
    color=#ff0000>&Ouml;&Oslash;&ETH;&Acirc;×&cent;&sup2;á.</FONT></div></td>
                                              </tr>
                                              <tr> 
                                        <td width="25%" height="25" bgcolor="#EFEFEF"><div align="right">&Oacute;&Atilde;&raquo;§&Atilde;&ucirc;&pound;&ordm;</div></td>
                                                <td width="75%" height="25" bgcolor="#FFFFFF">&iexcl;&iexcl; 
                                                  <input name="usercount" type="text"   value="<?php  $row_Recordset1['usercount']?>"
                                                  <input name="sessjudge" type="hidden" id="sessjudge" value="<?php echo session_id(); ?>"
                                                  <font color="#FF0000">* <font size="2"> 
                                                  &ETH;è&acute;ó&Oacute;&Uacute;4&cedil;&ouml;×&Ouml;·&ucirc;</font></font> </td>
                                              </tr>
                                              <tr> 
                                                <td height="25" bgcolor="#EFEFEF"><div align="right">&Otilde;&aelig;&Ecirc;&micro;&ETH;&Otilde;&Atilde;&ucirc;&pound;&ordm;</div></td>
                                                <td height="25" bgcolor="#FFFFFF">&iexcl;&iexcl; 
                                                  <input name="name" type="text" value="<?php echo $row_Recordset1['usercount']?>" 
                                                  <input name="male" type="radio" value="&Iuml;&Egrave;&Eacute;ú" checked>
                                                  &Iuml;&Egrave;&Eacute;ú 
                                                  <input type="radio" name="male" value="&ETH;&iexcl;&frac12;&atilde;">
                                                  &ETH;&iexcl;&frac12;&atilde;<font color="#FF0000">*</font></td>
                                              </tr>
                                              <tr>