Enter your name to send a positive message to the next visitor. Only after that you will receive a positive message from the previous visitor. https://www.victorgiers.com/pronoia
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. $db = mysqli_connect('', '', '', '');
  3. mysqli_set_charset($db, "utf8");
  4. if(isset($_POST['name'])){
  5. $name=$_POST['name'];
  6. if(isset($_POST['g-recaptcha-response'])){
  7. $captcha=$_POST['g-recaptcha-response'];
  8. }
  9. $secretKey = "";
  10. $ip = $_SERVER['REMOTE_ADDR'];
  11. // post request to server
  12. $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha);
  13. $response = file_get_contents($url);
  14. $responseKeys = json_decode($response,true);
  15. // should return JSON with success as true
  16. if($responseKeys["success"]) {
  17. $receive = true;
  18. $name = preg_replace('/[^a-zA-Z -\x7f\-\xff]/', '', $name);
  19. $name = preg_replace('/-+/', '-', $name);
  20. $name = str_replace('\' ', '\'', ucwords(str_replace('\'', '\' ', strtolower($name))));
  21. $query = 'SELECT `name` FROM `pronoia` ORDER BY `id` DESC;';
  22. $result = mysqli_query($db, $query);
  23. $row = mysqli_fetch_object($result);
  24. if($row->name == $name){
  25. while($row->name == $name){ //ALWAYS have at least 2 different name entries in the table
  26. $row = mysqli_fetch_object($result);
  27. }
  28. }
  29. $god = $row->name;
  30. if($name != ""){
  31. $ip = $_SERVER['REMOTE_ADDR'];
  32. $query = "SELECT * FROM `pronoia` WHERE `time` >= CURDATE() and `ip` LIKE '".$ip."';";
  33. $result = mysqli_query($db, $query);
  34. if(!mysqli_fetch_array($result)){
  35. $query = 'INSERT INTO `pronoia` (`name`, `ip`, `time`) VALUES ("'.$name.'", "'.$ip.'", NOW());';
  36. mysqli_query($db, $query);
  37. } else {
  38. //echo 'someone already made a post from that IP today';
  39. }
  40. } else {
  41. //echo 'Name empty..';
  42. }
  43. } else {
  44. //echo 'reCAPTCHA invalid...';
  45. }
  46. }
  47. ?>
  48. <!DOCTYPE html>
  49. <html>
  50. <head>
  51. <title>Pronoia</title>
  52. <meta name="author" content="Victor Giers">
  53. <meta name="date" content="2019-03-13">
  54. <script>
  55. var move = function(){
  56. document.forms['enterName'].submit();
  57. };
  58. window.addEventListener('keydown',function(e){if(e.keyIdentifier=='U+000A'||e.keyIdentifier=='Enter'||e.keyCode==13){if(e.target.nodeName=='INPUT'&&e.target.type=='text'){e.preventDefault();return false;}}},true);
  59. </script>
  60. <script src="https://www.google.com/recaptcha/api.js" async defer></script>
  61. <link rel="stylesheet" href="style.css">
  62. </head>
  63. <body>
  64. <div id="content">
  65. <?php
  66. if(isset($receive)) {
  67. ?>
  68. I love you.<br/>
  69. I will always protect you.<br/>
  70. I want you to achieve all your goals.<br/>
  71. The universe is conspiring in your favour.<br/>
  72. Everything that happens is always just what you need for your personal growth.<br/>
  73. You are great, strong and able to achieve everything.<br/>
  74. Yours sincerely,<br/>
  75. <?=$god ?>
  76. <?php
  77. } else {
  78. ?>
  79. <center>
  80. <form id="comment_form" name="enterName" action="index.php" method="post">
  81. <input type="text" name="name" placeholder="Enter name (optional)" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter name (optional)'" maxlength="50"><br><br>
  82. <div class="g-recaptcha" data-sitekey="" data-callback="move"></div>
  83. </form>
  84. </center>
  85. <?php
  86. }
  87. ?>
  88. </div>
  89. <div class="stars"></div>
  90. <div class="twinkling"></div>
  91. </body>
  92. </html>