View Full Version : login script not working

08-11-2012, 03:50 AM
I inherited a game from a friend and have been messing around with it. Her style of PHP coding and mine are different and I just don't understand what is going on in here. When I attempt to login, I go to a blank screen - won't even get an error. Help?

All the tables are properly named in the code, I just changed them to 'table' here.

<?php include('include/db.php');

if (!$_SESSION["user"]){
if (isset($_POST['login'])){
if (!$_POST['username'] || !$_POST['password']){
echo "Please make sure you have entered a username and password.";

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

$getinfo = mysql_query("SELECT * FROM table WHERE username='$username' AND password='$password'")
or die(mysql_error());

if($log == mysql_fetch_object($getinfo)){
$_SESSION["user"] = $_POST['username'];

$updateip = mysql_query("UPDATE table SET ip='$ip' WHERE username='".$_SESSION['user']."'")
or die(mysql_error());

$getidd = mysql_query("SELECT * FROM table WHERE username='$username'")
or die(mysql_error());
$getid = mysql_fetch_array( $getidd );

mysql_query("INSERT INTO table(username, time, id) VALUES('$username', '$time', '".$getid['id']."' ) ");

header("Location: news.php");
$error = "Wrong username or password.";

08-11-2012, 05:11 AM
what error is showing and
make sure yourdatabasename in db.php

08-11-2012, 04:46 PM
I already said what it was doing: it was going to a blank page.
I think I got it figured out as it's something to do with my host, not the code.

08-12-2012, 05:11 AM
A blank page means you have a PHP script error,
but you have PHP error reporting turned off.
You need to enable error reporting to see what
the error is, and which line is the problem.

Google: PHP error reporting

Then tell us what your error says.

08-12-2012, 05:53 AM
header: Location('news.php');
Do you have any scripts on this page?