Try adding this at the top:
PHP Code:ob_start();
Printable View
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" />
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.
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.
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:.