Jump to content

Recommended Posts

Greetings all,

 

I am developing a php website and I found a video series that showed me how to create a members system. Ran into an error and I am recieving this error.

 

Fatal error: Call to undefined function mysql_nums_rows() in ....register.php on line 48

 

Here is the page code.

 

 

 

<?php

if ( $_POST['registerbtn']){

$getuser = $_POST['user'];

$getemail = $_POST['email'];

$getpass = $_POST['pass'];

$getretypepass = $_POST['retypepass'];

 

if ($getuser){

if ($getemail){

if ($getpass){

if ($getretypepass){

if ( $getpass === $getretypepass ){

if ( (strlen($getemail) >= 7) && (strstr($getemail, "@")) && (strstr($getemail, ".")) ){

require("./connect/connect.php");

 

$query = mysql_query("SELECT * FROM users WHERE username='$getuser'");

(this would be line 48) ---> $numrows = mysql_nums_rows($query);

if ($numrows == 0){

$query = mysql_query("SELECT * FROM users WHERE email='$getemail'");

$numrows = mysql_nums_rows($query);

if ($numrows == 0){

 

$password = md5(md5("edited out for privacy"));

$date = date("F d, Y");

$code = md5(rand());

 

mysql_query("INSERT INTO users VALUES ('', '$getuser', '$password', '$getemail', '0', '$code', '$date')");

 

$query = mysql_query("SELECT * FROM users WHERE username='$getuser'");

$numrows = mysql_num_rows($query);

if ($numrows == 1){

$site = "edited out for privacy";

$webmaster = "edited out for privacy <edited out for privacy>";

$headers = "From: $webmaster";

$subject = "Activate your account.";

$message = "Thank you for registering at .... Please click the link below to activate your account.\n";

$message .= "$site/activate.php?user=$getuser&code=$code\n";

$message .= "You must activate your account to login.";

 

if ( mail($getemail, $subject, $message, $headers)){

$errormsg = "You have been registered. In order to complete the registration you must activate your account from the email sent to <b>$getemail</b>";

$getuser = "";

$getemail = "";

}

else

$errormsg = "An error has occured. Your activation email was not sent.";

 

}

else

$errormsg = "An error has occured. Your account was not created.";

}

else

$errormsg = "That email is already in use.";

}

else

$errormsg = "That username is already taken.";

mysql_close();

}

else

$errormsg = "You must enter a valid email to register.";

}

else

$errormsg = "Your passwords did not match.";

}

else

$errormsg = "You must retype your password to register.";

}

else

$errormsg = "You must enter your password to register.";

}

else

$errormsg = "You must enter your email to register.";

}

else

$errormsg = "You must enter your username to register.";

}

 

 

 

$form = "<form action='./register.php' method='post'>

<table>

<tr>

<td></td>

<td><font color='red'>$errormsg</font></td>

</tr>

<tr>

<td>Username:</td>

<td><input type='text' name='user' value='$getuser' /></td>

</tr>

<tr>

<td>Email:</td>

<td><input type='text' name='email' value='$getemail' /></td>

</tr>

<tr>

<td>Password:</td>

<td><input type='password' name='pass' value='' /></td>

</tr>

<tr>

<td>Confirm Password:</td>

<td><input type='password' name='retypepass' value='' /></td>

</tr>

<tr>

<td></td>

<td><input type='submit' name='registerbtn' value='Register' /></td>

</tr>

</table>

</form>";

 

echo $form;

 

?>

 

Does anyone know where I screwed up here? Thanks in advance.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.