Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $dsn = 'mysql:dbname=trutime;host=127.0.0.1';
  5. $user = 'root';
  6. $password = '';
  7. //create connection
  8. //$conn=new PDO($dsn, $user, $password);
  9. //check connection
  10. try {
  11. $conn = new PDO($dsn, $user, $password);
  12. } catch (PDOException $e) {
  13. echo 'Connection failed: ' . $e->getMessage();
  14. }
  15. //session validation
  16. $isUserLoggedIn = false;
  17. if(
  18. isset($_SESSION['usr']) &&
  19. isset($_SESSION['pwd']) &&
  20. !empty($_SESSION['usr']) &&
  21. !empty($_SESSION['pwd'])) {
  22. $isUserLoggedIn = true;
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement