Guest User

Untitled

a guest
Mar 31st, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2.  
  3. // Information needed to connect to the database
  4. $dsn = 'mysql:dbname=uzakova_db;host=uzakova.eas-cs2410-1516.aston.ac.uk';
  5. $username = "uzakova";
  6. $password = "";
  7.  
  8.  
  9.  
  10. try
  11. {
  12. //Opens the connection to the database
  13. $db = new PDO($dsn, $username, $password);
  14. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  15.  
  16. }
  17. catch(PDOException $ex)
  18. {
  19. // Not using getMessage method due to security(ie provides some info)
  20. header("location: error.php");
  21. }
  22.  
  23.  
  24. session_start();
  25. ?>
Add Comment
Please, Sign In to add comment