问题如下:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a2138233/public_html/etc/e.conf/sys.proc/proc.reg/use.register.php on line 113
下面是 use.register.php的第113行:
$sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ");
$email_check = mysql_num_rows($sql_email_check);
这是“$ rmail”的变量集:
$rmail = mysql_real_escape_string(strip_tags($_POST['rmail']));
以下是HTML行:
<input type="text" class="umail" id="ftxti" name="rmail" placeholder='email@server.com' style="width: 530px;" >
完整代码:
<?php
$mysql_host = "";
$mysql_database = "";
$mysql_user = "";
$mysql_password = "";
$link = mysql_connect($mysql_host, $mysql_user, $mysql_password, $mysql_database);
mysql_select_db("tmpu");
?>
<?php
if(isset($_POST['register'])){
//set form variables
$rmail = mysql_real_escape_string(strip_tags($_POST['rmail']));
$fname = mysql_real_escape_string(strip_tags($_POST['fname']));
$lname = mysql_real_escape_string(strip_tags($_POST['lname']));
$rname = mysql_real_escape_string(strip_tags($_POST['rname']));
$rpass = mysql_real_escape_string(strip_tags($_POST['rpass']));
$vpass = mysql_real_escape_string(strip_tags($_POST['vpass']));
if(isset($_POST['gender'])){
$rgen = mysql_real_escape_string(strip_tags($_POST['gender']));
}
if(isset($_POST['dobm'])){
$dobm = mysql_real_escape_string(strip_tags($_POST['dobm']));
}
if(isset($_POST['$dobd'])){
$dobd = mysql_real_escape_string(strip_tags($_POST['dobd']));
}
if(isset($_POST['doby'])){
$doby = mysql_real_escape_string(strip_tags($_POST['doby']));
}
if(isset($_POST['TOS'])){
$TOS = mysql_real_escape_string(strip_tags($_POST['TOS']));
}
$dab = $doby.$dobm.$dobd;
//check empty feilds
$error = FALSE;
if(empty($rmail)){
$error = TRUE;
$eh = "<div class=em> Please enter an <b>Email Adress</b> to reach you from.
This email will be used to Verify your acctount and activate it. </div>";
}
if(!empty($rmail)){
if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $rmail)){
$error = TRUE;
$eh1 = "<div class=em> This is not a valid email... </div>";
}}
if(empty($fname) && empty($lname)){
$error = TRUE;
$eh2 = "<div class=em> Please enter your <b> First </b> and <b> Last </b> name. </div>";
}
if(!empty($fname)){
if(empty($lname)){
$error = TRUE;
$eh3 = "<div class=em> Please enter a <b> Last </b> name. </div>";
}
}
if(!empty($lname)){
if(empty($fname)){
$error = TRUE;
$eh4 = "<div class=em> Please enter a <b> First </b> name. </div>";
}
}
if(empty($rname)){
$error = TRUE;
$eh5 = "<div class=em> Please enter a <b>Username</b>. This will be used as your ewotty display name, You can Change it at anytime. </div>";
}
if(empty($rpass)){
$error = TRUE;
$eh6 = "<div class=em> Please enter a <b>Password</b>. This will be used to login to your account, Do not give it to anyone!</div>";
}
if($vpass != $rpass){
$error = TRUE;
$eh7 = "<div class=em> Your Password Verifications Did nont match, Please try again. This is to help you make sure you entered the right
password.</div>";
}
if(empty($dobm) && empty($dobd) && empty($doby)){
$error = TRUE;
$eh8 = "<div class=em> Please Your valid <b>Birthday</b>. </div>";
}
if(strlen($rname) >15){
$error = TRUE;
$eh9 = "<div class=em> Your username is too long. (Max 15 char)</div>";
}
$sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ");
$email_check = mysql_num_rows($sql_email_check);
var_dump($sql_email_check);
var_dump($rmail);
if ($email_check > 0){
$error = TRUE;
$eh10 = "<div class=em> The <b>email: $rmail </b> is already in use, Please register another.</div>";
}
$sql_tmpemail_check = mysql_query("SELECT uMail FROM tmpu WHERE uMail='$rmail'");
$tmpemail_check = mysql_num_rows($sql_tmpemail_check);
if ($tmpemail_check > 0){
$error = TRUE;
$eh11 = "<div class=em> The <b>email: $rmail </b> is already being registered.</div>";
}
$sql_user_check = mysql_query("SELECT uName FROM eusers WHERE uName='$rname'");
$user_check = mysql_num_rows($sql_user_check);
if ($user_check > 0){
$error = TRUE;
$eh12 = "<div class=em> The <b>username: $rname</b> is already in use by another user. Try another.</div>";
}
$sql_tmpuser_check = mysql_query("SELECT uName FROM tmpu WHERE uName='$rname'");
$tmpuser_check = mysql_num_rows($sql_tmpuser_check);
if ($tmpuser_check > 0){
$error = TRUE;
$eh13 = "<div class=em> The <b>username: $rname</b> is already being registered.</div>";
}
if(empty($tos)){
$error = TRUE;
$ehTOS = "<div class=em> You did not agree to our <a href=#>TOS</a> </div>";
}
/* display Error message if problem exists */
if($error == TRUE)
{
echo "<style type='text/css'>#ers{display: block;}</style>";
}else{
echo "<style type='text/css'>#ers{display: none;}</style>";
echo "<style type='text/css'>#srs{display: block;}</style>";
$act = md5(crypt($umail));
$hash = mysql_real_escape_string(strip_tags(md5(crypt($rmail,$eupass))));
$verf = mysql_real_escape_string(strip_tags(md5(crypt($eupass))));
$eupass = strip_tags(md5(md5($rpass)));
mysql_query("INSERT INTO tmpu ( uName, fName, lName, uMail, uPass, uDob, uAct, hash, verif) VALUES
( '$rname', '$fname', '$lname', '$rmail', '$eupass','$dab', '$act', '$hash','$verf' )") or die (mysql_error());
// ---------------- SEND MAIL FORM ----------------
$webmaster = "noreply@ewotty.cu.cc";
$to = $rmail;
$subject = "ewotty activation";
$header = "From: Ewotty <$webmaster>";
$message = "
Hello $fname \r
Welcome to ewotty cloud community, You are atempting to register a new account with us, But to complete your registeration you will need to
verify your account with the verfication link provided to you bellow. Once you've click this link and no errors have accured in the procces, You
will be shown a green check to notate a successful registeration.\r
Instructions:
once you see the green check mark, do not navigate from page wait till the page redirects in about 3-4 seconds to the homepage
If the page dose not redirect, you will be provided a maual redirect at the bottom of the screen. \r
Here's the link you will need to activate your ewotty account: \r
http://www.ewotty.cu.cc/activation/?ui=$act&acthash=$hash&verif=$verf";
mail($to, $subject, $message, $header);
}};
&GT;
答案 0 :(得分:0)
您需要在输入中使用值属性
<input type="text" class="umail" id="ftxti" name="rmail" value="" placeholder='email@server.com' style="width: 530px;" >
并且我没有看到您的代码中有表单标记。
<form name="yourform" method="POST" action ="" >
.........
your html inputs here
</form>