PageRenderTime 51ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/misc/referafriend_form.php

https://github.com/jamesming/stage_beta
PHP | 284 lines | 267 code | 13 blank | 4 comment | 5 complexity | e001b24e94a210ea978e38f1bb2e859c MD5 | raw file
  1. <link type="text/css" rel="stylesheet" media="all" href="style.css" />
  2. <style type="text/css">
  3. label {display:block;margin:2px;font-weight:bold;}
  4. .form {padding:0px;margin:0px; color: #FFFFFF;}
  5. .form li {width:300px;height:25px;margin:3px;padding:5px 5px 5px 30px;list-style:none;position:relative;}
  6. *html .form li {left:-15px;}
  7. .form li img {position:absolute;left:5px;}
  8. .form .error {border:1px solid #A90000;background-color:#F8E5E5;}
  9. .form .success {border:1px solid #74F019;background-color:#DEF8CA;}
  10. .form .selected {border:1px solid #1AA8E1;background-color:#8DD8F7;}
  11. #login_table .pad {padding:15px;}
  12. .form input {width:180px; border-radius: 0 10px 0 10px;}
  13. </style>
  14. <script type="text/javascript" src="jquery.js"></script>
  15. <script type="text/javascript" src="val.js"></script>
  16. <script>
  17. var passed = 0;
  18. </script>
  19. <?
  20. if($_POST['action'] == 'Submit') {
  21. //print_r($_POST);
  22. //echo "INSERT INTO custom_refer_friend VALUES ('', '$_POST[fname]', '$_POST[lname]', '$_POST[addr]', '$_POST[addr2]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[email]', '$_POST[email1]', '$_POST[email2]', '$_POST[email3]', '$_POST[email4]', '$_POST[email5]', '$_POST[shirt_size]', '$_POST[shirt_style]', '$_POST[newsletter]') ";
  23. $success = mysql_query("INSERT INTO custom_refer_friend VALUES ('', '$_POST[fname]', '$_POST[lname]', '$_POST[addr]', '$_POST[addr2]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[email]', '$_POST[email1]', '$_POST[email2]', '$_POST[email3]', '$_POST[email4]', '$_POST[email5]', '$_POST[shirt_size]', '$_POST[shirt_style]', '$_POST[newsletter]') ");
  24. //$id = mysql_insert_id();
  25. if($success) {
  26. $to = $_POST[email];
  27. $subject = 'Model Latina T-Shirt Giveaway';
  28. $message = '
  29. +++++++++++++++++++++++++++++++++
  30. <br />
  31. <br />
  32. Thank you for sharing the video. Once we\'ve validated the email addresses you\'ve provided, your T-Shirt will be sent.
  33. <br />
  34. <br />
  35. Best regards,
  36. <br />
  37. <br />
  38. The nuvoTV Digital Team
  39. <br />
  40. <br />
  41. +++++++++++++++++++++++++++++++++++
  42. ';
  43. $headers = 'MIME-Version: 1.0' . "\n";
  44. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
  45. $headers .= 'From: nuvoTV <no-reply@mynuvotv.com>';
  46. mail($to, $subject, $message, $headers);
  47. }
  48. ?>
  49. <div class="page_middle_login" style="padding-left: 0px; border: 1px solid white; width: 490px; padding-bottom: 80px;">
  50. <img src="images/form-title.jpg" width="490" />
  51. <div class="page_middle_register" style="padding: 10px; color: white; height: 100px;" >
  52. <div style="float: left; margin-bottom: 10px; padding: 5px;" >
  53. +++++++++++++++++++++++++++++++++
  54. <br />
  55. <br />
  56. Thank you for sharing the video. Once we've validated the email addresses you've provided, your T-Shirt will be sent.
  57. <br />
  58. <br />
  59. Best regards,
  60. <br />
  61. <br />
  62. The nuvoTV Digital Team
  63. <br />
  64. <br />
  65. +++++++++++++++++++++++++++++++++++
  66. </div>
  67. </div>
  68. <?
  69. } else {
  70. ?>
  71. <div class="page_middle_login" style="padding-left: 0px; border: 1px solid white; width: 490px; padding-bottom: 80px;">
  72. <img src="images/form-title.jpg" width="490" />
  73. <div class="page_middle_register" style="padding: 10px; color: white;" >
  74. <div style="float: left; margin-bottom: 10px; padding: 5px;" >
  75. The first 200 people to share our video with five of their friends get this free super sexy Model Latina T-shirt.*
  76. </div>
  77. <img src="images/step1.jpg" width="480" />
  78. <form name="registration" id="registration" method="post" action="referafriend.php">
  79. <ul class="form">
  80. <li class="validated" id="fname_li" style="float: left; width: 400px;">
  81. <label for="fname" style="float: left;">First Name: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  82. <input class="validated" type="text" name="fname" id="fname" style="float: right;" />
  83. <div id="fname_msg"></div>
  84. </li>
  85. <li class="validated" id="lname_li" style="float: left; width: 400px;">
  86. <label for="lname" style="float: left;">Last Name: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  87. <input type="text" name="lname" id="lname" style="float: right;" />
  88. <div id="lname_msg"></div>
  89. </li>
  90. <li class="validated" id="addr_li" style="float: left; width: 400px;">
  91. <label for="addr" style="float: left;">Address: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  92. <input type="text" name="addr" id="addr" style="float: right;" />
  93. <div id="addr_msg"></div>
  94. </li>
  95. <li class="validated" id="addr2_li" style="float: left; width: 400px;">
  96. <label for="addr2" style="float: left;">Address 2:</label>
  97. <input type="text" name="addr2" id="addr2" style="float: right;" />
  98. <div id="addr2_msg"></div>
  99. </li>
  100. <li class="validated" id="city_li" style="float: left; width: 400px;">
  101. <label for="city" style="float: left;">City: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  102. <input type="text" name="city" id="city" style="float: right;" />
  103. <div id="city_msg"></div>
  104. </li>
  105. <li class="validated" id="state_li" style="float: left; width: 400px;">
  106. <label for="state" style="float: left;">State: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  107. <input type="text" name="state" id="state" style="float: right;" />
  108. <div id="state_msg"></div>
  109. </li>
  110. <li class="validated" id="zip_li" style="float: left; width: 400px;">
  111. <label for="zip" style="float: left;">Zip Code: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  112. <input type="text" name="zip" id="zip" style="float: right;" />
  113. <div id="zip_msg"></div>
  114. </li>
  115. <li class="validated" id="email_li" style="float: left; width: 400px;">
  116. <label for="email" style="float: left;">Email: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  117. <input type="email" name="email" id="email" size="26" style="float: right;" />
  118. <div id="email_msg"></div>
  119. </li>
  120. <img src="images/step2.jpg" width="480" style="margin-top: 10px;" />
  121. <li class="validated" id="email1_li" style="float: left; width: 400px;">
  122. <label for="email1" style="float: left;">Email 1: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  123. <input type="text" name="email1" id="email1" style="float: right;" />
  124. <div id="email1_msg"></div>
  125. </li>
  126. <li class="validated" id="email2_li" style="float: left; width: 400px;">
  127. <label for="email2" style="float: left;">Email 2: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  128. <input type="text" name="email2" id="email2" style="float: right;" />
  129. <div id="email2_msg"></div>
  130. </li>
  131. <li class="validated" id="email3_li" style="float: left; width: 400px;">
  132. <label for="email3" style="float: left;">Email 3: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  133. <input type="text" name="email3" id="email3" style="float: right;" />
  134. <div id="email3_msg"></div>
  135. </li>
  136. <li class="validated" id="email4_li" style="float: left; width: 400px;">
  137. <label for="email4" style="float: left;">Email 4: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  138. <input type="text" name="email4" id="email4" style="float: right;" />
  139. <div id="email4_msg"></div>
  140. </li>
  141. <li class="validated" id="email5_li" style="float: left; width: 400px;">
  142. <label for="email5" style="float: left;">Email 5: <span style="font-weight: normal; color: white; font-size: 13px; margin-left: 5px;">(*required)</span></label>
  143. <input type="text" name="email5" id="email5" style="float: right;" />
  144. <div id="email5_msg"></div>
  145. </li>
  146. <img src="images/step3.jpg" width="480" style="margin-top: 10px;" />
  147. <li class="validated" id="shirt_size_li" style="height: 40px; margin-bottom: 20px;">
  148. <label for="shirt_size">Select your T-shirt size: <span style="font-weight: normal; color: white; font-size: 13px; float: right; margin-right: 65px;">(*required)</span></label>
  149. <div id="shirt_size_img"></div>
  150. <select name="shirt_size" id="shirt_size">
  151. <option value="0" selected="selected">Select One...</option>
  152. <option value="s">Small</option>
  153. <option value="m">Medium</option>
  154. <option value="l">Large</option>
  155. <option value="xl">X-Large</option>
  156. <option value="2xl">2X-Large</option>
  157. <option value="3xl">3X-Large</option>
  158. </select>
  159. <div id="shirt_size_msg"></div>
  160. </li>
  161. <!-- <li class="validated" id="shirt_style_li">
  162. <label for="shirt_style">Choose your Shirt Style: <span style="font-weight: normal; color: white; font-size: 13px; float: right; margin-right: 65px;">(*required)</span></label>
  163. <div id="shirt_style_img"></div>
  164. <select name="shirt_style" id="shirt_style">
  165. <option value="0" selected="selected">Select One...</option>
  166. <option value="mllv">Model Latina Las Vegas</option>
  167. <option value="osmin">Operation Osmin</option>
  168. <option value="nuvo">nuvoTV: America's Nu Voice</option>
  169. </select>
  170. <div id="shirt_style_msg"></div>
  171. </li> -->
  172. <li class="validated" id="terms_li" style="height: 40px; margin-bottom: 20px;">
  173. <input type="checkbox" name="terms" id="terms" value="1" style="float: left; width: 10px; margin-right: 5px;" />
  174. <label for="terms"> &mdash; I agree to the terms. <br /><a href="/terms-of-use" style="color: white; font-size: 12px; text-decoration: underline;">Click here</a> for term details <span style="font-weight: normal; color: white; font-size: 13px; float: right; margin-right: 65px;">(*required)</span></label>
  175. <div id="terms_msg"></div>
  176. </li>
  177. <li class="validated" id="newsletter_li" style="height: 40px; margin-bottom: 20px;">
  178. <input type="checkbox" name="newsletter" id="newsletter" value="1" style="float: left; width: 10px; margin-right: 5px;" /> <span style="font-weight: normal; color: white; font-size: 13px; float: right; margin-right: 65px;">(*optional)</span>
  179. <label for="newsletter"> &mdash; Please add me to your Newsletter list.</label>
  180. <div id="newsletter_msg"></div>
  181. </li>
  182. <div style="padding-top: 10px;">
  183. <img class="login" style="width: auto; cursor: pointer;" src="images/submit.png" type="button" name="submit_but" onmousedown="var result = validateForm(); if(result == true) { document.forms['registration'].submit();}" />
  184. </div>
  185. <input type="hidden" name="action" value="Submit" />
  186. <div style="float: left; padding-top: 50px;">
  187. *Terms &amp; Conditions apply
  188. </div>
  189. <img src="images/ML_t-shirtv3.jpg" style="float: right; margin-top: -207px;" />
  190. </ul>
  191. </form>
  192. </div>
  193. <?
  194. }
  195. ?>
  196. </div>
  197. <script>
  198. function validateForm()
  199. {
  200. var fields = new Array("fname", "lname", "addr", "city", "state", "zip", "email", "email1", "email2", "email3", "email4", "email5", "shirt_size", "terms");
  201. var pass = true;
  202. var first = true;
  203. for(var i in fields) {
  204. if(fields[i] == 'fname' || fields[i] == 'lname' || fields[i] == 'addr' || fields[i] == 'city' || fields[i] == 'state' || fields[i] == 'zip' || fields[i] == 'shirt_size' || fields[i] == 'terms') {
  205. if(fields[i] == 'terms') {
  206. var x = document.getElementById(fields[i]).checked;
  207. } else {
  208. var x = document.getElementById(fields[i]).value;
  209. }
  210. var msg_id = fields[i]+"_msg";
  211. var li_id = fields[i].replace(/Field/i, "fo1li");
  212. document.getElementById(li_id).setAttribute("class", "");
  213. document.getElementById(msg_id).innerHTML = '';
  214. if (x==null || x=="" || x == 0) {
  215. var label = fields[i].replace(/Field/i, "title");
  216. var curr_class = document.getElementById(li_id).getAttribute("class");
  217. if(curr_class != " error ") {
  218. document.getElementById(li_id).setAttribute("class", " error ");
  219. if(fields[i] == 'terms') {
  220. document.getElementById(msg_id).innerHTML += '<p style="display: block; color: red;">You must agree to the terms and conditions.<br /></p>';
  221. } else if(fields[i] == 'shirt_size') {
  222. document.getElementById(msg_id).innerHTML += '<p style="display: block; color: red;">This field is required.<br /></p>';
  223. } else {
  224. document.getElementById(msg_id).innerHTML += '<p style="display: block; color: red;"><br />This field is required.<br /></p>';
  225. }
  226. }
  227. pass = false;
  228. } else {
  229. var li_id = fields[i].replace(/Field/i, "fo1li");
  230. document.getElementById(li_id).setAttribute("class", "");
  231. }
  232. } else if(fields[i] == 'email' || fields[i] == 'email1' || fields[i] == 'email2' || fields[i] == 'email3' || fields[i] == 'email4' || fields[i] == 'email5') {
  233. var x = document.getElementById(fields[i]).value;
  234. var atpos=x.indexOf("@");
  235. var dotpos=x.lastIndexOf(".");
  236. var li_id = fields[i].replace(/Field/i, "fo1li");
  237. var msg_id = fields[i]+"_msg";
  238. document.getElementById(li_id).setAttribute("class", "");
  239. document.getElementById(msg_id).innerHTML = '';
  240. if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
  241. var label = fields[i].replace(/Field/i, "title");
  242. var curr_class = document.getElementById(li_id).getAttribute("class");
  243. if(curr_class != " error ") {
  244. document.getElementById(li_id).setAttribute("class", " error ");
  245. document.getElementById(msg_id).innerHTML += '<p style="display: block; color: red;"><br />Please enter a valid e-mail address.<br /></p>';
  246. }
  247. pass = false;
  248. } else {
  249. var li_id = fields[i].replace(/Field/i, "fo1li");
  250. document.getElementById(li_id).setAttribute("class", "");
  251. }
  252. }
  253. }
  254. if(pass == false) {
  255. //document.getElementById('errorLi').style.display = 'block';
  256. //self.scrollTo(0,0);
  257. return false;
  258. } else {
  259. return true;
  260. }
  261. }
  262. </script>
  263. </body>