Jump to content

Recommended Posts

<?php
  $id = $_POST['id'];
  $email = $_POST['email'];
  $first = $_POST['nameFirst'];
  $last = $_POST['nameLast'];
  $username = $_POST['username'];
  $password = $_POST['password'];
  $md5pass = md5(trim($password)); // see here
  $cpassword = $_POST['cpassword'];
  $age = $_POST['age'] ;
  $gender = $_POST['gender'] ;
  $ip=$_SERVER['REMOTE_ADDR'];
  $sqlcheck="SELECT username FROM users WHERE username='$username'";

  if ($first == "") {
    echo "<strong>Error:</strong><br> You havent entered your first name<br/><br/>";
  }
  elseif ($last == "") {
    echo "<strong>Error:</strong><br> You havent entered your last name<br/><br/>";
  }
  elseif ($username == "") {
    echo "<strong>Error:</strong><br> You havent entered your username<br/><br/>";
  }
  elseif (strpos($username, $sqlcheck) === FALSE) {
    echo "<strong>Error:</strong><br> The requested username is in use<br/><br/>";
  }
  elseif ($password == "") {
    echo "<strong>Error:</strong><br> You havent entered your password<br/><br/>";
  }
  elseif (strpos($cpassword, $password) === FALSE) {
    echo "<strong>Error:</strong><br> You havent confirmed your password properly<br/><br/>";
  }
  elseif ($email == "" || strpos($email, "@") === FALSE || strpos($email, ".") === FALSE) {
    echo "<strong>Error:</strong><br> You havent entered your email<br/><br/>";
  }
  elseif ($age == "" || $age < 13) {
    echo "<strong>Error:</strong><br> You must be 13 or over to join<br/><br/>";
  }
  elseif ($age == "Age (e.g. 14)" || $age == "") {
    echo "<strong>Error:</strong><br> You havent entered your age<br/><br/>";
  }
  else {
  include ('includes/mysql_connect_users.php'); // also note the change to the statement below
  $mysqlinsert="INSERT INTO users(id, username, password, email, firstname, lastname, age, gender, ip)VALUES('$id', '$username', '$md5pass', '$email', '$first', '$last', '$age', '$gender', '$ip')";

  $result2=mysql_query($mysqlinsert);

if($result2){
echo "<u><strong>Your Login Information</strong></u><br/><br/>";
echo "Your Registered Username Is: ".$username."<br/><br/>";
echo "Your Registered Password Is: ".$password."<br/><br/>";
echo "<u><strong>Other Information</strong></u><br/><br/>";
echo "Your Registered Email Is: ".$email."<br/><br/>";
echo "Your Registered Age Is: ".$age." Years Of Age<br/><br/>";
echo "You Are Successfully Registered, Click <a href='index.php'>Here</a><br/>";
echo " To Go To The Homepage";
echo "<div class='important'><strong><u>Write This Information Down</u></strong></div>";
}
}
?>

 

That will fix the user registration portion, you still need to fix the current data.

I dunno man, you have all the information to fix it just in this thread alone.

 

You can catch a fish for a man and feed him for one day, or you can teach a man how-to fish and feed him for life.

 

It just takes a little bit of logical thinking.

I dunno man, you have all the information to fix it just in this thread alone.

 

You can catch a fish for a man and feed him for one day, or you can teach a man how-to fish and feed him for life.

 

It just takes a little bit of logical thinking.

 

yeah just use the registration fix that frost posted and create a new user (start from scratch), then try to log in with that new user. Who knows, it could have even been a typo when you typed the original password.

 

If anything, retrieve the md5 password from the database, print it to the page. Then print the password you just typed into the box onto the page, but first md5() the typed password, then you can see if the passwords are different... they shouldn't be.

 

It's all about realizing you have a problem and debugging the problem. You have to know what the problem is first. If you're just saying it's giving me an invalid password error, you don't know the reason to that. Figure it out, print both md5 passwords to the page and see if they match, if not, you probably did not enter the same password. And in that case, just rewrite the right password to the table

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.