Jump to content

1more thing pls


reecieboy

Recommended Posts

[code]<html>
<head>
<title>PWN|CLAN - Login</title>
<style>
body {
    background-color: Black;
    color: White;
    font-family: Tahoma, sans-serif;
    font-size: 100%;
}
#userpass {
    width: 60px;
    border-color:#777777;
    background-color: #FFFFFF;
    color: #000000;
}

#subm {
    border-color: #777777;
    background-color: #FFFFFF;
    color: #000000;
}
</style>
</head>
<body>

<?php
if (!isset($_POST['submit']) || (isset($_POST['submit']) && $_POST['username'] == '') || (isset($_POST['submit']) && $_POST['password'] == '')) {
        echo "<form name='zlogin' method='POST' action='" . $_SERVER['PHP_SELF'] . "'>";
        echo "Username:&nbsp;&nbsp;<input type='text' name='username' id='userpass'><br>";
        echo "Password:&nbsp;&nbsp;<input type='password' name='password' id='userpass'><br>";
        echo "<input type='submit' name='submit' value='Login' id='subm'>&nbsp;<input type='reset' name='reset' value='Reset' id='subm'>";
        echo "</form>";
    }else {
        mysql_connect("localhost", "root", "chaos") OR die('password');
        mysql_select_db("main") OR die('Connecting');

        $q = "SELECT * FROM users WHERE userid='". $_POST['username']. "' AND password='".$_POST['password'] . "'";
        $rs = mysql_query($q) or die('Problem with query: ' . $q . '<br />' . mysql_error());
      $qquery = mysql_fetch_array($rs);
        if ($qquery['userid'] == $_POST['username'] && $qquery['password'] == $_POST['password']) {
            session_name('login');
            session_start();
            
            $_SESSION['username'] = $_POST['username'];
            $_SESSION['password'] = $_POST['password'];
        echo session_id();
        
        $q = ""INSERT * INTO users (sessionid) WHERE userid=".$_POST['username']." VALUES(session_id)";
        $rs = mysql_query($q) or die('Problem with query: ' . $q . '<br />' . mysql_error());

            
            echo "Successfully logged in as: ".$_POST['username']."<br><a href='index.php?page=your_account'>Click here to continue...</a>";
        }else {
            echo "Login failed,<br><a href='index.php?page=login'>Click here to try again...</a>";

    }
            
            


}
?>
</body>
</html>[/code]

by the way u kno any good session tutorials?
Link to comment
Share on other sites

You forgot to terminate your string in this line:
[code]<?php
mysql_query("INSERT * INTO users (sessionid) WHERE userid=".$_POST['username']." VALUES(session_id)")
OR die('fuck u suck reece');?>[/code]

I would break that into multiple lines for easier debugging:
[code]<?php
$q = ""INSERT * INTO users (sessionid) WHERE userid=".$_POST['username']." VALUES(session_id)";
$rs = mysql_query($q) or die('Problem with query: ' . $q . '<br />' . mysql_error());
?>[/code]

Also, I forgot to remove the referecences to "$fontface" and the "</font>" tags in your last two lines. They should be:
[code]<?php
            echo "Successfully logged in as: ".$_POST['username']."<br><a href='index.php?page=your_account'>Click here to continue...</a>";
        }else {
            echo "Login failed,<br><a href='index.php?page=login'>Click here to try again...</a>";
?>[/code]

Ken
Link to comment
Share on other sites

27768e4a7b8a093671bf7c4f1e883ed9 session id shows up but

Problem with query: INSERT * INTO users (sessionid) WHERE userid=user VALUES(session_id)
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '* INTO users (sessionid) WHERE userid=user VALUES(session_id)'

again thank you
Link to comment
Share on other sites

Your MySQL query is completly wrong! Are you updating a table row? If so you'll want to use this syntax:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']UPDATE[/span] table_name SET column_name [color=orange]=[/color] new_value [color=green]WHERE[/color] column_name [color=orange]=[/color] some_value [!--sql2--][/div][!--sql3--]
The following should work:
[code]$username = addslashes($_POST[#username']);
$q = "UPDATE users_table SET user_session='(sessionid)' WHERE userid='$username'";[/code]
You'll need to change user_table to the actual name of the table your are updating. Also chnage user_session to the coloumn name that holds the sessionid for the users. And change (sessionid) to the actually value of the sessionid.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.