Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // Файл подключения connection.php
  2. <?php
  3.  
  4. $servername = "localhost";
  5. $username = "st2014";
  6. $password = "progress";
  7.  
  8. $connection = "";
  9.  
  10. try {
  11. $connection = new PDO("mysql:host=$servername;dbname=st2014", $username, $password);
  12. $connection->exec('SET NAMES utf8');
  13. } catch (PDOException $e) {
  14. echo "Connection failed: " . $e->getMessage();
  15. }
  16.  
  17. ?>
  18.  
  19. // Часть кода которая используется в login.php
  20.  
  21. $userRequest = $connection->prepare("SELECT username, password FROM t164062_users WHERE username = :username");
  22. $userRequest->bindParam(':username', $POST['username']);
  23. $userRequest->execute();
  24. $user = $userRequest->fetchAll(PDO::FETCH_ASSOC);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement