Thanks, that worked.
asuming your MD5ing your passwords..
EDIT: Just saw you had a fix.
PHP Code:<?php
// if logged in goto homepage, if not continue
if($grab_login == 1) {
header( "Location: index.php" );
} else {
if($_GET ['do'] == "login") {
// make sure you clean these..
$username = $_POST ['username'];
$password = md5( $_POST ['password'] );
$data = @mysql_query( "SELECT * FROM `users` WHERE `username` = '$username' AND `password`='$password'" );
$count = @mysql_num_rows( $data );
// checks if the username and password the user entered matches the ones in the database
if($count != 0) {
$_SESSION ['username'] = $username;
$_SESSION ['logged_in'] = 1;
header( "Location: index.php" );
} else {
echo "your login credentials were incorrect.";
}
}
}
?>
<form action="?do=login" method="post"><input type="text"
name="username" /> <input type="password" name="password" /> <input
type="submit" value="login" />
Last edited by Dentafrice; 16-11-2008 at 11:58 PM.
Good move using POST instead of GET, esp for a login script. Stuff like that can potentially be picked up on the statistics software on your server, potentially allowing you to see passwords in plaintext.
I don't know any idiot who would use GET for something that processes sensitive data..
You don't think I know that? i don't need to be told what it reverts to when no method is specified.
I'm just saying, it's clear this user doesn't know much about this, or how it all works in general.
Hence I commended him on adding POST, explaining the reasons why GET is bad for this sort of form.
Stop jumping down my throat.
I'm not jumping down your throat, but I just think most people are smarter then that, I've never in my 4-5 years on this forum seen anyone use GET for a login submission. Ever.
Thanks for telling us all some common sense!
No one corrected me, are you stupid? If you'd read the posts you'd see no-one corrected me, I just saw a stupid post Beau posted, and criticized him for it.
Shows how much some of you pay attention :rolleyes:.
Want to hide these adverts? Register an account for free!