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 5 of 5

Thread: Session help!

  1. #1
    Join Date
    Aug 2004
    Location
    Over there. ^_^
    Posts
    1,100
    Tokens
    0

    Latest Awards:

    Default Session help!

    right this worked fine originally, i logged in on the member system and it kept you logged in when you went on other pages, right but i did some editing and its now broke! so i want to know how i can add a session to this login,

    PHP Code:
    <?php
    include('connect.php');
    if (
    $_POST['username']) {
    //did they supply a password and username
    $username=$_POST['username'];
    $password=$_POST['password'];
    if (
    $password==NULL) {
    echo 
    "A password was not supplied<br>";
    }else{
    $query mysql_query("SELECT username,password FROM members WHERE username = '$username'") or die(mysql_error());
    $data mysql_fetch_array($query);
    if(
    $data['password'] != $password) {
    echo 
    "The supplied login is incorrect<br>";
    }else{
    $query mysql_query("SELECT username,password FROM members WHERE username = '$username'") or die(mysql_error());
    $row mysql_fetch_array($query);
    $_SESSION["s_username"] = $row['username'];
    header("Location: index.php?show=main");
    }
    }
    }
    ?>
    <strong>Login</strong>:
    <form action='index.php?show=login' method='POST'>
    <table cellpadding="0" cellspacing="0" class="boxes_main">
    <tr>
    <td align='left'>
    Username:<br> <input type='text' size='20' maxlength='25' name='username'>
    </td>
    </tr>
    <tr>
    <td align='left'>
    Password:<br> <input type='password' size='20' maxlength='25' name='password'>
    </td>
    </tr>
    <tr>
    <td align='left'>
    <input type="submit" value="Login">
    </td>
    </tr>
    <tr>
    <td align='left' class="boxes_main">
    <a href="index.php?page=members/forgot">Forgot Password ?</a> | <a href="index.php?page=members/register">Register</a>
    </td>
    </tr>
    </table>
    </form>
    please help
    *Image Removed


    Ahemm.. How exactly was my sig innapropriate?
    Goddamit i hate this forum :@
    I RESIGN FROM GRAPHICS DESIGNER :@ :@ :@

  2. #2
    Join Date
    Nov 2004
    Location
    Daventry, Northants
    Posts
    1,510
    Tokens
    0

    Latest Awards:

    Default

    God how many errors do you get on your site
    :rolleyes:
    Wouldnt it be quicker to re-add the original code than debug it all

  3. #3
    Join Date
    Aug 2004
    Location
    Over there. ^_^
    Posts
    1,100
    Tokens
    0

    Latest Awards:

    Default

    ok...

    right on connect.php it actually starts a session apparently!
    *Image Removed


    Ahemm.. How exactly was my sig innapropriate?
    Goddamit i hate this forum :@
    I RESIGN FROM GRAPHICS DESIGNER :@ :@ :@

  4. #4
    Join Date
    Mar 2005
    Location
    Newcastle-Under-Lyme
    Posts
    8,924
    Tokens
    0

    Latest Awards:

    Default

    if ($password==NULL) :rolleyes:

  5. #5
    Join Date
    Jul 2004
    Location
    Webby Forums!
    Posts
    1,879
    Tokens
    0

    Latest Awards:

    Default

    session_start(); Thats how you start a session.


    Chilimagik.net // Reviews, Band Biographies, News, Pics + Loads More!!
    [Thybag.co.uk - Vive la revolutione]

Posting Permissions

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