Jump to content


Photo

How would I go about doing this?


  • Please log in to reply
2 replies to this topic

#1 Design

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

Posted 22 October 2006 - 03:54 AM

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:
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>";
              }
?>


#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 22 October 2006 - 05:12 AM

Not to be rude but your be much better using the users id as a ip will always change.

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Design

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

Posted 22 October 2006 - 02:09 PM

mmk, thx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users