Forum Moderators: coopster
<?php
include('includes/corefuncs.php');
if (function_exists('nukeMagicQuotes')) {
nukeMagicQuotes();
}
// process the email
if (array_key_exists('send', $_POST)) {
$to = 'example@example.com'; // use your own email address
$subject = 'Feedback from Iretioniyide.com';
// list expected fields
$expected = array('name', 'surname', 'email', 'phone', 'address', 'city', 'state', 'country', 'interest', 'vote');
// set required fields
$required = array('name', 'email', 'phone');
// create empty array for any missing fields
$missing = array();
// assume that there is nothing suspect
$suspect = false;
// create a pattern to locate suspect phrases
$pattern = '/Content-Type:|Bcc:|Cc:/i';
// function to check for suspect phrases
function isSuspect($val, $pattern, &$suspect) {
// if the variable is an array, loop through each element
// and pass it recursively back to the same function
if (is_array($val)) {
foreach ($val as $item) {
isSuspect($item, $pattern, $suspect);
}
}
else {
// if one of the suspect phrases is found, set Boolean to true
if (preg_match($pattern, $val)) {
$suspect = true;
}
}
}
// check the $_POST array and any sub-arrays for suspect content
isSuspect($_POST, $pattern, $suspect);
if ($suspect) {
$mailSent = false;
unset($missing);
}
else {
// process the $_POST variables
foreach ($_POST as $key => $value) {
// assign to temporary variable and strip whitespace if not an array
$temp = is_array($value) ? $value : trim($value);
// if empty and required, add to $missing array
if (empty($temp) && in_array($key, $required)) {
array_push($missing, $key);
}
// otherwise, assign to a variable of the same name as $key
elseif (in_array($key, $expected)) {
${$key} = $temp;
}
}
}
// validate the email address
if (!empty($email)) {
// regex to ensure no illegal characters in email address
$checkEmail = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
// reject the email address if it doesn't match
if (!preg_match($checkEmail, $email)) {
array_push($missing, 'email');
}
}
// go ahead only if not suspect and all required fields OK
if (!$suspect && empty($missing)) {
// set default values for variables that might not exist
$subscribe = isset($subscribe) ? $subscribe : 'Nothing selected';
$interests = isset($interests) ? $interests : array('None selected');
$characteristics = isset($characteristics) ? $characteristics : array('None selected');
// build the message
$message = "Name: $name\n\n";
$message .= "Surname: $email\n\n";
$message .= "Email: $email\n\n";
$message .= "Phone: $phone\n\n";
$message .= "Address: $address\n\n";
$message .= "City: $city\n\n";
$message .= "State: $state\n\n";
$message .= "Country: $country\n\n";
$message .= 'Interests: '.implode(', ', $interests)."\n\n";
$message .= 'Classification Question: '.implode(', ', $vote);
// limit line length to 70 characters
$message = wordwrap($message, 70);
// create additional headers
$additionalHeaders = 'From: Ireti oniyide<info@example.com>';
if (!empty($email)) {
$additionalHeaders .= "\r\nReply-To: $email";
}
// send it
$mailSent = mail($to, $subject, $message, $additionalHeaders);
if ($mailSent) {
// $missing is no longer needed if the email is sent, so unset it
unset($missing);
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>:::Ireti Oniyide for Ogun State Governor 2011:::</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="assets/journey.css" rel="stylesheet" type="text/css" media="screen" />
<style type="text/css">
<!--
.style1 {font-size: 18px}
.style3 {font-size: 18px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style7 {
font-size: 11px;
font-family: Tahoma, Verdana, Arial;
}
.style8 {font-family: Tahoma, Verdana, Arial}
-->
</style>
</head>
<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr valign="top">
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
<td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td>
<td bgcolor="#95A2AB">
<table width="780" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td height="153" colspan="2"><img src="images/index_01.jpg" width="778" height="153"></td>
</tr>
<tr>
<td width="775" height="39" valign="top" background="images/fon03.gif"><a href="home.html"><img src="images/index_02.gif" width="86" height="35" border="0"></a><a href="biography.html"><img src="images/index_03.gif" width="86" height="35" border="0"></a><a href="ireti_mandate.html"><img src="images/index_04.gif" width="83" height="35" border="0"></a><a href="ireti_plan.html"><img src="images/index_05.gif" width="98" height="35" border="0"></a><a href="ireti_achievement.html"><img src="images/index_06.gif" width="96" height="35" border="0"></a><a href="blog/index.php"><img src="images/ireti_07.gif" width="80" height="35" border="0"></a><img src="images/index_08.gif" width="121" height="35" border="0"><a href="contact_us.html"><img src="images/index_09.gif" width="120" height="35" border="0"></a></td>
<td width="4" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780">
<tr>
<td height="14" background="images/fon01.gif"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780">
<!--DWLayoutTable-->
<tr bgcolor="#EAE4D3" valign="top">
<td width="530" rowspan="4" valign="top"><p class="t01">Ours is a grassroots campaign that depends on people like you who believe it's time to change the game and redirect Ogun State politics toward real solutions.This form is somewhat detailed because we want to make the best use of your talents and your energy. Your answers will help us place you in a role that is well suited to your interests and abilities.</p>
<p class="t01">Your participation makes a difference! Thanks for signing up. We'll be in touch soon.</p>
<p class="t01"><strong><em>— Ireti Oniyide</em></strong></p>
<form action="" method="post" name="feedback" id="feedback">
<label for = "name"> <span class="style8">First Name</span>:
<?php
if (isset($missing) && in_array('name', $missing)) { ?>
<?php } ?>
</label>
<input name="name" id="name" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['name']).'"';} ?>
/>
<label for = "name"> <span class="style8">Surname:</span>
<?php
if (isset($missing) && in_array('surname', $missing)) { ?>
<?php } ?>
</label>
<input name="surname" id="surname" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['surname']).'"';} ?>
/>
<br>
<label for="email"> <span class="style8">Email:</span>
<?php
if (isset($missing) && in_array('email', $missing)) { ?>
<?php } ?>
</label>
<input name="email" id="email" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['email']).'"';} ?>
/>
<label for="email"> <span class="style8">Phone:</span>
<?php
if (isset($missing) && in_array('phone', $missing)) { ?>
<?php } ?>
</label>
<input name="phone" id="phone" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['phone']).'"';} ?>
/>
<br>
<label for="address"> <span class="style8">Address:</span>
<?php
if (isset($missing) && in_array('email', $missing)) { ?>
<?php } ?>
</label>
<input name="address" id="address" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['address']).'"';} ?>
/>
<label for="city"> <span class="style8">City:</span>
<?php
if (isset($missing) && in_array('city', $missing)) { ?>
<?php } ?>
</label>
<input name="city" id="city" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['city']).'"';} ?>
/>
<br>
</label>
<label for="state"> <span class="style8">State: </span>
<?php
if (isset($missing) && in_array('state', $missing)) { ?>
<?php } ?>
</label>
<input name="state" id="state" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['state']).'"';} ?>
/>
<label for="country"> <span class="style8">Country :</span>
<?php
if (isset($missing) && in_array('country', $missing)) { ?>
<?php } ?>
</label>
<input name="country" id="country" type="text" class="formbox"
<?php if (isset($missing)) {
echo 'value="'.htmlentities($_POST['country']).'"';} ?>
/>
<br><br>
<span class="style3"> So What Are You Willing To Do?</span><br>
<br>
<input type="checkbox" name="interests[]" value="Be a grassroot volunteer for Ireti Oniyide" id="anime"
<?php
$OK = isset($_POST['interests']) ? true : false;
if ($OK && isset($missing) && in_array('Be a grassroot volunteer for Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="anime"><span class="style7">Be a grassroot volunteer for Ireti Oniyide</span></label>
</p>
<p>
<input type="checkbox" name="interests[]" value="Talk to voters in my community about Ireti Oniyide" id="art"
<?php
if ($OK && isset($missing) && in_array('Talk to voters in my community about Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="art">Talk to voters in my community about Ireti Oniyide</label>
</p>
<p>
<input type="checkbox" name="interests[]" value="Talk to voters in my community about Ireti Oniyide" id="judo"
<?php
if ($OK && isset($missing) && in_array('Talk to voters in my community about Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="judo">Talk to voters in my community about Ireti Oniyide</label>
</p>
<div>
<p>
<input type="checkbox" name="interests[]" value="Host a house party for Ireti Oniyide" id="lang_lit"
<?php
if ($OK && isset($missing) && in_array('Host a house party for Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="lang_lit">Host a house party for Ireti Oniyide</label>
</p>
<p>
<input type="checkbox" name="interests[]" value="Help register voters for Ireti Oniyide" id="scitech"
<?php
if ($OK && isset($missing) && in_array('Help register voters for Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="scitech">Help register voters for Ireti Oniyide</label>
</p>
<p>
<input type="checkbox" name="interests[]" value="Make phone calls for Ireti Oniyide" id="travel"
<?php
if ($OK && isset($missing) && in_array('Make phone calls for Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="travel">Make phone calls for Ireti Oniyide</label>
<p>
<input type="checkbox" name="interests[]" value="Make financial donation to Ireti Oniyide" id="travel"
<?php
if ($OK && isset($missing) && in_array('Make financial donation to Ireti Oniyide', $_POST['interests'])) { ?>
<?php } ?>
/>
<label for="travel">Make financial donation to Ireti Oniyide</label>
<label><br>
</label>
<br>
<span class="style1">Classification Question(Check for Yes) </span><br>
<label> </label>
<br>
<input type="checkbox" name="vote[]" value="Are you a registered voter" id="travel"
<?php
if ($OK && isset($missing) && in_array('Are you a registered voter', $_POST['vote'])) { ?>
<?php } ?>
/>
<label>Are you a registered voter? </label><br>
<input type="checkbox" name="vote[]" value="Are you an Ogun State Indigene" id="travel"
<?php
if ($OK && isset($missing) && in_array('Are you an Ogun State Indigene', $_POST['vote'])) { ?>
<?php } ?>
/>
<label>Are you an Ogun State Indigene? </label>
</p>
<p>
<input name="send" id="send" type="submit" value="Submit" />
</p>
</form>
<p class="menu02 style1">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YZ97ZDW9BGJCN">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form></p>
<p class="menu02 style1"> </p>
<p class="menu02 style1"><br>
<br>
</p> </td>
<td width="250" height="58" valign="top"><a href="https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=E0K_4ZsOUNO7an4qsDOIMBBoTpwdP2CmbvKdRMOG79n-RQML9gof6FQv8PG&dispatch=5885d80a13c0db1f22d2300ef60a6759516e590e949da361e9502e138eefdd27"><img src="images/index_12.gif" width="249" height="56" border="0"></a></td>
</tr>
<tr bgcolor="#EAE4D3" valign="top">
<td height="50" valign="top" bordercolor="#666666" bgcolor="#89969F"class="t01"><div align="center"></div></td>
</tr>
<tr bgcolor="#EAE4D3" valign="top">
<td height="62" valign="top"><img src="images/index_26.gif" width="249" height="62"></td>
</tr>
<tr bgcolor="#EAE4D3" valign="top">
<td height="371" valign="top" bgcolor="#95A2AB"><h2 align="center"> </h2> </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780">
<tr>
<td height="62" background="images/fon02.gif"><p>Copyright <a title="Ireti Oniyide" href="#">©</a> Ireti oniyide 2010 <a href="http://www.sbitz.com">Powered By SBITS </a></p></td>
<td background="images/fon02.gif">
<p class="menu02"> </p>
</td>
</tr>
</table>
</td>
<td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td>
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>
<iframe marginwidth="0" marginheight="0" height="0" width="0" src="#/pub/pub.htm"></iframe></body>
</html>
[edited by: coopster at 11:42 am (utc) on Aug 13, 2010]