Guest User

Untitled

a guest
Aug 23rd, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. <?php
  2.  
  3. $host="mysql.hostinger.hu"; //host. gondolom nektek is ez, mivel Hostingeresek vagytok.
  4. $user=""; //felhasználónév
  5. $pass=""; //jelszó
  6. $dbname=""; //adatbázis neve
  7.  
  8. $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
  9.  
  10. // A try/catch statement is a common method of error handling in object oriented code.
  11. // First, PHP executes the code within the try block. If at any time it encounters an
  12. // error while executing that code, it stops immediately and jumps down to the
  13. // catch block. For more detailed information on exceptions and try/catch blocks:
  14. // http://us2.php.net/manual/en/language.exceptions.php
  15. try
  16. {
  17. // This statement opens a connection to your database using the PDO library
  18. // PDO is designed to provide a flexible interface between PHP and many
  19. // different types of database servers. For more information on PDO:
  20. // http://us2.php.net/manual/en/class.pdo.php
  21. $db = new PDO("mysql:host={$host};dbname={$dbname};charset=utf8", $user, $pass, $options);
  22. }
  23. catch(PDOException $ex)
  24. {
  25. // If an error occurs while opening a connection to your database, it will
  26. // be trapped here. The script will output an error and stop executing.
  27. // Note: On a production website, you should not output $ex->getMessage().
  28. // It may provide an attacker with helpful information about your code
  29. // (like your database username and password).
  30. die("Failed to connect to the database: " . $ex->getMessage());
  31. }
  32.  
  33. if($_GET)
  34. {
  35. $name = strip_tags($_GET['username']);
  36.  
  37. $stmt=$db->prepare("SELECT username FROM users WHERE username=:name");
  38. $stmt->execute(array(':name'=>$name));
  39. $count=$stmt->rowCount();
  40.  
  41. if($count>0)
  42. {
  43. die("{\"login\":\"OK\",\"skin\":\"ide kell beilleszteni a skin lekérését.\",\"defaultskin\":\"http://pornhub.com, őőő, ja, izé, ide kell az alap skin.\"}");
  44. }
  45. else
  46. {
  47. print("2");
  48. }
  49. }
  50.  
  51. ?>
Add Comment
Please, Sign In to add comment