SHARE
TWEET

Untitled

Ram8nas Oct 4th, 2017 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. $servername = "sql102.byethost22.com";
  4. $username = "b22_20717239";
  5. $password = "***********";
  6. $dbname = "b22_20717239_Gedimai";
  7.  
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9.  
  10. if ($conn->connect_error) {
  11.     die("Prisijungti nepavyko: " . $conn->connect_error);
  12. }
  13.  
  14. $vardas = $_POST["vardas"];
  15. $epastas = $_POST["epastas"];
  16. $zinute = $_POST["zinute"];
  17. $ip = $_SERVER['SERVER_ADDR'];
  18.  
  19. function get_client_ip() {
  20.     $ip = '';
  21.     if (getenv('HTTP_CLIENT_IP'))
  22.         $ip = getenv('HTTP_CLIENT_IP');
  23.     else if(getenv('HTTP_X_FORWARDED_FOR'))
  24.         $ip = getenv('HTTP_X_FORWARDED_FOR');
  25.     else if(getenv('HTTP_X_FORWARDED'))
  26.         $ip = getenv('HTTP_X_FORWARDED');
  27.     else if(getenv('HTTP_FORWARDED_FOR'))
  28.         $ip = getenv('HTTP_FORWARDED_FOR');
  29.     else if(getenv('HTTP_FORWARDED'))
  30.        $ip = getenv('HTTP_FORWARDED');
  31.     else if(getenv('REMOTE_ADDR'))
  32.         $ip = getenv('REMOTE_ADDR');
  33.     else
  34.         $ip = 'UNKNOWN';
  35.     return $ip;
  36. }
  37.  
  38. $sql = "INSERT INTO RamunasSakauskas(ip, vardas, epastas, zinute)
  39. VALUES ('$ip', '$vardas', '$epastas', '$zinute')";
  40.  
  41. if ($conn->query($sql) === TRUE) {
  42.     echo "Pavyko";
  43. } else {
  44.     echo "Error: " . $sql . "<br>" . $conn->error;
  45. }
  46.  
  47. $conn->close();
  48. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top