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

Thread: login

  1. #1
    New Coder
    Join Date
    Dec 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post login

    <?
    include("include/header.php");
    include("include/connect.php");
    echo "Login</b></td><tr><td class=third>";

    if($notice != "")
    {
    echo"<font class=limegreen><center>$notice</center></font><br>";
    }

    if($login == "Login")
    {
    session_register('log_username');
    session_register('log_pass');

    $query = mysql_query("SELECT * FROM varinder_login_users WHERE username=\"$log_username\" AND pass=\"$log_pass\"");

    if($query)
    {
    die("test");

    $check = mysql_fetch_array($query) or die(mysql_error());

    if($check[pass] == $log_pass AND $log_pass != "" AND $check[username] == $log_username AND $log_username != "" )
    {
    function gethostname()
    {
    $ip = getenv('REMOTE_ADDR');
    if (!$ip) { $ip = getenv('REMOTE_HOST'); }
    $ip = @GetHostByAddr($ip);
    return $ip;
    }

    $ip = gethostname();
    $clock = date("d F H:i:s");

    mysql_query("UPDATE varinder_login_users SET last_log=\"$clock\", online=1, ip=\"$ip\" WHERE username=\"$log_username\" AND pass=\"$log_pass\"") or die(mysql_error());

    echo "<font class=limegreen><center>Successful login.";
    include("include/footer.php");
    die();
    //Header("Location: game/main.php");
    //exit;
    }
    else
    {
    session_unregister('log_username');
    session_unregister('log_pass');

    echo "<font class=limegreen><center>Inavlid login information.";
    include("include/footer.php");
    die();

    //header("Location: login.php?notice=Inavlid login information.");
    //exit;
    }
    }
    else
    {
    echo "<font class=limegreen><center>Inavlid login information.";
    include("include/footer.php");
    die();
    }
    }


    echo "<form method=post action=login.php>
    <center>
    <b>Username:</b><input type=text name=log_username size="20"><br>
    <b>&nbsp; Password:</b><input type=password name=log_pass size="20"><br>
    <br>
    <input type=submit name=login value=Login>
    </center>
    </form>";

    include("include/footer.php");
    ?>

  • #2
    New Coder
    Join Date
    Dec 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    once u click the login it doesnt really go to the next page and i want
    the next page to retreve info from the database like Users Username and
    display it.

    i also have a forum thingy and something else that goes with it but the
    prob is its very long complecated work.

    u have to scan through the whole bloody code deleting bits editing the
    database name and a hell lot of other rubbish.

    at the momment im just concerned with the login.php file and to actually
    make it go to the next page and work properly ect. its half working
    theres mento be something else but god knows wots up with it.

  • #3
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <form method=post action=login.php>

    is what you have to edit if you want it to goto newpage.html then change action=login.php to action=newpage.html

    you can use print "$fildname" to print username from login.php page

    so in newpage.html it would be something line...

    <body>
    welcome <? print "$login_username" ?>
    </body>
    </html>

    login_username is the your field name for Login.php file Username.

  • #4
    New Coder
    Join Date
    Dec 2003
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you database in php is really confusing...


  •  

    Posting Permissions

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