שלום,
יש לי אתר לשרת משחק ביתי
האתר עובד על WAMP SERVER (כלומר זו מערכת)
ויש לי בעיה בקובץ ההרשמה
אשמח אם תעזרו לי לתקן אותה כי כשממלאים את פרטי ההרשמה ולוחצים REGISTER לא קורה כלום, אין הודעה שנרשמת וגם ב SQL לא נוצר משתמש
הנה הסקריפט:
קוד PHP:
<?php
/*¯¯¯¯|¯¯¯¯¯|¯¯¯¯¯¯¯¯|¯¯¯|¯¯¯||¯¯¯|¯¯¯|¯¯¯¯¯¯¯¯|¯¯¯¯¯¯|¯¯¯¯*\
|###########################################|
|#_____________________..ButsagsCMS.._____________________#|
|#______.Copyright ©2000-2009 Chris Ingis. All Rights Reserved._____#|
|###########################################|
\*____|_____|________|___|___||___|___|________|______|____*/
echo"
<div id=\"mainbody\">
<tr>
<td>
<tr>
<td>
<div class=\"s_fill\">
<div class=\"s_t\">
<div class=\"s_b\">
<div class=\"s_l\">
<div class=\"s_r\">
<div class=\"s_bl\">
<div class=\"s_br\">
<div class=\"s_tl\">
<div class=\"s_tr\">
<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td valign=\"top\" width=\"%100\">";
// =========================
// If logged in, send to ucp
// =========================
if(isset($_SESSION['id'])){
echo "<meta http-equiv=refresh content=\"0; url=?butsags=ucp\">";
// ====================================================
// If no log in session present, echo registration page
// ====================================================
}else{
if(!isset($_POST['register'])){
echo "
<center><img src=\"images/register_header.gif\"/>
<br />
<font size=5><b>Registration</b></font>
</center>
<style>
input{
background: url('images/input.gif') repeat-x;
color:#ff1188;
}
input:focus{
background: url('images/input_active.gif') repeat-x;
}
a{
text-decoration: none;
color:#ff1188;
}
</style>
<form method=\"post\" action=''>
<table border=\"0\" width=\"100%\" align='center'>
<tr>
<td colspan=\"2\">
<div class=\"regtext\" align='center'>
Fill out all of these fields below in order to create a new account for <b>".$servername.".</b><br />
We advise you not to share any account information with anyone.
</div>
</td>
</tr>
</table>
<table border=\"0\" width=\"50%\" align='center'>
<tr>
<td>
<table border=\"0\" width=\"100%\">
<tr>
<td width=\"100%\" align='left'>
<div class=\"regtext\">
<b>Username: </b>
<input type=\"text\" style=\"width:20%;\" name=\"username\" maxlength=\"12\" />
</div>
</td>
</tr>
<tr>
<td width=\"100%\" align='left'>
<div class=\"regtext\">
<b>Password:</b> <i>(Input Twice)</i>
<input type=\"password\" style=\"width:20%;\" name=\"password\" maxlength=\"12\" />
<input type=\"password\" style=\"width:20%;\" name=\"cpassword\" maxlength=\"12\" />
</div>
</td>
</tr>
<tr>
<td width=\"100%\" align='left'>
<div class=\"regtext\">
<b>Email:</b> <i>(Input Twice)</i>
<input type=\"text\" style=\"width:30%;\" name=\"email\" />
<input type=\"text\" style=\"width:30%;\" name=\"cemail\" />
</div>
</td>
</tr>
<tr>
<td width=\"100%\" align='left'>
<div class=\"regtext\">
<b>Birthday</b>
";
echo showBirth('month');
echo showBirth('day');
echo showBirth('year');
echo "
</div>
</td>
</tr>
<tr>
<td class=\"list\" align='left'>
<div class=\"regtext\">
<b>Are you human:</b>
<select name=\"human\">
<option value=\"No\">No</option>
<option value=\"Yes\">Yes</option>
</select>
</div>
</td>
</tr>
<tr>
<td class=\"list\" align='left'>
";
$num1 = rand(0, 20);
$num2 = rand(1, 10);
$_SESSION['mathsession'] = $num1 + $num2;
echo "
$num1 + $num2 = <input type=\"text\" style=\"width:5%;\" name=\"math\" />
</td>
</tr>";
echo "
<tr>
<td class=\"list\">
<div class=\"regtext\" align='left'>
<b>Recaptcha Security:</b>
</div>
</td>
</tr>
<tr>
<td colspan=\"2\" class=\"list\" align='left'>";
require_once('config/recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "$pubkey";
$privatekey = "$privkey";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
echo "You got it!";
} else {
# set the error code so that we can display it
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
echo "
</td>
</tr>";
echo "
<tr>
<td class=\"list\" align='center'>
<div class=\"regtext\">
<b>Important Information:</b>
</div>
</td>
</tr>
<tr>
<td colspan=\"2\" class=\"list\" align='center'>
<b>Please make sure you have read and understood the rules for in-game play.</b><br />
<font color='red'>
<b>If you choose otherwise, disciplinary action can and will be taken.</b>
</font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<div class=\"regtext\">
<input type='checkbox' name='checkbox'>
I agree to the ".$servername." <a href=\"?butsags=main&page=tos\" target=\"_blank\">Terms and Conditions</a>.
</div>
</td>
</tr>
<tr>
<td colspan=\"2\" align=\"center\">
<input value='Register' name='register' type='image' width='130' height='39' src='images/register.png' border='0' alt='Submit Registration'>
<br /><br />
</td>
</tr>
</table>
</form>";
} else {
require_once('config/recaptchalib.php');
$privatekey = "$privkey";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$username = mysql_real_escape_string($_POST['username']);
$mathresult = $_POST['math'];
$password = mysql_real_escape_string($_POST['password']);
$cpassword = mysql_real_escape_string($_POST['cpassword']);
$email = mysql_real_escape_string($_POST['email']);
$cemail = mysql_real_escape_string($_POST['cemail']);
$birth = mysql_real_escape_string($_POST['year'])."-".mysql_real_escape_string($_POST['month'])."-".mysql_real_escape_string($_POST['day']);
$human = $_POST['human'];
$checkbox = $_POST['checkbox'];
$ucheck = mysql_query("SELECT * FROM `accounts` WHERE `name`='".$username."'") or die(mysql_error());
$isRegister = mysql_query("SELECT * FROM `accounts` WHERE `ip` = '".$ipaddress."'") or die(mysql_error());
$isBanned = mysql_query("SELECT * FROM `accounts` WHERE `ip` = '".$ipaddress."' && `banned` != '0'") or die(mysql_error());
$Registered = mysql_num_rows($isRegister);
$Banned = mysql_num_rows($isBanned);
// ==============
// Error Messages
// ==============
if(isset($_SESSION['mathsession'])){
$answer = $_SESSION['mathsession'];
}if($MaxAcc > 0 && $Registered >= $MaxAcc) {
echo "You are permitted to create up to ".$MaxAcc." Accounts ONLY!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($Banned > 0) {
echo "You are currently banned, and may not register.<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($username == ""){
echo "Please supply an username!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif(mysql_num_rows($ucheck) >= 1){
echo "The username already exists. Please select another one!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($password == ""){
echo "Please supply a password!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($password != $cpassword){
echo "The passwords don't match!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($email == ""){
echo "Please supply an e-mail!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($email != $cemail){
echo "The emails don't match!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif(strlen($username) < 4){
echo "Username must be between 4 and 12 characters!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif(strlen($username) > 12){
echo "Username must be between 4 and 12 characters!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif(strlen($password) < 6){
echo "Password must be between 6 and 12 characters!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif(strlen($password) > 12){
echo "Password must be between 6 and 12 characters!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($birth == ""){
echo "Please supply a birth date!<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif($human == "No"){
echo "You must be human to register.<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}elseif (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"<br>Please enter the words as you see them.<br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />");
}elseif($checkbox != "on") {
echo "You <b><i>MUST</i></b> agree to our <a href='?butsags=main&page=tos' target='_blank'>Terms and Conditions</a><br><input type=\"button\" style=\"width:80px; \" value=\"Go Back\" onclick=\"location.href='javascript: history.go(-1)';\" />";
}else{
$ia = mysql_query("INSERT INTO `accounts` (`name`,`password`,`birthday`,`email`,`ip`) VALUES ('".sql_sanitize($username)."','".sha1($password)."','".sql_sanitize($birth)."','".sql_sanitize($email)."','".sql_sanitize($ipaddress)."')") or die(mysql_error());
echo "You have successfully registered to <b>$servername.</b>";
}
}
}
echo "
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</td>
</tr>";
?>
תודה רבה לעוזרים!