Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
87
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. $dsn = 'mysql:dbname=trutime;host=127.0.0.1';
  4. $user = 'root';
  5. $password = '';
  6. //create connection
  7. //$conn=new PDO($dsn, $user, $password);
  8. //check connection
  9. try {
  10. $conn = new PDO($dsn, $user, $password);
  11. } catch (PDOException $e) {
  12. echo 'Connection failed: ' . $e->getMessage();
  13. }
  14. //session validation
  15. $isUserLoggedIn = false;
  16. if(
  17. isset($_SESSION['usr']) &&
  18. isset($_SESSION['pwd']) &&
  19. !empty($_SESSION['usr']) &&
  20. !empty($_SESSION['pwd'])) {
  21. $isUserLoggedIn = true;
  22. }
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement