Jump to content


Can someone help get me started with this script?

  • Please log in to reply
1 reply to this topic

#1 Design

  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts
  • LocationThe Computer Chair

Posted 21 October 2006 - 03:37 PM

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:
<!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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>GSmash Tournament registration</title>
// 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;
		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";
		$type= "3";
	return $type;
	//Make sure the form is filled out:
		//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.";
				//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.";
		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 />
		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>"

#2 Psycho

  • Moderators
  • Move along, nothing to see here
  • 11,892 posts
  • LocationCanada

Posted 21 October 2006 - 07:31 PM

if ($_COOKIE['registered']) {
  echo "You have already registered";
} else {
   //Show registration form
  if (registration successful) {
    setcookie("registered", 1);

The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users