Advertisement
Guest User

REG

a guest
May 19th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @package configuration
  5. * @author Thrallix
  6. * @version 1.0
  7. *
  8. */
  9. class configuration {
  10.  
  11. private $mysqlUsername = 'root';
  12. private $mysqlPassword = '';
  13. private $mysqlDatabase = 'secured';
  14.  
  15. public function secured_session_start()
  16. {
  17. $sessionName = 'secured_session_string';
  18. if(ini_set('session.use_only_cookies', 1) == false)
  19. {
  20. print("Could not set up secured session");
  21. exit();
  22. }
  23. $cookieParams = session_get_cookie_params();
  24. session_set_cookie_params(3600, $cookieParams['path'], $cookieParams['domain'], 'SECURE', true);
  25. session_name($sessionName);
  26. session_start();
  27. session_regenerate_id(true);
  28. }
  29.  
  30. public function db()
  31. {
  32. $connection = new PDO("mysql:host=localhost;dbname=".$this->mysqlDatabase, $this->mysqlUsername, $this->mysqlPassword);
  33. $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  34. return $connection;
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement