Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default Login Page Username and Password

    I am not going to post this in the Coding section because only about 30 people look at it.

    I have a login page and i want to turn the username text area into a dropdown selection menu so the users have to go through the list and select their username.

    This is the code:
    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("usersystem/config.php"); 
    if (!
    $logged[username]) 

    if (!
    $_POST[login]) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <input type=\"text\" size=\"15\" maxlength=\"30\" name=\"username\"> 
    </td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"30\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    </td></tr></table></form></center>"
    ); 

    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST[password]); 
    // the above lines set variables with the submitted information.   
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user[id],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user[password],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.   
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=\"/>Thank You! You will be redirected"); 
    // modify the above line...add in your site url instead of yoursite.com 



    else 

    // we now display the user controls. 
    echo ("<center>Welcome <b>$logged[username]</b><br /></center> 
    - <a href=\"editprofile.php\">Edit Profile</a><br /> 
    - <a href=\"members.php\">Member List</a><br /> 
    - <a href=\"logout.php\">Logout</a>"
    ); 

    ?>
    Can someone change that for me to be a dropdown username menu please.

    +REP Will be given.
    Thanks VERY VERY Much!!
    :.:Numark:.:
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  2. #2
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    Here try this havent tested it though:

    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("usersystem/config.php"); 
    if (!
    $logged[username]) 

    if (!
    $_POST[login]) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <select mysql_query("
    SELECT username FROM users WHERE username='$username'");>
    </select> 
    </td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"30\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    </td></tr></table></form></center>"
    ); 

    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST[password]); 
    // the above lines set variables with the submitted information.    
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user[id],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user[password],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.    
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=\"/>Thank You! You will be redirected"); 
    // modify the above line...add in your site url instead of yoursite.com 



    else 

    // we now display the user controls. 
    echo ("<center>Welcome <b>$logged[username]</b><br /></center> 
    - <a href=\"editprofile.php\">Edit Profile</a><br /> 
    - <a href=\"members.php\">Member List</a><br /> 
    - <a href=\"logout.php\">Logout</a>"
    ); 

    ?>

  3. #3
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    no it didnt. I get:
    Parse error: parse error, unexpected T_STRING on line 14
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  4. #4
    Join Date
    Sep 2005
    Posts
    1,604
    Tokens
    0

    Latest Awards:

    Default

    Okay try this:

    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("usersystem/config.php"); 
    if (!
    $logged[username]) 

    if (!
    $_POST[login]) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username: <?

    echo "
    <select size='1' name='username_post'>

    <
    option selected>Choose Your Name</option>";

    include('config.php');

    $result = mysql_query("SELECT FROM `users`");

    while(
    $worked = mysql_fetch_array($result)) {

    $username = $worked["username"];

    echo "
    <option value=$username>$username</option>";

    }

    mysql_close(); ?>

    </select></td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"30\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    </td></tr></table></form></center>"
    ); 

    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST[password]); 
    // the above lines set variables with the submitted information.    
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user[id],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user[password],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.    
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL="/>Thank YouYou will be redirected"); 
    // modify the above line...add in your site url instead of yoursite.com 



    else 

    // we now display the user controls. 
    echo ("
    <center>Welcome <b>$logged[username]</b><br /></center
    - <
    a href=\"editprofile.php\">Edit Profile</a><br /> 
    - <a href=\"members.php\">Member List</a><br /> 
    - <a href=\"logout.php\">Logout</a>"
    ); 

    ?>
    Again havent tested

  5. #5
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Parse error: parse error, unexpected T_STRING in /filer/1/en-www/K33QJFBEQM9RAJ9E/uploader/index.php on line 16

    this error comes up
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  6. #6
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    PHP Code:
    <? 
    oB_start
    (); 
    // allows you to use cookies. 
    include("usersystem/config.php"); 
    if (!
    $logged[username]) 

    if (!
    $_POST[login]) 

    echo(

    <center><form method=\"POST\"> 
    <table> 
    <tr> 
    <td align=\"right\"> 
    Username:"
    ); 

    echo 
    "<select size=\"1\" name=\"username\">
    <option selected>Choose Your Name</option>"

    $result mysql_query("SELECT * FROM `users`"); 
    while(
    $row mysql_fetch_array($result)) { 
    $username $row["username"]; 
    echo 
    "<option value=\"$username\">$username</option>"

    }

    echo(
    "</select></td> 
    </tr> 
    <tr> 
    <td align=\"right\"> 
    Password: <input type=\"password\" size=\"15\" maxlength=\"30\" name=\"password\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    <input type=\"submit\" name=\"login\" value=\"Login\"> 
    </td></tr><tr> 
    <td align=\"center\"> 
    </td></tr></table></form></center>"
    ); 

    if (
    $_POST[login]) { 
    // the form has been submitted.  We continue... 
    $username=$_POST['username']; 
    $password md5($_POST[password]); 
    // the above lines set variables with the submitted information.     
    $info mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $data mysql_fetch_array($info); 
    if(
    $data[password] != $password) { 
    // the password was not the user's password! 
    echo "Incorrect username or password!"
    }else{ 
    // the password was right! 
    $query mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
    $user mysql_fetch_array($query); 
    // gets the user's information 
    setcookie("id"$user[id],time()+(60*60*24*5), "/"""); 
    setcookie("pass"$user[password],time()+(60*60*24*5), "/"""); 
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password.     
    echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=\"/>Thank You! You will be redirected"); 
    // modify the above line...add in your site url instead of yoursite.com 



    else 

    // we now display the user controls. 
    echo ("<center>Welcome <b>$logged[username]</b><br /></center> 
    - <a href=\"editprofile.php\">Edit Profile</a><br /> 
    - <a href=\"members.php\">Member List</a><br /> 
    - <a href=\"logout.php\">Logout</a>"
    ); 

    ?>

  7. #7
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    thanks to all for help but Eric30 Helped out most because his worked . I will give +REP too all if possible.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

Posting Permissions

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