-1

The problem is as follows:

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

Here's Line 113 of use.register.php:

 $sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ");
 $email_check = mysql_num_rows($sql_email_check);

Here's The Variable Set For "$rmail":

$rmail       = mysql_real_escape_string(strip_tags($_POST['rmail']));

Here's the HTML line:

 <input type="text" class="umail" id="ftxti" name="rmail" placeholder='email@server.com' style="width: 530px;" >

Full code:

<?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);         
}};

?>

excoret
  • 11
  • 5
  • Do a `var_dump($sql_email_check);` and see what prints out. If it prints out false, then there is an error in your query. That being said, you really should really look into PDO. – Kyle Nov 22 '13 at 21:53
  • The query fails probably because of $rmail variable. – Mihai Nov 22 '13 at 21:53
  • Alright' It returns a False Boolean. I'm not sure what to do, I'm not all too familiar with MSQL and php ...Mainly just MSQL.. – excoret Nov 22 '13 at 21:56
  • if you are new to sql then you should use, this to know the errors in the queries so that you can debug it... `$sql_email_check = mysql_query("SELECT uMail FROM eusers WHERE uMail='$rmail' ") or Die("Could not Execute the Query".mysql_error());` do a var_dump($rmail) to see what is contains... – CyberBoy Nov 22 '13 at 21:58
  • You are not checking whether the query works out in the first place. See http://php.net/mysql_error Also, there are plenty of resources when you Google that error message - remember to always run a quick search first, most programming problems are already "out there" and have a fix. Also you were presented a huge list of possibly relevant questions while you entered your question title, make sure you check those out as well. Thanks! – Pekka Nov 22 '13 at 21:58
  • this code you posted looks good , provide full code . – echo_Me Nov 22 '13 at 22:02
  • @Pekka웃, I have but they don't seem to fix the problem. – excoret Nov 22 '13 at 22:03

1 Answers1

0

you need a value atribute in your input

 <input type="text" class="umail" id="ftxti" name="rmail" value="" placeholder='email@server.com' style="width: 530px;" > 

and i dont see that you have a form tags in your code.

 <form name="yourform" method="POST" action ="" >

  .........
  your html inputs here

 </form> 
echo_Me
  • 36,552
  • 5
  • 55
  • 77
  • The value is entered by the user, no? – Pekka Nov 22 '13 at 22:16
  • Well is a value needed for a text input? and also aren't the only tags needed for a form attribute the method and action unless you're using other "Real time" languages such as ajaz or java? – excoret Nov 22 '13 at 22:19
  • @excoret yes you can also use name atribute , [check this](http://www.w3schools.com/tags/att_form_name.asp) – echo_Me Nov 22 '13 at 22:23
  • and also of course you need a value atribute in text input you dont need it in textarea ,[check this](http://www.w3schools.com/tags/att_input_value.asp) – echo_Me Nov 22 '13 at 22:25
  • and please dont comment things without reading the basics , google them first and then comment – echo_Me Nov 22 '13 at 22:28
  • ah Alright thanks (= for the support. – excoret Nov 22 '13 at 22:33
  • you welcome . make sure to accept answer as solved. – echo_Me Nov 23 '13 at 08:32