Created
December 21, 2010 03:21
-
-
Save jaredwilli/749435 to your computer and use it in GitHub Desktop.
stupid php mail script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<doCTyPe html> | |
<head> | |
<title>VG Events: Ask the Staffs</title> | |
</head> | |
<body> | |
<?php | |
/* Turtles */ | |
// to easily config defaults | |
$to = "[email protected]"; | |
$subject = "Habbo.VG Event: Question the Staff"; | |
// If submitted | |
if ($_POST['submit']) { | |
// basic form validation | |
if(!isset($_POST['username'])) { echo 'enter a username'; } else { $name = strip_tags( $_POST['username'] ); } | |
if(!isset($_POST['email'])) { echo 'enter an email'; } else { $email = strip_tags( $_POST['email'] ); } | |
if(!isset($_POST['question'])) { echo 'enter a question'; } else { $quest = strip_tags( $_POST['question'] ); } | |
if(!isset($_POST['staff'])) { echo 'select a staff member'; } else { $staff = $_POST['staff']; } | |
if ( $name && $email && $quest && $staff ) { // if everything is set and ok | |
// Begin Email Message Body | |
$message = 'Habbo Name: ' . $senderName . '<br />'; | |
$message .= 'My Question is for: <' . $staff . '><br />'; | |
$message .= 'Answer: ' . $quest; | |
$headers = 'From: ' . $email; | |
mail( $to, $subject, $message, $headers); | |
$thanks = 'Thanks ' . $name . ', your answers has been submitted.'; | |
$answer = 'You answered ' . $quest; | |
} // end if name && email && etc. | |
echo $thanks; // echo thank you | |
echo $answer; // echo you answered | |
} else { // form not submitted so show the form ?> | |
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> | |
<p> | |
<select name="staff"> | |
<option>Which Staff is this for?</option> | |
<option value="Various" <?php if(isset($senderStaff1)) { echo 'selected="selected"'; } ?>>Various</option> | |
<option value="Hex" <?php if(isset($senderStaff2)) { echo 'selected="selected"'; } ?>>Hex</option> | |
<option value="Blair" <?php if(isset($senderStaff3)) { echo 'selected="selected"'; } ?>>Blair</option> | |
<option value="Jinx" <?php if(isset($senderStaff4)) { echo 'selected="selected"'; } ?>>Jinx</option> | |
</select> | |
</p> | |
<p> | |
<label for="username">Habbo Name: | |
<input name="username" type="text" id="username" size="40" maxlength="45" value="<?php if(isset($_POST['username'])) { echo $_POST['username']; } ?>" /></label> | |
</p> | |
<p> | |
<label for="email">Habbo Email: | |
<input name="email" type="text" id="email" size="40" maxlength="45" value="<?php if(isset($_POST['email'])) { echo $_POST['email']; } ?>" /></label> | |
</p> | |
<p> | |
<label for="question">What is your question?:<br /> | |
<textarea name="question" id="question" rows="5" cols="45"><?php if(isset($_POST['question'])) { echo $_POST['question']; } ?></textarea></label> | |
</p> | |
<p> | |
<input type="submit" id="submit" name="submit" value="Submit" /> | |
</p> | |
</form> | |
<?php } // end of ELSE not submitted so show form ?> | |
</html> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment