Jump to content

Form Validation


XJTRy

Recommended Posts

The following is called upon with form submission. The script will die if passwords don't match which is correct. However, if the passwords are correct, the following displays a multiple of errors but does create the mySQL database correctly. Just wondering what is triggering the errors. My assumption is that I need an else statement for when passwords match, but I'm not sure. Thank You!

 

 

 

<body>

 

 

<?

//------Validate Passwords----------------------------//

 

ini_set ('display_errors', 1);

error_reporting (E_ALL & ~E_NOTICE);

 

if ($_POST['password1'] != $_POST['password2']) {

die ('Your Passwords Do Not Match. Please go back and try again. Thank You.');

}

 

 

 

//---Email Form------------------------------------------------//

 

// Configuration Settings

$SendFrom = $_REQUEST['name'] ;

$SendTo = "**********@zoominternet.net";

$SubjectLine = "Online GM Sign Up ";

$ThanksURL = "index.php"; //confirmation page

 

// Build Message Body from Web Form Input

foreach ($_POST as $Field=>$Value)

$MsgBody .= "$Field: $Value\n";

$MsgBody .= "\n" . @gethostbyaddr($_SERVER["REMOTE_ADDR"]) . "\n" .

$_SERVER["HTTP_USER_AGENT"];

$MsgBody = htmlspecialchars($MsgBody, ENT_NOQUOTES); //make content safe

 

// Send E-Mail and Direct Browser to Confirmation Page

mail($SendTo, $SubjectLine, $MsgBody, "From: $SendFrom");

 

//---Create the MySQL Table----------------------------------------------------------------//

 

$username="dbo27*******";

$password="*********";

$database="db27********";

 

mysql_connect("******.perfora.net",$username,$password);

@mysql_select_db($database) or die( "Unable to select database");

 

include 'config.php';

include 'opendb.php';

 

$query  = 'SELECT DATABASE db2******';

$result = mysql_query($query);

mysql_select_db("db27********");

 

$query = "CREATE TABLE user

 

(

Id int(6) NOT NULL auto_increment,

User varchar(20) NOT NULL,

Password varchar(15) NOT NULL,

Score int(4) NOT NULL,

 

 

PRIMARY KEY (id)

)";

 

$result = mysql_query($query);

 

//------------------Rename Table----------------------------------------------------------//

 

$name= $_REQUEST ['user'];

 

$query="RENAME TABLE user TO $name";       

$result= mysql_query($query);

 

//---------------------------Insert Password into created Table-------------------------------------//

$User=$_POST['user'];

$Password=$_POST['password1'];

$Score=$_POST['score'];

 

 

$table= $_POST['user'];

 

$query = "INSERT INTO $table VALUES

('','$User','$Password','$Score')";

mysql_query($query);

 

mysql_close();

 

 

?>

 

 

<p class="style2">Thanks for joining the Online GM Community @ Clevelandbrowns.cc</p>

 

<p class="style2">You may now log in using your information!.</p>

 

 

</body>

Link to comment
Share on other sites

Sure Scott. Here you go:

 

 

Warning: main(config.php) [function.main]: failed to open stream: No such file or directory in /homepages/27/d2041*****/htdocs/clevelandbrowns/contact.php on line 59

 

Warning: main() [function.include]: Failed opening 'config.php' for inclusion (include_path='.:/usr/lib/php') in /homepages/27/d2041*****/htdocs/clevelandbrowns/contact.php on line 59

 

Warning: main(opendb.php) [function.main]: failed to open stream: No such file or directory in /homepages/27/d2041*****/htdocs/clevelandbrowns/contact.php on line 60

 

Warning: main() [function.include]: Failed opening 'opendb.php' for inclusion (include_path='.:/usr/lib/php') in /homepages/27/d2041*****/htdocs/clevelandbrowns/contact.php on line 60

 

Thanks for joining the Online GM Community @ Clevelandbrowns.cc

 

You may now log in using your information!.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.