Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ALL ^ E_NOTICE);
  4.  
  5. /*=========== Database Configuraiton ==========*/
  6.  
  7. $db_host = "localhost";
  8. $db_user = "test";
  9. $db_pass = "test";
  10. $db_name = "dbtest";
  11.  
  12.  
  13. /*=========== Website Configuration ==========*/
  14.  
  15. $defaultTitle = 'testing';
  16. $defaultFooter = date('Y').' &copy; testing';
  17.  
  18. ?>
  19.  
  20. <?php
  21.  
  22.  
  23. require_once "includes/config.php";
  24. require_once "includes/connect.php";
  25. require_once "includes/helpers.php";
  26.  
  27.  
  28.  
  29. header('Cache-Control: max-age=3600, public');
  30. header('Pragma: cache');
  31. header("Last-Modified: ".gmdate("D, d M Y H:i:s",time())." GMT");
  32. header("Expires: ".gmdate("D, d M Y H:i:s",time()+3600)." GMT");
  33.  
  34. ?>
  35.  
  36. <?php
  37.  
  38. /*
  39. The login details are taken from config.php.
  40. */
  41.  
  42. try {
  43. $db = new PDO(
  44. "mysql:host=$db_host;dbname=$db_name;charset=UTF-8",
  45. $db_user,
  46. $db_pass
  47. );
  48.  
  49. $db->query("SET NAMES 'utf8'");
  50. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  51. }
  52. catch(PDOException $e) {
  53. error_log($e->getMessage());
  54. die("A database error was encountered");
  55. }
  56.  
  57.  
  58. ?>
  59.  
  60. catch(PDOException $e) {
  61. error_log($e->getMessage());
  62. die("A database error was encountered -> " . $e->getMessage() );
  63. }
  64.  
  65. try {
  66. $db = new PDO(
  67. "mysql:host=$db_host;dbname=$db_name;charset=utf8",
  68. $db_user,
  69. $db_pass
  70. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement