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

Thread: Wont login???

  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Wont login???

    Config.php [The problem part]
    PHP Code:
    if ($_SESSION['username'] && $_SESSION['pass']) {
       
    $logged mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]' AND password = '$_SESSION[pass]'") or die(mysql_error());
       
    $logged mysql_fetch_array($logged);

    Login.php
    PHP Code:
    <?
    ob_start
    ();
    session_start();
    $date =  date("d/m/Y H:i:s"); 
    $ip $_SERVER['REMOTE_ADDR'];  
    if (!
    $logged["username"])  
    {  
    echo
    "  <center>
    <form method='POST'>  
    <b>Username:</b><br>
    <input type='text' size='15' maxlength='25' name='username'><br><br>
    <b>Password:</b><br>
    <input type='password' size='15' maxlength='25' name='password'><br><br>
    </b><input type='submit' name='login' class='button' value='Login'><br></form>
    <a href='?sid=1&page_view=register'>Register</a><Br>
    <a href='?sid=1&page_view=forgotpass'>Forgot Password</a></center> "
    ;  
    }
    if (
    $_POST[login]) {  
    $username strip_tags(addslashes($_POST["username"]));
    $password md5(strip_tags(addslashes($_POST["password"])));
    $check mysql_query("SELECT * FROM `users` WHERE `username` = '$username'");
    $check_num mysql_num_rows($check);
    $check_pass mysql_fetch_array($check);
    if(
    $check_num == 0){
    echo 
    "<br><font color=red><b>Username Incorrect!</b></font>";
    }
    if(
    $check_pass[password] == $password){
    unset(
    $_SESSION[username]);
    unset(
    $_SESSION[password]);
    session_start();
    $_SESSION["username"] = $username;
    $_SESSION["pass"] = $password;
    Header("Location: index.php?sid=1");
    }else{
    echo 
    "<br><font color=red><b>Password Incorrect!</b></font>";
    }
    }
    if(
    $logged["username"])  

    echo 
    "<img align='left' src='imager.php?user=$logged[username]&action=wlk&direction=3000002&head_direction=2999995&gesture=sml&size=l&hotel=$logged[hotels]'>"
    echo(
    "<br>Logged in As:<br><i><b>$logged[username]</b></i><br><br><a href=?page_view=profile&user=$logged[username]>View Public Profile</a><br><br><a href='?sid=1&logout=true'><b>Logout?</b></a>");
    }
    ?>
    So I type in the CORRECT username and password, click login... goes back to blank form? Never used to till I moved servers... yeh i cleared temp files cookie that lot... just wont work?? Any ideas?
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  2. #2
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Sorry can i ask

    session_start();
    $_SESSION["username"] = $username;
    $_SESSION["pass"] = $password;

    Why do you have another session start here??

    Also have u got session_start(); in config?


  3. #3
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Only use one session. Your trying to start two sessions which won't work.

  4. #4
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Also you dont need ob_start();

    and session_start();

    ob_start(); = cookies
    session_start(); = sessions

    pick one and stick to it
    Looking for a good desiner to design a social networking template.

    PM me.

  5. #5
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    DON'T pick cookies. Store your logins in sessions as cookies can be easily retrieved.

  6. #6

    Default

    Quote Originally Posted by Bojangles View Post
    DON'T pick cookies. Store your logins in sessions as cookies can be easily retrieved.
    Cookies are just as secure as sessions if you use them properly. They both have their uses, for example I don't think you can set a time on sessions, but you can cookies, so if you wanted the user to stay logged in for a certain amount of time you'd use cookies rather than sessions.
    Last edited by Jme; 06-04-2008 at 01:54 PM.

  7. #7
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jme View Post
    Cookies are just as secure as sessions if you use them properly. They both have their uses, for example I don't think you can set a time on sessions, but you can cookies, so if you wanted the user to stay logged in for a certain amount of time you'd use cookies rather than sessions.
    Agreed but if hes using cookies and sessions and 2 sets of sessions for 1 file then he won't be able to manage cookies securely (no offence)

Posting Permissions

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