dreamkat wrote:ah, It seems I cant edit my post, sorry ; I'm new to this.
No worries. You may want to post your updated version with proper formatting as it is difficult to trace the flow of control otherwise.
dreamkat wrote:register_globals are off.
That's good 🙂
dreamkat wrote:Hm, no I dont know much about how they hack,
Would I prevent it by using
Yes, that is appropriate for incoming variables that should be treated as strings in the SQL statement. That said, I would not use it on the password because you will be putting it through md5 anyway.
dreamkat wrote:Well $loggedin is apart of config.php
That sounds wrong. It looks like this code should be part of your authentication check, not a configuration file.
By the way, instead of writing:
$update = @mysql_query("UPDATE `players` SET `lastlogin` = '$date' WHERE `id` = '".$_SESSION['id']."'");
$updateip = @mysql_query("UPDATE `players` SET `lastip` = '$ip' WHERE `id` = '".$_SESSION['id']."'");
Write:
mysql_query("UPDATE `players` SET `lastlogin` = '$date', `lastip` = '$ip' WHERE `id` = '".$_SESSION['id']."'");
Actually, I would write it as:
mysql_query(sprintf("UPDATE `players` SET `lastlogin`='%s', `lastip`='%s' WHERE `id`=%d",
date("M d, Y h:i a"), $_SERVER['REMOTE_ADDR'], $_SESSION['id']));
assuming that the id is an integer. If you want to be paranoid (which can sometimes be a good thing for security), apply mysql_real_escape_string for the return value of date and $_SERVER['REMOTE_ADDR'].