PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've talked to a few people. I can't figure out what I've done wrong. This is kinda php/sql but yeah.
Basically, it won't post give errors or anything. you can see where I've added echo to test where my code was bad, still nothing is working. Not even the echo. I removed the CAPATCHA also and same exact thing. My host supports php so don't ask that
<?php
require_once('recaptchalib.php');
$publickey = "*";
$privatekey = "*";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# are we submitting the page?
if ($_POST["submit"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
if(isset($_POST['submit'])) {
echo "Works 0/5";
$igname = $_POST['igname'];
$steam = $_POST['steam'];
$email = $_POST['email'];
$ip = $_POST['ip'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$igname = mysql_real_escape_string($igname);
$steam = mysql_real_escape_string($steam);
$email = mysql_real_escape_string($email);
$ip = mysql_real_escape_string($ip);
$pass1 = mysql_real_escape_string($pass1);
$pass2 = mysql_real_escape_string($pass2);
if($igname == "" || $steam == "" || $email == "" || $pass1 == "" || $pass2 == "") {
die("<p><font color='red'>Error: One or more fields are empty. Please fill them and try again.</font></p>");
}
echo "Works 2/5 ";
if($pass != $pass2) {
die("<p><font color='red'>Error: The passwords do not match.</font></p>");
}
echo "Works 2/5 ";
$q1 = mysql_query("SELECT * FROM `referral` WHERE `igname`='$igname'");
$n1 = mysql_num_rows($q1);
if($n1 != 0) {
die("<p><font color='red'>Error: The In-Game name is already in use!</font></p>");
}
echo "Works 3/5";
$q2 = mysql_query("SELECT * FROM `referral` WHERE `email`='$email'");
$n2 = mysql_num_rows($q2);
if($n2 != 0) {
die("<p><font color='red'>Error: The email address is in use by another user.</font></p>");
}
echo "Works 4/5";
$q3 = mysql_query("SELECT * FROM `referral` WHERE `steam`='$steam'");
$n3 = mysql_num_rows($q3);
if($n3 != 0) {
die("<p><font color='red'>Error: The Steam ID is in use by another user.</font></p>");
}
echo "Works 5/5";
$q3 = mysql_query("INSERT INTO `referral` (`igname`,`steam`,`email`,`ip`,`pass1`) VALUES ('$igname',$steam','$email','$ip','$pass1')") or die("<p><font color='red'>Mysql Error: <b>".mysql_error()."</b></font></p>");
echo "<p><font color='green'>You have signed up successfully. <a href='/index.php'>Click Here</a> to go to the home page!</font></p>";
}
} else {
# set the error code so that we can display it. You could also use
# die ("reCAPTCHA failed"), but using the error message is
# more user friendly
$error = $resp->error;
}
}
echo recaptcha_get_html($publickey, $error);
?>
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.