Guest User

Untitled

a guest
Oct 4th, 2017
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.10 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <title>Registration</title>
  5. <script language="javascript" type="text/javascript">
  6. function clearText(field)
  7. {
  8. if (field.defaultValue == field.value) field.value = '';
  9. else if (field.value == '') field.value = field.defaultValue;
  10. }
  11. </script>
  12.  
  13. </head>
  14. <body background-img="reg.jpg">
  15. <form action="recreg_post.php" method="post" onSubmit='return valid()'>
  16. <table width="600" align="center" height="400">
  17. <tr>
  18. <td colspan="2" align="center"></td>
  19. </tr>
  20. <tr bgcolor="#fffff">
  21. <td colspan="2" align="center">
  22. <font color="#ff0000" size="5"><marquee direction="right">REGISTRATION FORM FOR RECUITER</marquee></font>
  23. </td>
  24. </tr>
  25. <tr>
  26. <td align="left">
  27. <font size="4">UserName : </font>
  28. </td>
  29. <td>
  30. <input type="text" name="uname" id="uname" placeholder="Enter your Name">
  31. </td>
  32. </tr>
  33. <tr>
  34. <td align="left">
  35. <font size="4">Email Id : </font>
  36. </td>
  37. <td>
  38. <input type="text" name="email" id="email" placeholder="Enter your Mail ID">
  39. </td>
  40. </tr>
  41. <tr>
  42. <td align="left">
  43. <font size="4">Age</font>
  44. </td>
  45. <td>
  46. <input type="text" name="age" id="age" size="3" placeholder="Enter your age">
  47.  
  48. </td>
  49. </tr>
  50. <tr>
  51. <td align="left">
  52. <font size="4">Gender</font>
  53. </td>
  54. <td>
  55. <font size="3" face="Times new roman">
  56. <select name="gender">
  57. <option value="none"> Please select any one</option>
  58. <option value="M"> Male </option>
  59. <option value="F"> Female </option>
  60. <option value="O"> Others </option>
  61. </select>
  62. </font>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td align="left">
  67. <font size="4">City : </font>
  68. </td>
  69. <td>
  70. <input type="text" name="city" id="city" size="30" placeholder="Enter your Current city">
  71. </td>
  72. </tr>
  73. <tr>
  74. <td align="left">
  75. <font size="4">Mobile Number</font>
  76. </td>
  77. <td>
  78. <input type="text" name="mobile" id="mobile" size="10" placeholder="Enter your mobile number">
  79.  
  80. </td>
  81. </tr>
  82. <tr>
  83. <td align="left">
  84. <font size="4">Aadhar no : </font>
  85. </td>
  86. <td>
  87. <input type="text" name="aadhar" id="aadhar" size="15" placeholder="Enter your Aadhar card number">
  88.  
  89. </td>
  90. </tr>
  91. <tr>
  92. <td align="left">
  93. <font size="4">About Yourself : </font>
  94. </td>
  95. <td>
  96. <textarea name="about" id="about" rows="5" cols="40" placeholder="Tell us something about you"></textarea>
  97.  
  98. </td>
  99. </tr>
  100. <tr>
  101. <td align="left">
  102. <font size="4">Create Password</font>
  103. </td>
  104. <td>
  105. <input type="password" name="password" id="pass" placeholder="Enter a password">
  106.  
  107. </td>
  108. </tr>
  109. <tr>
  110. <td align="left">
  111. <font size="4">Confirm Password</font>
  112. </td>
  113. <td>
  114. <input type="password" name="cpassword" id="cpass" placeholder="Re-Enter the password">
  115.  
  116. </td>
  117. </tr>
  118. <tr>
  119. <td colspan="2" align="center"><input type="submit" value="REGISTER">
  120. <input type='reset' name="clear" value="CLEAR">
  121. </td>
  122. </tr>
  123. </table>
  124. </form>
  125. </body>
  126. </html>
  127. </table>
  128. </form>
  129. </body>
  130. </html>
  131. <script type="text/javascript">
  132.  
  133. function valid()
  134. {
  135.  
  136. var uname = document.getElementById('uname').value;
  137. var email = document.getElementById('email').value;
  138. var age = document.getElementById('age').value;
  139. //var gen = document.getElementById('gen').value;
  140. var city = document.getElementById('city').value;
  141. var mobile = document.getElementById('mobile').value;
  142. var aadhar = document.getElementById('aadhar').value;
  143. var about = document.getElementById('about').value;
  144. var pass = document.getElementById('pass').value;
  145. var cpass = document.getElementById('cpass').value;
  146.  
  147.  
  148.  
  149. //Validate UserName - Empty Check & Only 4 Characters Check
  150.  
  151. if(uname == "")
  152. {
  153. alert("First Name should not be Empty!");
  154. return false;
  155. }
  156.  
  157. var unm = /^[A-Za-z]{4,30}$/;
  158. if(!unm.test(uname))
  159. {
  160. alert("Invalid Name! Name should contain only characters and should contain a minimum of 4 characters & maximum of 30 characters");
  161.  
  162. return false;
  163. }
  164.  
  165. if(email == "")
  166. {
  167. alert("Email should not be Empty!");
  168. return false;
  169. }
  170. var atpos = email.indexOf("@"); //get the position of @ in the input email string
  171.  
  172. var dotpos = email.lastIndexOf("."); //get the position (last occurrence) of .
  173.  
  174. //Checks Min 2 chars in email name (ravi/abc12), domain name (gmail/yahoo) and domain type (.com/.net)
  175.  
  176. if (atpos < 2 || dotpos <= atpos+2 || dotpos+2 >= email.length)
  177. {
  178. alert("In-valid E-mail Address!");
  179. return false;
  180. }
  181.  
  182. //Validation of Age
  183.  
  184. if(age == "")
  185. {
  186. alert("age should not be Empty!");
  187. return false;
  188. }
  189. if ( !( age > 1 && age<100 ) )
  190. {
  191.  
  192. alert("The age must be a number between 1 and 100");
  193. return false;
  194. }
  195.  
  196.  
  197.  
  198. //Validation of City
  199.  
  200. if(city == "")
  201. {
  202. alert("city Name should not be Empty!");
  203. return false;
  204. }
  205.  
  206. var cit = /^[A-Za-z ]{2,30}$/;
  207. if(!cit.test(city))
  208. {
  209. alert("Invalid City! City should contain only characters & spaces.and should contain a minimum of 3 characters & maximum of 30 characters");
  210.  
  211. return false;
  212. }
  213.  
  214. //Validation of Mobile
  215. if(mobile == "")
  216. {
  217. alert("Mobile should not be Empty!");
  218. return false;
  219. }
  220.  
  221. var mb = /^[0-9]{10}$/; //match a value with exactly 10 digits
  222. if(!mb.test(mobile))
  223. {
  224. alert("Invalid Mobile Number! Enter a valid 10 Digit Mobile Number");
  225. return false;
  226. }
  227. //Validation of Aadhar
  228. if(aadhar == "")
  229. {
  230. alert("Aadhar Number should not be Empty!");
  231. return false;
  232. }
  233.  
  234. var adhar = /^[0-9]{12}$/; //match a value with exactly 12 digits
  235. if(!adhar.test(aadhar))
  236. {
  237. alert("Invalid Aadhar Number! Enter a valid 12 Digit Mobile Number");
  238. return false;
  239. }
  240. //Validation of about
  241. if(about == "")
  242. {
  243. alert("About field should not be Empty!");
  244. return false;
  245. }
  246.  
  247.  
  248. //Validation of password
  249. if(pass == "")
  250. {
  251. alert("Password should not be Empty!");
  252. return false;
  253. }
  254.  
  255. var pswd = /^[0-9A-Za-z@ ]{5,15}$/;
  256. if(!pswd.test(pass))
  257. {
  258. alert("Invalid Password! Password contain minimum 5 characters");
  259.  
  260. return false;
  261. }
  262.  
  263. if(pass!=cpass)
  264. {
  265. alert("given password is mismatch");
  266. return false;
  267. }
  268.  
  269.  
  270.  
  271. return true;
  272. }
  273.  
  274. </script>
  275.  
  276.  
  277. </body>
  278. </html>
  279. <html>
  280. <head>
  281. <title></title>
  282. </head>
  283. <body>
  284. <?php
  285. $uname = $_POST['uname'];
  286. $email = $_POST['email'];
  287. $age = $_POST['age'];
  288. $gender = $_POST['gender'];
  289. $city = $_POST['city'];
  290. $mobile = $_POST['mobile'];
  291. $aadhar = $_POST['aadhar'];
  292. $about = $_POST['about'];
  293. $password = $_POST['password'];
  294. $conn = new mysqli('localhost','root','','linking');
  295. mysqli_query($conn,"Insert into regrec (uname,email,age,gender,city,mobile,aadhar,about,password) values ('$uname','$email','$age','$gender','$city','$mobile','$aadhar','$about','$password')");
  296. echo "Registration Successfull";
  297. ?>
  298. </body>
  299. </html>
Add Comment
Please, Sign In to add comment