Jump to content

Design

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by Design

  1. Teh checkboxes are meant to allow them to check both at once, however you pointed out that they can check neither, thanks much, i missed a handler for that situation :-D Aside from that, I'm now getting this error when I try to run the script: [quote]Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/pc72/public_html/smash/Test.php on line 52[/quote] And here's what my code looks like right now(after all above changes): [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>GSmash Tournament registration</title> </head> <body> <?php // Check to make sure that the user isnt spamming people via the form: function spamcheck($field) { if ( eregi("to:", $field) || eregi("cc:", $field) || eregi(";", $field) ) { return true; } else { return false; } } function checkType($type) { if ( $_POST['type1'] == true && $_POST["type2"] == false ) { $type = 1; } elseif ( $_POST['type1'] == false && $_POST["type2"] == true ) { $type = 2; }                 elseif        (                                                 $_POST['type1']        ==            false                                                 &&                                                 $_POST['type2']        ==            false                               )                 {                 echo "<font color="red">ERROR: You must select a tournament type.</font>"                 } else { $type= 3; } return $type; } //Make sure the form is filled out: if(isset($_POST['email'])) { //check if the email address is invalid $mailcheck = spamcheck($_POST['email']); if ( (bool)$mailcheck == true) { echo "Sorry, the e-mail you have entered is invalid, please re-enter it."; } else { //send email if the e-mail is valid $email = $_POST['email']; $subject = "Smash Entry For: " . $_POST['name']; $type = checkType(); $message = $_POST['sname'] . ", " . $_POST['char'] . ", " . $type; mail("Linkmaster424@aol.com", "Subject: " . $subject, $message, "From: " . $email . "\r\n"); echo "Thanks for your entry!Your data will be sent to the tournament staff."; } } else { ?> <h1 align="center">Glenwood SSBM Tournament Form</h1> <hr /> <br /> <h3 align="center">Fill out the form and click the &quot;Send&quot; button.</h3> <form method="post" action="ssbm.php"> Email: <input type="text" name="email" /><br /> Name: <input type="text" name="name" /><br /> Smash Name: <input type="text" name="sname" max=4 min=1 size=16><br /> Character: <input type="text" name="char" /><br /> Entry Type(select at least one):<br /> One on One:<input type="checkbox" name="type1"><br /> Teams:<input type="checkbox" name="type2"><br /> </form> <p><em>Note: In order to join the tournament, you will be required to pay an entry fee of &nbsp; &nbsp; $5.00 upon entry. &nbsp;This is mandatory for both teams and singles, meaning that if you are on a team, &nbsp;you AND your partner will need to pay the entry fee, totalling ten dollars. &nbsp;The same goes if you &nbsp;were to enter in both tournaments, you would have to pay a fee of ten dollars(five for each tournament).</em></p> <br /> <p><font size="2">&copy;2006 By Tristan Nolan.</font></p> <?php } ?> </body> </html> [/code]
  2. Now I'm getting this error: [code]Parse error: syntax error, unexpected T_ELSE in /home/pc72/public_html/smash/Test.php on line 73 [/code]
  3. Okay, here's my code(I've got 2 checkboxes, type1 and type2): [code] function checkType($type) { if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE) { $type = "1"; return $type; } else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE) { $type = "2"; return $type; } else { $type= "3"; return $type; } } [/code] 1. Is this correct assuming that checked = true and unchecked = false? 2. Would it be possible to make this code simpler by using a switch statement? How?
  4. fixed the missing ';' and still getting the error, and are you saying that i need to move the return line into the if statement?
  5. still getting this error: [quote]Parse error: syntax error, unexpected T_ELSE in /home/pc72/public_html/smash/Registration.php on line 58 [/quote]
  6. Okay, i'm not 100% sure, but I think you could pull it off using If().... elseif().... elseif().... else()
  7. You and I are both in the same boat, and I think the solution lies within either the Case or Switch functions, I'm going to look and see if w3schools.com has some reference to this, so I'll let you know if I find anything.
  8. use %'s as wildcard characters around and between the search criteria
  9. I keep getting errors like unexpected T_Else from this script, and i'm not sure how to use case or switch statements with php... can someone please help me sort this error out? thanks in advance. [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>GSmash Tournament registration</title> </head> <body> <?php // Check to make sure that the user isnt spamming people via the form: function spamcheck($field) { if(eregi("to:",$field) || eregi("cc:",$field)) { return TRUE; } else { return FALSE; } } function checkType($type) { if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE) { $type = "1"; } else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE) { $type = "2"; } else { $type= "3"; } return $type; } //Make sure the form is filled out: if(isset($_REQUEST['email'])); { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==TRUE) { echo "Sorry, the e-mail you have entered is invalid, please re-enter it."; } else { //send email if the e-mail is valid $email = $_REQUEST['email']; $subject = "Smash Entry For: " . $_REQUEST['name']; $message = $_REQUEST['sname'] . ", " . $_REQUEST['char'] . ", " . checkType($type); mail("Linkmaster424@aol.com", "Subject: $subject", $message, "From: $email" ); echo "Thanks for your entry!Your data will be sent to the tournament staff."; } } else { echo "<h1 align='center'>Glenwood SSBM Tournament Form</h1><hr /><br /><h3 align='center'>Fill out the form and click the &quot;Send&quot; button.</h3>" echo "<form method='post' action='ssbm.php'> Email: <input type='text' name='email' /><br /> Name: <input type='text' name='name' /><br /> Smash Name: <input type='text' name='sname' max=4 min=1 size=16><br /> Character: <input type='text' name='char' /><br /> Entry Type(select at least one):<br /> One on One:<input type='checkbox' name='type1'><br /> Teams:<input type='checkbox' name='type2'><br /> </form>"; echo "<p><em>Note: In order to join the tournament, you will be required to pay an entry fee of &nbsp; &nbsp; $5.00 upon entry. &nbsp;This is mandatory for both teams and singles, meaning that if you are on a team, &nbsp;you AND your partner will need to pay the entry fee, totalling ten dollars. &nbsp;The same goes if you &nbsp;were to enter in both tournaments, you would have to pay a fee of ten dollars(five for each &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tournament).</em></p><br /><p><font size='2'>&copy;2006 By Tristan Nolan.</font></p>" } ?> </body> </html> [/code]
  10. i'm getting this error lately too on one of my scripts, i'm pretty sure that it means you have more than 1 else { } statement in an if statement
  11. Place a table sort of like this: --------------------------- |_______[sup][u]Header[/u][/sup]_________| | M|                              | | E|          Content          | | N|                              | | U|                              | |  |____________________ |_______[u][sup]Footer[/sup][/u]__________| And use either: [code]<?php include('example.php'); ?>[/code] OR [code]<?php require('example.php'); ?>[/code] to put the pages into those areas. the require() statement is better, because if an error occurs, it stops loading that page, instead of loading a faulty page.
  12. Okay, I need to get my registration form to allow a user to register only ONCE per IP address using $_SERVER['REMOTE_ADDR'] to get the IP, and a mysql db to get their form data. I'd like it to log this data into the db $ip $name $sname $email $char $type I dont think any of these fields require hashing. Also, would it be possible to make it so that it would ONLY log them as registered if the form is filled out?(possibly with the isset[] function) here's my script: [code] function spamcheck($field) { if(eregi("to:",$field) || eregi("cc:",$field)) { return TRUE; } else { return FALSE; } } function checkType($type) { if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE) { $type = "1"; } else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE) { $type = "2"; } else { $type= "3"; } return $type; } //Make sure the form is filled out: if(isset($_REQUEST['email'])); { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==TRUE) { echo "Sorry, the e-mail you have entered is invalid, please re-enter it."; } else { //send email if the e-mail is valid $email = $_REQUEST['email']; $subject = "Smash Entry For: " . $_REQUEST['name']; $message = $_REQUEST['sname'] . ", " . $_REQUEST['char'] . ", " . checkType($type); mail("Linkmaster424@aol.com", "Subject: $subject", $message, "From: $email" ); echo "Thanks for your entry!Your data will be sent to the tournament staff."; } } else {                 echo "<form method='post' action='ssbm.php'> Email: <input type='text' name='email' /><br /> Name: <input type='text' name='name' /><br /> Smash Name: <input type='text' name='sname' max=4 min=1 size=16><br /> Character: <input type='text' name='char' /><br /> Entry Type(select at least one):<br /> One on One:<input type='checkbox' name='type1'><br /> Teams:<input type='checkbox' name='type2'><br /> </form>";               } ?> [/code]
  13. check out [url=http://www.w3schools.com]http://www.w3schools.com[/url]. they've got easy-to-understand tutorials on almost every web design language.
  14. I dont think the script would be that long, but what I need it to do is, when the user registers his/her info, and mails it via form mail, I want a cookie to be set, and say cookie = 1(true) then it will not allow the user to use the form again. also, is there any way that I can get the script to recognize if cookies are enabled on the user's computer? Here's the form mail script that i'm using: [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>GSmash Tournament registration</title> </head> <body> <?php // Check to make sure that the user isnt spamming people via the form: function spamcheck($field) { if(eregi("to:",$field) || eregi("cc:",$field)) { return TRUE; } else { return FALSE; } } function checkType($type) { if($_REQUEST['type1'] == TRUE AND $_REQUEST['type2'] == FALSE) { $type = "1"; } else if($_REQUEST['type1'] == FALSE and $REQUEST['type2'] == TRUE) { $type = "2"; } else { $type= "3"; } return $type; } //Make sure the form is filled out: if(isset($_REQUEST['email'])); { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==TRUE) { echo "Sorry, the e-mail you have entered is invalid, please re-enter it."; } else { //send email if the e-mail is valid $email = $_REQUEST['email']; $subject = "Smash Entry For: " . $_REQUEST['name']; $message = $_REQUEST['sname'] . ", " . $_REQUEST['char'] . ", " . checkType($type); mail("Linkmaster424@aol.com", "Subject: $subject", $message, "From: $email" ); echo "Thanks for your entry!Your data will be sent to the tournament staff."; } } else { echo "<h1 align='center'>Glenwood SSBM Tournament Form</h1><hr /><br /><h3 align='center'>Fill out the form and click the &quot;Send&quot; button.</h3>" echo "<form method='post' action='ssbm.php'> Email: <input type='text' name='email' /><br /> Name: <input type='text' name='name' /><br /> Smash Name: <input type='text' name='sname' max=4 min=1 size=16><br /> Character: <input type='text' name='char' /><br /> Entry Type(select at least one):<br /> One on One:<input type='checkbox' name='type1'><br /> Teams:<input type='checkbox' name='type2'><br /> </form>"; echo "<p><em>Note: In order to join the tournament, you will be required to pay an entry fee of &nbsp; &nbsp; $5.00 upon entry. &nbsp;This is mandatory for both teams and singles, meaning that if you are on a team, &nbsp;you AND your partner will need to pay the entry fee, totalling ten dollars. &nbsp;The same goes if you &nbsp;were to enter in both tournaments, you would have to pay a fee of ten dollars(five for each &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tournament).</em></p><br /><p><font size='2'>&copy;2006 By Tristan Nolan.</font></p>" } ?> </body> </html> [/code]
  15. you could use a variable with a boolean(true/false) value, so that if it's not paid for, say $paid = false,  you restrict the page by checking the value of $paid when the page loads, if false then redirect, otherwhise let them continue.
  16. up for some reason i'm still getting errors when i try to run this page, and i kinda need this done soon, so plzzzzz help.
  17. Here's the form/script that i'm using, but it wont work, please help me with this if you could. [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php //Start Script // Check to make sure that the user isnt spamming people via the form: function spamcheck($field) { if(eregi("to:",$field) || eregi("cc:",$field))   {     return TRUE;     }   else     {     return FALSE;   } } function checkType($type) { if($_REQUEST['type1'] = TRUE AND $_REQUEST['type2'] = FALSE) { $type = "1" } else if($_REQUEST['type1'] = FALSE and $REQUEST['type2'] = TRUE) { $type = "2" } else { $type= "3" } return $type; } //Make sure the form is filled out: if(isset($_REQUEST['email'])); { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==TRUE)   {   echo "Sorry, the e-mail you have entered is invalid, please re-enter it.";   } else {   //send email if the e-mail is valid   $email = $_REQUEST['email'];   $subject = "Smash Entry For: " . $_REQUEST['name'];   $message = $_REQUEST['sname'] . ", " . $_REQUEST['char'] . ", " . checkType($type);   mail("Linkmaster424@aol.com", "Subject: $subject",   $message, "From: $email" );   echo "Thanks for your entry!Your data will be sent to the tournament staff.";   } } else { echo "<h1 align='center'>Glenwood SSBM Tournament Form</h1><hr /><br /><h3 align='center'>Fill out the form and click the &quot;Send&quot; button.</h3>" echo "<form method='post' action='ssbm.php'> Email: <input type='text' name='email' /><br /> Name: <input type='text' name='name' /><br /> Smash Name: <input type='text' name='sname' max=4 min=1 size=16><br /> Character: <input type='text' name='char' /><br /> Entry Type(select at least one):<br /> One on One:<input type='checkbox' name='type1'><br /> Teams:<input type='checkbox' name='type2'><br /> </form>"; echo "<p><em>Note: In order to join the tournament, you will be required to pay an entry fee of    $5.00 upon entry.  This is mandatory for both teams and singles, meaning that if you are on a team,  you AND your partner will need to pay the entry fee, totalling ten dollars.  The same goes if you  were to enter in both tournaments, you would have to pay a fee of ten dollars(five for each            tournament).</em></p><br /><p><font size='2'>&copy;2006 By Tristan Nolan.</font></p>" } //End } ?> </body> </html> [/code]
×
×
  • 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.