Jump to content

Colourtheory

Members
  • Posts

    39
  • Joined

  • Last visited

Posts posted by Colourtheory

  1. For some reason, it always says that the password is incorrect. I have looked at everything, so I'm hoping that someone can help me <? //This function will find and checks if your data is correct //Collect your info from login form $username = $_REQUEST['username']; $password = $_REQUEST['password']; //Connecting to database $connect = mysql_connect("myhost", "myuser", "mypass"); if(!$connect){ die(mysql_error()); } //Selecting database $select_db = mysql_select_db("mydatabase", $connect); if(!$select_db){ die(mysql_error()); } //Find if entered data is correct $result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); $row = mysql_fetch_array($result); $id = $row['id']; $select_user = mysql_query("SELECT * FROM users WHERE id='$id'"); $row2 = mysql_fetch_array($select_user); $user = $row2['username']; if($username != $user){ die("Username is wrong!"); } $pass_check = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id'"); $row3 = mysql_fetch_array($pass_check); $email = $row3['email']; $select_pass = mysql_query("SELECT * FROM users WHERE username='$username' AND id='$id' AND email='$email'"); $row4 = mysql_fetch_array($select_pass); $real_password = $row4['password']; if($password != $real_password){ die("Your password is wrong!"); } //Now if everything is correct let's finish his/her/its login session_register("username", $username); session_register("password", $password); echo "Welcome, ".$username." please continue on our <a href=index.php>Index</a>"; ?>

    Error

    How would you reccomend doing it? This is my first time setting up a login/register system and I have no idea how to go about doing it, so I'm being creative.

    Error

    Yes, that's the name. The error is here: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE ( Username varchar(15), Password varchar(15), Email varchar(15), A' at line 1

    Error

    How do I fix this error? I'm pasting the SQL part but if you need the PHP part ask.

    $acc = "CREATE TABLE $_POST[username](Username varchar(15),Password varchar(15),Email varchar(15),Age int)"

  2. I'm sending this post request. <form action="insert.php" method="post">Username:<br> <input class="register" type="text" name="username"><br>Lastname:<br> <input class="register" type="text" name="password"><br>Email:<br> <input class="register" type="text" name="email"><br>Age:<br><input class="register" type="text" name="age"<br><input type="submit"></form>

  3. I have a box "register" thing which simply inserts a new object into my MySQL table, and it works- BUT it also creates a spare one which is completely blank and has no values or anything. I can give the source, just ask if required.

×
×
  • Create New...