Guest User

Untitled

a guest
Dec 5th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. include('functions.php');
  3. // Connecting to the MySQL database
  4. $username = "bockcubilf1";
  5. $password = "1hlArouk";
  6.  
  7. $databaseName = "db_fall17_bockcubilf1";
  8. $database = new PDO('mysql:host=csweb.hh.nku.edu;dbname=' . $databaseName,$username,$password);
  9.  
  10. //Auto load
  11.  
  12. function autoloader($class){
  13. include 'classes/class.' . $class . '.php';
  14. }
  15. spl_autoload_register('autoloader');
  16.  
  17.  
  18. // Start the session
  19. session_start();
  20.  
  21. $current_url = basename($_SERVER['REQUEST_URI']);
  22.  
  23. // if userID is not set in the session and current URL not login.php sent to to login page
  24. if (!isset($_SESSION["userID"]) && $current_url != 'login.php') {
  25. header("Location: login.php");
  26.  
  27. }
Add Comment
Please, Sign In to add comment