Jump to content

Register doesnt work all of a sudden...


Zero767

Recommended Posts

Ok, for some reason my register code all of a sudden doesnt work.  I have looked over my code and found nothing wrong.  But when I fill it out, it brings me to a blank page and doesnt add the user to the database.  I probobly missed somthing, but i need some new eyes to look at it.  Here it is:

 

<?php
#Login script coded by Keith.  It is only to be used with Gamers Odyssey unless you have talked with me.  Thanks.
include('validation.php');
$self = $_SERVER['PHP_SELF'];
$firstname = $_POST ['firstname'];
$username = $_POST ['username'];
$password = $_POST ['password'];
$email = $_POST ['email'];

if( ( !$firstname ) or ( !$username ) or ( !$password ) or ( !$email ) )

{
$form ="Please enter all of the details...";
$form.="<form action=\"$self\"";
$form.="method=\"post\">First Name: ";
$form.="<input type=\"text\" name=\"firstname\"";
$form.=" value=\"$firstname\"><br />Username: ";
$form.="<input type=\"text\" name=\"username\"";
$form.=" value=\"$username\"><br />Password: ";
$form.="<input type=\"password\" name=\"password\"";
$form.=" value=\"$password\"><br />Email: ";
$form.="<input type=\"text\" name=\"email\"";
$form.=" value=\"$email\"><br />";
$form.="<input type=\"submit\" value=\"Submit\">";
$form.="</form>";
echo( $form );
}

else
{ $conn = @mysql_connect( "localhost", "markeith_zero", "dbz123" )
or die ("Could not connect to MySQl database");
$db = @mysql_select_db ( "markeith_gamersodyssey", $conn )
or die ("Could not find database");
$sql = "SELECT COUNT(*) FROM users WHERE username = '{$_POST['username']}'";
$sql_result = mysql_query($sql);
if (mysql_result($sql_result, 0) > 0) {
error("This username is already in use.\\n Please choose another.");
exit();
}
$sql = "SELECT COUNT(*) FROM users WHERE email = '{$_POST['email']}'";
$sql_result = mysql_query($sql);
if (mysql_result($sql_result, 0) > 0) {
error("This username is already in use.\\n Please choose another.");
exit();
}
function checkemail($email){ 
		return preg_match("/^[^\s()<>@,;:\"\/\[\]?=]+@\w[\w-]*(\.\w[\w-]*)*\.[a-z]{2,}$/i",$email); 
	}

#The Error-Checker

$email = $_POST['email'];
if((!$email) OR (!checkemail($email))){  error("The email you entered is not valid.\\n Please enter another."); }
exit();
$sql = "insert into users
(first_name,username,password,email) values
(\"$firstname\",\"$username\",password(\"$password\"),\"$email\" )";
$result = @mysql_query( $sql, $conn )
or die("Could not execute query");
if( $result ) { echo( "Registration complete, welcome $username" );
mail("$email","Welcome to Gamers Odyssey!","-The Gamers Odyssey Team","Hey $username, welcome to Gamers Odyssey!  We just wanted to say thanks for joining "); }

}
?>

 

You can see what happens at go.redwaterhosting.com/register.php

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/42745-register-doesnt-work-all-of-a-sudden/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.