Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

process_contact.php 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. require_once('config.php');
  3. if (isset($_POST))
  4. {
  5. $success = true;
  6. $error = "";
  7. $name = "";
  8. $email = "";
  9. $subject = "";
  10. $message = "";
  11. $subject = $_POST['subject'];
  12. $message = $_POST['message'];
  13. if (isset($_POST['name']))
  14. {
  15. $name = $_POST['name'];
  16. }
  17. elseif ($logged_in == 1)
  18. {
  19. $name = $user->username;
  20. }
  21. else
  22. {
  23. $success = false;
  24. $error = "You are not currently logged in.";
  25. }
  26. if (isset($_POST['email']))
  27. {
  28. $email = $_POST['email'];
  29. }
  30. elseif ($logged_in == 1)
  31. {
  32. $email = $user->username . "@" . $CONF['host'];
  33. }
  34. else
  35. {
  36. $success = false;
  37. $error = "You are not currently logged in.";
  38. }
  39. if ($success && empty($name))
  40. {
  41. $success = false;
  42. $error = "You need to specify a name.";
  43. }
  44. if ($success && empty($email))
  45. {
  46. $success = false;
  47. $error = "You need to specify a email to respond to.";
  48. }
  49. if ($success && $subject == "na")
  50. {
  51. $success = false;
  52. $error = "Please choose a subject.";
  53. }
  54. if ($success && empty($message))
  55. {
  56. $success = false;
  57. $error = "Please supply in a brief message.";
  58. }
  59. if ($success)
  60. {
  61. $data = array(
  62. "name" => $name,
  63. "email" => $email,
  64. "subject" => $subject,
  65. "message" => $message,
  66. "date_added" => date("Y-m-d H:i:s",time())
  67. );
  68. $db->insert($data, 'support');
  69. echo "true";
  70. }
  71. else
  72. {
  73. echo $error;
  74. }
  75. }
  76. else
  77. {
  78. echo "Unable to process the request.";
  79. }
  80. ?>