Hello all, I've been working on my server for quite a bit now and I'm down to getting the finishing touches in order aka the account registration page. As I do not wish to manually enter account info everytime a guildie wants to join my server this is something I need. I have played with about 6 templates I've found online for this very purpose and cleaned them all up in dreamweaver. Yet I cannot get any to function properly. This page is the best out of all of my attempts, I am including the code so somebody can slap me and show me why it's not working.
INDEX.PHP
________________________________________________________________
<?php
include 'config.php';
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$msg = Array();
$error = Array();
function addUser(){
if (empty($_POST)) return false;
global $config, $msg, $error;
// Check if this IP has more than the accounts per IP limit
$ip = $_SERVER['REMOTE_ADDR'];
$db = @mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
if (!$db) return $error[] = 'Database: '.mysql_error();
if (!@mysql_select_db($config['mysql_dbname'], $db)) return $error[] = 'Database: '.mysql_error();
$UserCheck = mysql_query("SELECT * FROM accounts WHERE lastip = '$ip'");
if (mysql_num_rows($UserCheck) >= $config['MaxIPs']) return $error[] = '<font size=2 face=Tahoma><br /><b> You have reached your maximum amount of accounts</b></font>';
if (empty($_POST['login'])) $error[] = 'Error, You forgot to enter a account name!';
if (empty($_POST['password'][0]) || empty($_POST['password'][1])) $error[] = 'Error, You forgot to enter a password!';
if ($_POST['password'][0] !== $_POST['password'][1]) $error[] = 'Password does not match!';
if (!empty($error)) return false;
$db = @mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
if (!$db) return $error[] = 'Database: '.mysql_error();
if (!@mysql_select_db($config['mysql_dbname'], $db)) return $error[] = 'Database: '.mysql_error();
$encrypted_password = sha1($_POST['password'][1]);
$query = "SELECT `acct` FROM `accounts` WHERE `login` = '".mysql_real_escape_string($_POST['login'])."'";
$res = mysql_query($query, $db);
if (!$res) return $error[] = 'Database: '.mysql_error();
if (mysql_num_rows($res) > 0) return $error[] = 'Username already in use. Be Creative!';
$query = "INSERT INTO `accounts` (`login`, `encrypted_password`,`lastip`, `email`, `flags`) VALUES ('".mysql_real_escape_string($_POST['login'])."', '$encrypted_password', '".$_SERVER['REMOTE_ADDR']."','".mysql_real_escape_string($_POST['email'])."','".mysql_real_escape_string($_POST['tbc'][0])."')";
$res = mysql_query($query, $db);
if (!$res) return $error[] = 'Database: '.mysql_error();
$msg[] = 'The Account <span style="color:#00FF00"><strong>'.htmlentities($_POST['login']).'</strong></span> has been created!<br>Allow 5 to 10 Minutes For The Server To Update.';
mysql_close($db);
return true;
}
{
addUser();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML LANG="EN-US">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
</HTML>
<?php include('style.css'); ?>
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
</head>
<body>
<div align="center">
<div style="width:300px">
<form action="<?php echo $_SERVER['file:///C|/Users/Ferocious/Desktop/PHP_SELF']; ?>" method="POST">
<!-- <br>s for visual appearl do not remove-->
<br><br><br><br><Br><Br><br><br><br><br>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
<tr class="head"><th colspan="2">Account Creation</th></tr>
<tr>
<th>Username: </th><td align="center"><input class="button" type="text" name="login" size="30" maxlength="16"></td>
</tr>
<tr>
<th>Password: </th><td align="center"><input class="button" type="password" name="password[]" size="30" maxlength="16"></td>
</tr>
<tr>
<th>Retype Password: </th><td align="center"><input class="button" type="password" name="password[]" size="30" maxlength="16"></td>
</tr>
</div>
<th>Account Type:</th><td align="center">
<select name="tbc" type="select">
<option value="0">Normal</option>
<option selected value="8">Burning Crusade</option>
</select></td>
</table>
<input type="button" class="button" value="Back" onClick="history.go(-1)" >
<input type="submit" value="Submit" class="button">
</form>
<?php
if (!empty($error)){
echo '<table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td class="error" align="center">';
foreach($error as $text)
echo $text.'</br>';
echo '</td></tr></table>';
};
if (!empty($msg)){
echo '<table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td align="center">';
foreach($msg as $text)
echo $text.'</br>';
echo '</td></tr></table>';
exit();
};
?>
</div>
</center>
</table>
<div align="center">
<p id="done" style="width: 220px; font-weight: bold; color: #29b503; font-family: tahoma, arial, sans; font-size: 13px;">
<span class="style1">Realmlist:</span><br >
<span class="style2"><style type="text/css"> p.white </style>Set Realmlist <?php echo "$RealmIP"; ?></span><br >
<br >
<span class="style1">Accepted Client(s):</span><br >
<span class="style2"><style type="text/css"> p.white </style><?php echo "$AcceptedPatch"; ?></span><br >
</div>
</body>
</html>
________________________________________________________________
Config.php
________________________________________________________________
<?php
$config['mysql_host'] = 'wowbox.servegame.org'; //MySQL Host Address
$config['mysql_user'] = 'root'; //MySQL Username
$config['mysql_pass'] = ''; //MySQL Password
$config['mysql_dbname'] = 'logon'; //Logon Database Where The Accounts Stuff Resides usually logon
$config['MaxIPs'] = '3'; //Set this to the allowed MAX accounts Per IP Address
$RealmIP = 'wowbox.servegame.org'; //Set this to the IP address of your realm server.
$AcceptedPatch = '2.4.3'; //Accpeted Patch means the Client patch number that the server allows to connect
?>
_________________________________________________________________
When you click the submit button it just sends you off to a white page the address bar shows the same address and no changes to the database occur.
I am running my database through wamp, wamp is running during these tests *duh* and I am serving the page through iis7 because apache doesnt seem to get along with php5 and vista 64. I have tried using the page via firefox 3, ie7, and ie8 beta with no success.
Please pummel me with the club of knowledge and call me a newb already...