Code: Select all
#do check #
$checkstring = " SELECT FROM $table_name WHERE GID='$_POSTїGID]' ";
if ($checkstring == '$_POSTїGID]') {
print ("I'm sorry this Game ID already exists please hit the back button!");
exit;
}Moderator: General Moderators
Code: Select all
#do check #
$checkstring = " SELECT FROM $table_name WHERE GID='$_POSTїGID]' ";
if ($checkstring == '$_POSTїGID]') {
print ("I'm sorry this Game ID already exists please hit the back button!");
exit;
}Code: Select all
<?php
// lets simplify the var
// i always do this, makes it simpler for me in queries
$gid = $_POST['GID'];
$query = "SELECT * SELECT FROM $table_name WHERE GID= '$gid'";
$result = mysql_query($query) or die (mysql_error());
$rows = mysql_num_rows($result);
// now we'll use the conditional statements
if ($rows >= 1)
{
// the GID already in the database
header ("Location: ../index.php");
exit;
}
else
{
// the GID is new
// use a mysql insert to insert the new data
// ill leave that to you
}
?>Code: Select all
<?php
#check and see if the fields are empty.. if they are uh oh send them back to signup!
if ((!$_POSTїname]) || (!$_POSTїGID]) || (!$_POSTїpassword]) || (!$_POSTїemail]) || (!$_POSTїage])) {
Print ("Please hit the back button and make sure you filled in all the text fields correctly!");
}
##starting create user##
#variables#
$db_address = "localhost";
$db_name = "pixelfriendly_com";
$db_pass = "xxxxxx";
$table_name = "aprilacc";
$db_user = "pixel"; #do check #
#connection#
$connection = @mysql_connect($db_address, $db_user, $db_pass) or die(mysql_error());
#do check #
// lets simplify the var
// i always do this, makes it simpler for me in queries
$gid = $_POSTї'GID'];
$query = "SELECT * SELECT FROM $table_name WHERE GID= '$GID'";
$result = mysql_query($query) or die (mysql_error());
$rows = mysql_num_rows($result);
// now we'll use the conditional statements
if ($rows >= 1)
{
// the GID already in the database
print ("I'm sorry this Game ID already exists please hit the back button!");
exit;
}
else
{
#select#
mysql_select_db($db_name) or die(mysql_error());
#insert data#
$sql = "INSERT INTO $table_name(name, GID, password, email, age) VALUES('$_POSTїname]', '$_POSTїGID]', password('$_POSTїpassword]'), '$_POSTїemail]', '$_POSTїage]')";
#results#
$result = @mysql_query($sql, $connection) or die(mysql_error());
?>
<?#print results/email#
mail($_POSTїemail], "Thank you", "Thankyou for signing up for closed beta, you will be contacted by email if you are accepted. Please do not reply to this email it is an automatic response. Thanks, April 19th team", "From: admin@april19th.com");
header("location: Http://game.pixelfriendly.com");
?>Code: Select all
$host = "myhost";
$user = "myname";
$pass = "pass";
$db = "database";
mysql_connect('$host', '$user', '$pass') or die(mysql_error());
mysql_select_db('$db') or die(mysql_error());