Jump to content


Photo

Need some help.


  • Please log in to reply
8 replies to this topic

#1 Toggles

Toggles
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 September 2006 - 02:10 AM

Hello, I'm making a website for my CS clan and I want to make an application page.  My friend told me that requires php.  I want people fill in there information, like Name, In-Game Name, Years Playing, Time Playing in server, and Why you want to join.  So after they fill that in, I would like to it e-mail me and 3 other.  First question is, is that possible to have it e-mail more than one person?  And second, if it is possible could I get some help setting it up?

Thanks in advance

Toggles

#2 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 September 2006 - 02:20 AM

Try something like this:

<?
if (isset($_POST['submit'])) {
	// BEGIN - Make the inputs safe
	$_POST['name'] = preg_replace('|[^a-zA-Z]|', '', $_POST['name']);
	$_POST['age'] = preg_replace('|[^0-9]|', '', $_POST['age']);
	$_POST['email'] = preg_replace('|[^a-zA-Z0-9.@]|', '', $_POST['email']);
	
	// Run some checks
	if (empty($_POST['name'])) {
		echo "Sorry, but you cannot leave your name blank";
	} else if (empty($_POST['age'])) {
		echo "sorry, but you cannot leave your age blank";
	} else if (empty($_POST['email'])) {
		echo "Sorry, but you cannot leave your e-mail blank";
	} else if (strpos($_POST['email'], "@") === FALSE || strpos($_POST['email'], ".") === FALSE) {
		echo "Sorry, but you must enter a valid e-mail.";
	} else {
		// Notify the user that they have applied
		echo "You have successfully applied to our clan, thank you.";
		
		// Send notification to the clan leaders
		$subject = "YOUR CLAN NAME: Player Application";
		$message = "Dear Clan leader,<br />You have just had a new player apply to your clan with the following information:
					<br /><b>Name:</b> ".$_POST['name']."
					<br /><b>Age:</b> ".$_POST['age']."
					<br /><b>E-Mail:</b> ".$_POST['email'];
		
		$headers  = 'MIME-Version: 1.0'."\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
		$headers .= "From: mail@YOURDOMAIN.com";
		mail("email1@YOURDOMAIN.com, email2@YOURDOMAIN.com, email3@YOURDOMAIN.com", $subject, $message, $headers);
	}
} else {
?>
	<form action="<?= $_SERVER['PHP_SELF']; ?>" method="post" name="apply">
		<input name="name" type="text" />
		<input name="age" type="text" />
		<input name="email" type="text" />
		<input name="submit" type="submit" value="Submit" />
	</form>
<?
}
?>

Avid PHP Developer, need some work done? Send a PM ;)

#3 Toggles

Toggles
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 September 2006 - 02:21 AM

Thank you, I was reading a little about PHP and do I have to have an SQL database?  And where do I add that text?  I put it in the coding, and it just came up like text on the page.

#4 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 September 2006 - 02:23 AM

Nope 8) - You don't need mySQL for this.

EDIT: You need to make a new page named something like, 'apply.php' and put the information in that page.

If you've done that and you are still only seeing a bunch of text, that means your server doesn't have PHP installed.
Avid PHP Developer, need some work done? Send a PM ;)

#5 Toggles

Toggles
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 September 2006 - 02:29 AM

How would I get my current template on that page?  I was to lazy to make one, so I downloaded one for now until I get more time to make one.

*Edit* Nevermind figured out how, just saved that template as a .php and added that text, I openned it in my browser and got this.

Posted Image

#6 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 September 2006 - 02:37 AM

You need to change the e-mails to real e-mails, edit the following text snippets.
E-Mail that it comes from:
From: mail@YOURDOMAIN.com

E-Mail to send to:
email1@YOURDOMAIN.com
email2@YOURDOMAIN.com
email3@YOURDOMAIN.com

Forgot to mention, your server (PHP) also needs to support the mail() function.
Avid PHP Developer, need some work done? Send a PM ;)

#7 Toggles

Toggles
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 September 2006 - 02:40 AM

So for the From e-mail, I need to make an account that will sent it from?

#8 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 08 September 2006 - 02:44 AM

Usually you can use the default one set on your server, such as mail@YOURDOMAIN.com, just change the yourdomain.com part.
Avid PHP Developer, need some work done? Send a PM ;)

#9 Toggles

Toggles
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 08 September 2006 - 02:48 AM

Ok, thanks a lot for your help, I really appreciate it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users