Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    due
    due is offline
    New Coder
    Join Date
    May 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help geting my login work

    This is my index.
    PHP Code:
    <html>
    <
    head>
    <
    title>Drug Money</title>
    </
    head>


    <
    body bgcolor="#000" text="#ffffff">
    <
    form action="login.php" method="POST">
    Username:<br><input name="username" type="text" maxlength="30" />
    <
    br>Password:<br><input name="password" type="password" />
    <
    br><input type="submit" value="Log in" />
    </
    form></center>
    <
    div align="center"><table border="1" bgcolor="green" bordercolor="yellow" width="50%">
    <
    tr>
    <
    th><div align="center">NEWS</div></th></tr><tr><th>Updates:<hr>We Have Just started.</th></tr></table></div>
    </
    body>
    </
    html>
    </
    div
    And my login.php
    PHP Code:
    <? ob_start(); ?>
    <html>
    <head>
    <title>Drug Money:: login</title>
    </head>
    <body>
    <body bgcolor="#000" text="#ffffff">
    <tr><td align="center">
    <table style="border: 3px solid" align="center" width="50%" cellspacing="0" cellpadding="5">
    <tr><th class="new" style="border-bottom: 3px solid"><b>
    <?

    if( empty($_POST['username']) || empty($_POST['password']) )
    {
        echo 
    'Please specify a username and a password';
        exit();
    }

    if( !
    preg_match('/^[a-z][a-z0-9_-]{3,31}$/i'$_POST['username']) || (strlen($_POST['password']) < 6) )

    {
        echo 
    'Invalid username/password combination';
        exit();
    }

    $_POST['password'] = md5$_POST['password'] );

    mysql_connect'localhost''wwwsolar_pg''king' );
    mysql_select_db'wwwsolar_pg' );

    $result mysql_query"SELECT id FROM users WHERE username='{$_POST['username']}' AND password='{$_POST['password']}'" );
    $user mysql_fetch_assoc$result );
    mysql_free_result$result );

    mysql_close();

    if( empty(
    $user) )
    {
        echo 
    'Invalid username/password try again!';
        exit();
    }

    $_SESSION['user_id'] = $user['id'];

    header'Location: http://drugmoney.solarcombat.co.uk/base.php' );

    ?></b></th></tr>
    and when i insert the right pass and user it say Invalid username/password combination anyone know why
    DUE

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Canada
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    mysql_connect( 'localhost', 'xxx', 'xxx' ); 
    mysql_select_db( 'xxx' );
    fisrt of all change that to like xxx or something?

    and anothe rthing you can change is

    Code:
    <body bgcolor="#000" text="#ffffff">
    to

    Code:
    <body bgcolor="#000" text="#fff">

    im not to sure, but i think it is
    PHP Code:
    $_POST['password'] = md5$_POST['password'] ); 
    i think u have to delete that

    and move this

    Code:
    header( 'Location: http://drugmoney.solarcombat.co.uk/base.php' );
    move it up infront of

    PHP Code:
    $_SESSION['user_id'] = $user['id']; 
    might be wrong though

    but try it! lol...
    Last edited by RawliJr; 06-20-2006 at 11:46 PM.
    Rawli

  • #3
    due
    due is offline
    New Coder
    Join Date
    May 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    kk

    oh i see so people dont see that right but can u tell me whats wrong on it
    DUE

  • #4
    due
    due is offline
    New Coder
    Join Date
    May 2006
    Posts
    48
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hey

    that didnt work anyone know how to fix it
    DUE


  •  

    Posting Permissions

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