Guest User

Untitled

a guest
May 2nd, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.07 KB | None | 0 0
  1. <?php
  2.  
  3. // if form is submitted
  4. if($_POST['submit']) {
  5. // if you are using these values to add into a database as well, you may want some more security!
  6. foreach($_POST as $key => $value) {
  7. $$key = htmlspecialchars($value);
  8. }
  9. $sender = "From: Customer Relations <customer.relations@whatever.com>";
  10.  
  11. // required fields
  12. if($fullName != '' && $email != '' && $address1 != '' && $city != '' && $state != '' && $zip != '' && $education != '' && ($areyou18 != '' || $areyou18 == 1) && $interested != '' && $college != '' && $interests != '' && $familydescribe != '' && $eventexperience != '' && $resume != ''){
  13. $message_body .= $fullName . ' <' . $email . '> ' . ' submitted the following: ' . "\r\n";
  14. $message_body .= 'Address: '. "\r\n" . $address1 . "\r\n" . $city . ", " . $state . " " . $zip . "\r\n\r\n";
  15. $message_body .= 'Phone Number: '. $phone . "\r\n";
  16. $message_body .= 'Education: '. $education . "\r\n";
  17. $message_body .= 'Why are you interested in joining the whatever A:Team? '. $interested . "\r\n\r\n";
  18. $message_body .= 'Are you currently attending college or a university? '. $college . "\r\n";
  19. $message_body .= 'What are your interests and activities? '. $interests . "\r\n\r\n";
  20. $message_body .= 'How would your family and friends describe you? '. $familydescribe . "\r\n\r\n";
  21. $message_body .= 'Do you have any previous event marketing experience? '. $eventexperience . "\r\n\r\n";
  22. $message_body .= 'Resume: ' . "\r\n" . $resume . "\r\n\r\n";
  23.  
  24.  
  25. $con2 = mysql_connect("localhost:3306","chachacms","@chacha");
  26. $fullName = mysql_real_escape_string(htmlspecialchars($fullName));
  27. $email = mysql_real_escape_string(htmlspecialchars($email));
  28. $address1 = mysql_real_escape_string(htmlspecialchars($address1));
  29. $city = mysql_real_escape_string(htmlspecialchars($city));
  30. $state = mysql_real_escape_string(htmlspecialchars($state));
  31. $zip = mysql_real_escape_string(htmlspecialchars($zip));
  32. $education = mysql_real_escape_string(htmlspecialchars($education));
  33. $interested = mysql_real_escape_string(htmlspecialchars($interested));
  34. $college = mysql_real_escape_string(htmlspecialchars($college));
  35. $interested = mysql_real_escape_string(htmlspecialchars($interested));
  36. $interests = mysql_real_escape_string(htmlspecialchars($interests));
  37. $familydescribe = mysql_real_escape_string(htmlspecialchars($familydescribe));
  38. $eventExperience = mysql_real_escape_string(htmlspecialchars($eventexperience));
  39. $resume = mysql_real_escape_string(htmlspecialchars($resume));
  40. if (!$con2) {
  41. die('Could not connect: ' . mysql_error());
  42. }
  43.  
  44. mysql_select_db("ateam_apply", $con2);
  45.  
  46. mysql_query("INSERT INTO applicant (fullName, address1, city, state, zip, email, phone, education, college, interested, interests, familydescribe, eventexperience, resume, areyou18)
  47. VALUES ('$fullName', '$address1', '$city', '$state', '$zip', '$email', '$phone', '$education', '$college', '$interestedFormat', '$interests', '$familydescribeFormat', '$eventexperienceFormat', '$resumeFormat', $areyou18)") or die(mysql_error());
  48.  
  49. mysql_close($con2);
  50.  
  51. // send mail
  52. mail('bryank@whatever.com', 'A:Team Signup', stripslashes($message_body), $sender);
  53. $msg = '<p class="success">Thank you. We have received your submission.</p>';
  54.  
  55. } else {
  56.  
  57. $error = '<p class="errorLarge">All Fields are Required. Please make sure all fields are filled in.</p>';
  58. }
  59.  
  60. if(isset($msg)) {
  61. echo $msg;
  62. } else {
  63. if(isset($error)) {
  64. echo $error;
  65. }
  66. }
  67. } else {
  68. $bodycontent = '
  69. <script type="text/javascript">
  70. $(document).ready(function(){
  71.  
  72. $("#teamSignupForm").submit(function() {
  73.  
  74. var error = 0;
  75. var fullName = $("#fullName");
  76. var address1 = $("#address1");
  77. var city = $("#city");
  78. var state = $("#state");
  79. var zip = $("#zip");
  80. var email = $("#email");
  81. var phone = $("#phone");
  82. var education = $("#education");
  83. var areyou18 = $("#areyou18");
  84. var interested = $("#interested");
  85. var college = $("#college");
  86. var interests = $("#interests");
  87. var familydescribe = $("#familydescribe");
  88. var eventexperience = $("#eventexperience");
  89. var resume = $("#resume");
  90. $(".ateamError").removeClass();
  91. $("#errorMessage").hide();
  92.  
  93. //var errorText = function(msg) { return '<span class="ateamError">' + msg + '</span>' };
  94. var checkField = function(obj, regex) {
  95. if (regex ? !regex.test(obj.val()) : (obj.val() == '')) {
  96. error = 1;
  97. obj.parent().find("label").addClass("ateamError");
  98. $("#errorMessage").css("display", "inline").addClass("ateamError");
  99. if (areyou18.val() != 1) {
  100. error = 1;
  101. $("#not18").addClass("ateamError").text("You must be at least 18 to apply");
  102. } else {
  103. $("#not18").removeClass("ateamError");
  104. }
  105. }
  106. };
  107.  
  108. checkField(fullName);
  109. checkField(address1);
  110. checkField(city);
  111. checkField(state);
  112. checkField(zip);
  113. checkField(email, /[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+[.][A-Za-z]{2,4}/);
  114. checkField(phone);
  115. checkField(education);
  116. checkField(interested);
  117. checkField(college);
  118. checkField(interests);
  119. checkField(familydescribe);
  120. checkField(eventexperience);
  121. checkField(resume);
  122. checkField(areyou18);
  123.  
  124. if (error == 0) {
  125. return true;
  126. } else {
  127. return false;
  128. }
  129. });
  130.  
  131. });
  132. </script>
  133. <div id="ateamForm">
  134. <h2>A:Team Signup</h2>
  135. <p class="error">* All Fields Required!</p>
  136. <form id="teamSignupForm" method="post" onsubmit="return checkWTL();">
  137. <input type="hidden" id="submitted" name="submitted" value="submitted" />
  138. <fieldset>
  139. <legend>General Information</legend>
  140. <table id="generalInformation">
  141.  
  142. <tr>
  143. <td>
  144. <label for="fullName">Name:</label><br />
  145. <input type="text" name="fullName" id="fullName" maxlength="100" value="<?php echo $fullName; ?>" />
  146. </td>
  147. <td>
  148. <label for="email">Email:</label><br />
  149. <input type="text" name="email" id="email" maxlength="50" value="<?php echo $email; ?>" />
  150. </td>
  151. <td>
  152. <label for="phone">Phone:</label><br />
  153. <input type="text" name="phone" id="phone" maxlength="12" value="<?php echo $phone; ?>" />
  154. </td>
  155. </tr>
  156. <tr>
  157. <td colspan="3">
  158. <label for="address1">Address:</label><br />
  159. <input type="text" name="address1" maxlength="100" id="address1" value="<?php echo $address1; ?>" />
  160. </td>
  161. </tr>
  162. <tr>
  163. <td>
  164. <label for="city">City:</label><br />
  165. <input type="text" name="city" maxlength="50" id="city" value="<?php echo $city; ?>" />
  166. </td>
  167. <td>
  168. <label for="state">State</label><br />
  169. <select name="state" id="state">
  170. <option value="" selected="selected">Select a State</option>
  171. <option value="AL">Alabama</option>
  172. <option value="AK">Alaska</option>
  173. <option value="AZ">Arizona</option>
  174. <option value="AR">Arkansas</option>
  175. <option value="CA">California</option>
  176. <option value="CO">Colorado</option>
  177. <option value="CT">Connecticut</option>
  178. <option value="DE">Delaware</option>
  179. <option value="DC">District Of Columbia</option>
  180. <option value="FL">Florida</option>
  181. <option value="GA">Georgia</option>
  182. <option value="HI">Hawaii</option>
  183. <option value="ID">Idaho</option>
  184. <option value="IL">Illinois</option>
  185. <option value="IN">Indiana</option>
  186. <option value="IA">Iowa</option>
  187. <option value="KS">Kansas</option>
  188. <option value="KY">Kentucky</option>
  189. <option value="LA">Louisiana</option>
  190. <option value="ME">Maine</option>
  191. <option value="MD">Maryland</option>
  192. <option value="MA">Massachusetts</option>
  193. <option value="MI">Michigan</option>
  194. <option value="MN">Minnesota</option>
  195. <option value="MS">Mississippi</option>
  196. <option value="MO">Missouri</option>
  197. <option value="MT">Montana</option>
  198. <option value="NE">Nebraska</option>
  199. <option value="NV">Nevada</option>
  200. <option value="NH">New Hampshire</option>
  201. <option value="NJ">New Jersey</option>
  202. <option value="NM">New Mexico</option>
  203. <option value="NY">New York</option>
  204. <option value="NC">North Carolina</option>
  205. <option value="ND">North Dakota</option>
  206. <option value="OH">Ohio</option>
  207. <option value="OK">Oklahoma</option>
  208. <option value="OR">Oregon</option>
  209. <option value="PA">Pennsylvania</option>
  210. <option value="RI">Rhode Island</option>
  211. <option value="SC">South Carolina</option>
  212. <option value="SD">South Dakota</option>
  213. <option value="TN">Tennessee</option>
  214. <option value="TX">Texas</option>
  215. <option value="UT">Utah</option>
  216. <option value="VT">Vermont</option>
  217. <option value="VA">Virginia</option>
  218. <option value="WA">Washington</option>
  219. <option value="WV">West Virginia</option>
  220. <option value="WI">Wisconsin</option>
  221. <option value="WY">Wyoming</option>
  222. </select>
  223. </td>
  224. <td>
  225. <label for="zip">Zip:</label><br />
  226. <input type="text" name="zip" maxlength="15" id="zip" style="width: 90px;" value="<?php echo $zip; ?>" />
  227. </td>
  228. </tr>
  229. <tr>
  230. <td colspan="3">
  231. <label for="education">Education Level:</label><br />
  232. <select name="education" id="education">
  233. <option value="">Choose One</option>
  234. <option value="High School">High School</option>
  235. <option value="Some College">Some College</option>
  236. <option value="Associates Degree">Associates Degree</option>
  237. <option value="Bachelors Degree">Bachelors Degree</option>
  238. <option value="Bachelors Degree">Masters Degree</option>
  239. </select>
  240. </td>
  241. </tr>
  242. </table>
  243. </fieldset>
  244. <fieldset>
  245. <legend>Personal Information</legend>
  246.  
  247. <p>
  248. <label for="interested">Why are you interested in joining the ChaCha A:Team?</label>
  249. <br />
  250. <textarea name="interested" id="interested" maxlength="255" style="width: 300px; height: 100px;"><?php echo $interested; ?></textarea>
  251. </p>
  252.  
  253. <p>
  254. <label for="college">Are you currently attending college or a university?</label>
  255. <br />
  256. <input type="text" name="college" maxlength="255" style="width: 300px;" id="college" value="<?php echo $college; ?>" />
  257. </p>
  258.  
  259. <p>
  260. <label for="interests">What are your interests and activities?</label>
  261. <br />
  262. <input type="text" name="interests" maxlength="255" style="width: 300px;" id="interests" value="<?php echo $interests; ?>" /><br />
  263. <small>(separate with commas)</small>
  264. </p>
  265.  
  266. <p>
  267. <label for="describe">How would your family and friends describe you?</label>
  268. <br />
  269. <textarea name="familydescribe" style="width: 300px; height: 100px;" id="familydescribe"><?php echo $familydescribe; ?></textarea>
  270. </p>
  271. <p>
  272. <label for="eventexperience">Do you have any previous event marketing experience?</label>
  273. <br />
  274. <textarea name="eventexperience" style="width: 300px; height: 100px;" id="eventexperience"><?php echo $eventexperience; ?></textarea>
  275. </p>
  276.  
  277. <p>
  278. <label for="resume">Paste your Resume in this box</label>
  279. <br />
  280. <textarea name="resume" style="width: 500px; height: 300px;" id="resume"><?php echo $resume; ?></textarea>
  281. </p>
  282. <!--<p> Check this box to verify you
  283. <input type="checkbox" value="1" name="checkmeImreal" id="checkmeImreal" />
  284. </p>-->
  285. <p>
  286. <label for="areyou18" id="not18">You must be 18 to apply. Are you?</label><br />
  287. <select name="areyou18" id="areyou18">
  288. <option value="">Choose</option>
  289. <option value="1">Yes</option>
  290. <option value="0">No</option>
  291. </select>
  292. </p>
  293. <p class="formField">
  294. <input type="submit" name="submit" value="Send" id="submitForm" class="submit" /> <span class="ateamError" id="errorMessage" style="display: none;">Please review the errors above</span>
  295. </p>
  296. </fieldset>
  297. </form>
  298. </div>'; } // End else here
  299. ?>
  300.  
  301. <html><head></head><body><?php echo $bodycontent; ?></body></html>
Add Comment
Please, Sign In to add comment