I need some help with a LAN registration page.
http://fru.tasgamers.com/lans.php
If you follow the instructions and try to register you get an error and I have no idea why.
This is the code, so that you can see whats happening...
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../phpBB2/';
include($phpbb_root_path.'extension.inc');
include($phpbb_root_path.'common.'.$phpEx);
if(isset($HTTP_POST_VARS['submit']))
{
$username = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
$sql = "SELECT user_id, username, user_password, user_active, user_level
FROM " . USERS_TABLE . "
WHERE username = '" . str_replace("\'", "''", $username) . "'";
if(!($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
}
if($row = $db->sql_fetchrow($result))
{
if(md5($password) == $row['user_password'])
{
$sql = "INSERT INTO lan VALUES('".$username."')";
if(!($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in inserting userdata', '', __LINE__, __FILE__, $sql);
}
}
}
}
?>
<html>
<head>
<title>LAN Registration</title>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#000000" text="#ffffff">
<h1>Register</h1>
<h4>* You must be a forum member to register <a href="http://fru.tasgamers.com/phpBB2/profile.php?mode=register" target="_blank">Click here to sign up</a></h4>
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr>
<td>Username</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Register"></td>
</tr>
</table>
</form>
<hr>
<table>
<tr>
<td><h4>Current list of people registered...</h4></td>
</tr>
<tr>
<td>
<ul>
<?php
$sql = "SELECT * FROM lan";
if(!($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);
}
while($row = $db->sql_fetchrow($result)) print "<li>".$row['username']."</li>\n";
?>
</ul>
</td>
</tr>
</table>
</body>
</html>
This uses your user name and password from the phpbb2 LAN forums on the site.
If you know how I can fix this, please help me.