SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help fixing php login

    hi there,

    wondered if anyone could help me out, i'm running a php login system on my server but keep getting error messages for the validation when the data i'm entering is clearly correct.

    the only thing i can assume is that i've set this up wrong with the connection to the database because no data i'm entering is being written to the database.

    here is the code behind the php page for new user login:

    PHP Code:
    <head>
    <?php
      import_request_variables
    ("gP");
      include_once(
    "common.php");
      
    $error 0;
    // Checking to see if all the fields are completed
      
    if (($name != null) && ($email != null) && ($pass != null) && ($cpass != null) && ($address != null) && ($username != null)) {
    // Checking to see if the password is the same in the 2 inputs
        
    if ($pass == $cpass) {
    // The name and username should be different
         
    if ($name != $username) {
    // We check to see if this username is or not already taken
           
    $rst mysql_query("select * from userss where (username='$username')");
           
    $count mysql_num_rows($rst);
           if(
    $count == 0){
    // Coding the password
              
    $new_pass base64_encode($pass);
    // Inserting the data into the table
              
    $sql mysql_query("INSERT INTO userss VALUES (NULL, '$username', '$new_pass', '$name', '$address', '$email', 0)"$db);
    // This can be used for sending emails
    //            mail("$email", "New account", "Wellcome! \n Your details: \n User: $user \n Parola: $parola \n IP: $REMOTE_ADDR \n",
    //         "From: contact@domain.com\r\n".
    //         "Reply-To: contact@domain.com\r\n");
              
    $passwort $pass;
              include_once(
    "login.php");
          }
          else {
    // Error message
                 
    echo "This username already exists!";
                 
    $error 1;
               }
         }
         else {
    // Error message
                   
    echo "You are not allowed to have the same name and username!";
                 
    $error 1;
              }
        }
        else {
    // Error message
               
    echo "The password from the 2 inputs doesn't mach!";
               
    $error 1;
             }
      }
      else {
    // Error message
               
    echo "You haven't completed all the data!";
               
    $error 1;
           }
      echo 
    "</font> </b> </center>";
    // If one error has appered then variable $error is 1 so it should display the create account page again.
      
    if ($error == 1) {
    ?>
    <center><table width="400" border="0" cellpadding="3" cellspacing="2">
            <tr> 
              <td valign="top">
    <table width="100%" border=0 cellspacing="2" cellpadding="1" class='content'>
    <form action="new_login.php" method="post">
    <tr><td> <b>Name:</b></td><td> <input type="text" name="name" SIZE="40" class="inputs" value='<? echo $name?>'></td></tr>
    <tr><td> <b>Email:</b></td><td> <input type="text" size="40" name="email" class="inputs" value='<? echo $email?>'></td></tr>
    <tr><td> <b>Username:</b></td><td> <input type="text" name="username" SIZE="40" class="inputs" value='<? echo $username?>'></td></tr>
    <tr><td> <b>Password:</b></td><td> <input type="password" name="pass" SIZE="40" class="inputs"></td></tr>
    <tr><td> <b>Confirm password:</b></td><td> <input type="password" name="cpass" SIZE="40" class="inputs"></td></tr>
    <tr><td> <b>Address:</b></td><td> <input type="text" name="address" SIZE="40" class="inputs" value='<? echo $address?>'></td></tr>
    <tr><td></td><td> <input type="submit" value="Submit" class="buttons"> </td></tr>
    </form></table>
             </td>
            </tr>
          </table></center>
          
    <?php
      
    }
      
    ?>
    the error msg i'm getting is "this username doesn't exist!"????

    any ideas

    thanks
    svens_saviour

  2. #2
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your query for inserting in to the DB, u have spelt users like "userss", is that correct?
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  3. #3
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope that isn't the error, thats the way i wrote it , don't think it matters much now because i've managed to find a better login system i did ages ago which works a treat.

    thanks anyway


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •