Jump to content

Help me i am makeing a login


samuelsmcvids

Recommended Posts

I m coding a log in for my site and it gives me this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a8737860/public_html/register.php on line 93.

here is my coding 

 

<?php $title = "Samuelsmcvids Community- Register";?>
<?php require("styles/top.php"); ?>
    <div id='full'>
    <?php


$form = "<form action='register.php' method='post'>
<table>
<tr>
   <td>
   <p>Required = <font color='red'>*</font></p>
</td>
</tr>
<tr>
   <td>Full name:<font color='red'>*</font></td>
<td><input type='text' name='fullname'></td>
</tr>
<tr>
   <td>Last name:<font color='red'>*</font></td>
<td><input type='text' name='lastname'></td>
</tr>
<tr>
   <td>Username:<font color='red'>*</font></td>
<td><input type='text' name='username'></td>
</tr>
<tr>
   <td>Email:<font color='red'>*</font></td>
<td><input type='text' name='email'></td>
</tr>
<tr>
   <td>Password:<font color='red'>*</font></td>
<td><input type='password' name='password'></td>
</tr>
<tr>
   <td>Confirm Password:<font color='red'>*</font></td>
<td><input type='password' name='repassword'></td>
</tr>
<tr>
   <td>Avatar:</td>
<td><input type='file' name='avatar'></td>
</tr>
<tr>
   <td>Website address:</td>
<td><input type='text' name='website'></td>
</tr>
<tr>
   <td>Youtube username:</td>
<td><input type='text' name='youtube'></td>
</tr>
<tr>
   <td>Bio/about:</td>
<td><textarea name='bio' cols='35' rows='5'></textarea></td>
</tr>
<tr>
<td><input type='submit' name='submitbtn' value='Register'></td>
</tr>
</table>
</form>";


if ($_POST['submitbtn']) {


$firstname = strip_tags($_POST['firstname']);
$lastname = strip_tags($_POST['lastname']);
$username = strip_tags($_POST['username']);
$email = strip_tags($_POST['email']);
$password = strip_tags($_POST['password']);
$repassword = strip_tags($_POST['repassword']);
$website = strip_tags($_POST['website']);
$youtube = strip_tags($_POST['youtube']);
$bio = strip_tags($_POST['bio']);


$name = $_FILES['avatar']['name'];
$type = $_FILES['avatar']['type'];
$size = $_FILES['avatar']['size'];
$tmpname = $_FILES['avatar']['tmp_name'];
$ext = substr($name, strrpos($name, '.'));
}




if ($firstname && $lastname && $username && $email && $password && repassword){


   }
else
    echo"You did not fill out all the forms. $form";
   if ($password == $repassword){


}
else
    echo"The two passwords you entered do not match. $form";


require("scripts/connect.php");


$query = mysql_query("SELECT * FROM users WHERE username='$username'");
$num_rows = mysql_num_rows($query);
if($num_rows == 0){


}
else
    echo "Sorry that username is taken. $form";


   $pass = md5(md5(password));
$date = date("F d, Y");


if ($name){
   move_uploaded_file($tmpname, "avatars/$username.$ext");
$avatar = "$username.$ext";
}
else
    $avatar = "avatars/default.jpg";




$code = substr(md5(rand(11111111111111111, 999999999999999999)), 2, 25);


mysql_query("INSERT INTO users VALUES '', '$firstname', '$lastname', '$username', '$email', '$pass', '$avatar', '$bio', '$website', '$youtube', '', '$code', '0', '', '0', '$date'");




$webmaster = "samuelojanes@yahoo.com";
$subject = "Activate your Account";
$headers = "From: Samuelsmcvids<$webmaster>";
$message = "Hello $firstname $lastname!Thanks for joining http://smvidscommunity.tk!, A.K.A Samuelsmcvids Community! below is a link to activate you account!\n\n click her to Activate:
http://smvidscommunity/activate.php?code=$code";


mail($email, $subject, $message, $headers);


echo "Thanks for joining!You must now activate your account through the activation email that has been sent to <b>$email</b>.You must activate your account to be able to login. If you have having problems please contact the site administrator at  <a href='mailto:samuelojanes@yahoo.com'>samuelojanes@yahoo.com</a>";




    echo "$form";


?>
</div>
<?php require("styles/bottome.php"); ?>

 

Edited by samuelsmcvids
Link to comment
Share on other sites

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.