SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    UK (The only place ot live)
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why does this keep dieing

    IT keeps showing the error "USER ALREADY TAKEN PLEASE USE ANOTHER USER" Why does it do this is it becuase i have an adminaccess field in this table 1 = admins yes 0 = no ?

    can someone help please

    PHP Code:
    <?php
    // register.php - Add users to the database from the deatails they gave on register.htm 
     
    session_start();

     
    $host="localhost";
     
    $login "";   
     
    $password "";   
     
    $db "";   
     
    $connection mysql_connect($host$login$password);
     
    $database mysql_select_db($db$connection);

     
    $values "'$HTTP_POST_VARS[user]', '$HTTP_POST_VARS[pass]', '$HTTP_POST_VARS[name]', '$HTTP_POST_VARS[email]', '$HTTP_POST_VARS[location]', '$REMOTE_ADDR'";
     
    $query mysql_query("SELECT * FROM members WHERE user = '$user'");
     if (
    mysql_num_rows($query) > 0) { 
     echo 
    "USER ALREADY TAKEN PLEASE USE ANOTHER USER";
     exit;
     }
     if ((empty(
    $HTTP_POST_VARS[user]) || empty($HTTP_POST_VARS[pass]))) { 
      print 
    "You need to specify a username and password. Click <A HREF=\"javascript:history.go(-1);\">here</A> to change it.";
      exit;
     } 
     
    mysql_query("INSERT INTO members VALUES ($values, 0)") or die("Could not add to the database please try again later");
     
    ?>
    What you know, and what you dont know is still not enough!!! (Niall Hatton 2002)

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $HTTP_POST_VARS[user] is not the same as $user

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    UK (The only place ot live)
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    yes

    but what is a solution?
    What you know, and what you dont know is still not enough!!! (Niall Hatton 2002)

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    UK (The only place ot live)
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Its ok i sorted it!!! ty anyway
    What you know, and what you dont know is still not enough!!! (Niall Hatton 2002)


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
  •