Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. if(isset($_POST['submit'])){
  2.         //google ReCAPTCHA
  3.         $secret = "6LfG2GQUAAAAAO5RY3yUEUlqxICWiUK5TMQ3qFK4";
  4.         $response = $_POST['g-recaptcha-response'];
  5.         $remoteip = $_SERVER['REMOTE_ADDR'];
  6.         $url = "https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}&remoteip={$remoteip}";
  7.         $response = file_get_contents($url);
  8.         $result = json_decode($response);
  9.        
  10.         if($result->success){
  11.             define("SERVERNAME", "szpanel.pl");
  12.             define("USERNAME", "szpanel_pl");
  13.             define("PASSWORD", "tibia44!");
  14.            
  15.            
  16.             $connection = mysqli_connect(SERVERNAME, USERNAME, PASSWORD);
  17.             if(!($connection->connect_error)){
  18.                 echo '<script>alert("Insertowanie.");</script>';
  19.                 $sql = "INSERT INTO `gift` (`id`, `twitchname`, `name&surname`, `street`, `city`, `contact`, `email`) VALUES (NULL, '{$_POST['twitchname']}', '{$_POST['namesurname']}', '{$_POST['street']}', '{$_POST['city']}', '{$_POST['contact']}', '{$_POST['email']}');";
  20.                 $result = $connection->query($sql);
  21.                 if($result){
  22.                     echo '<script>alert("Formularz wysłany poprawnie.");</script>';
  23.                 }else{
  24.                     echo '<script>alert("Błąd bazy danych.[1]");</script>';
  25.                 }
  26.             }else{
  27.                 echo '<script>alert("Błąd bazy danych.[2]");</script>';
  28.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement