Advertisement
Guest User

php

a guest
Apr 8th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. $servername = "****";
  3. $username = "****";
  4. $password = "****";
  5.  
  6. try {
  7. $conn = new PDO("mysql:host=$servername;dbname=mel9826_pharma", $username, $password);
  8. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  9. echo "Connected successfully";
  10. }
  11. catch(PDOException $e)
  12. {
  13. echo "Connection failed: " . $e->getMessage();
  14. }
  15. ?>
  16. <?php
  17.  
  18.  
  19. $surname = $_POST['surname'];
  20. $lastname = $_POST['lastname'];
  21. $age = $_POST['age'];
  22. $email = $_POST['email'];
  23. $zip = $_POST['zip'];
  24. $contact = $POST['contact'];
  25.  
  26.  
  27.  
  28. {
  29. session_start();
  30. $digit1 = mt_rand(1,6);
  31. $digit2 = mt_rand(1,6);
  32. $math = "$digit1 + $digit2";
  33. $_SESSION['answer'] = $digit1 + $digit2;
  34. }
  35.  
  36. if ($_SESSION['answer'] != $_POST['answer'] ) {
  37. $commentError = 'Please answer the math question.';
  38. $hasError = true;
  39. }
  40.  
  41. if (isset($contact) && $contact=="no") echo "checked";
  42. if (isset($contact) && $contact=="yes") echo "checked";
  43.  
  44.  
  45. ?>
  46.  
  47.  
  48.  
  49. <!DOCTYPE html>
  50. <html>
  51. <head>
  52. <link rel="stylesheet" type="text/css" href="pharma.css">
  53. <title>YesDoz!&#0153</title>
  54. <nav id="menu">
  55. <ul>
  56. <li><a href="melcappell.com">Home</a></li>
  57. <li><a href="#">About</a></li>
  58. <li><a href="melcappell.com/projects">Projects</a></li>
  59. <li><a href="#">Contact</a></li>
  60. </ul>
  61. </nav>
  62. </head>
  63. <body>
  64. <div id="motto">
  65. <h1>Thank your for your interest in YesDoz!&#0153. Someone will be in contact with you shortly!</h1>
  66. </div>
  67.  
  68.  
  69. </body>
  70. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement