Advertisement
Guest User

Untitled

a guest
Feb 9th, 2019
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. <?php
  2. require_once 'classes/class.autoloader.php';
  3. session_name("testing123");
  4. session_start();
  5. $abs_us_root=$_SERVER['DOCUMENT_ROOT'];
  6.  
  7. $self_path=explode("/", $_SERVER['PHP_SELF']);
  8. $self_path_length=count($self_path);
  9. $file_found=FALSE;
  10.  
  11. for($i = 1; $i < $self_path_length; $i++){
  12. array_splice($self_path, $self_path_length-$i, $i);
  13. $us_url_root=implode("/",$self_path)."/";
  14.  
  15. if (file_exists($abs_us_root.$us_url_root.'z_us_root.php')){
  16. $file_found=TRUE;
  17. break;
  18. }else{
  19. $file_found=FALSE;
  20. }
  21. }
  22.  
  23. require_once $abs_us_root.$us_url_root.'users/helpers/helpers.php';
  24.  
  25. // Set config
  26. $GLOBALS['config'] = array(
  27. 'mysql' => array(
  28. 'host' => 'localhost',
  29. 'username' => 'root',
  30. 'password' => '',
  31. 'db' => 'yourdbname',
  32. ),
  33. 'remember' => array(
  34. 'cookie_name' => '1mqesoxiw318374csb',
  35. 'cookie_expiry' => 604800 //One week, feel free to make it longer
  36. ),
  37. 'session' => array(
  38. 'session_name' => 'user',
  39. 'token_name' => 'token',
  40. )
  41. );
  42.  
  43. //If you changed your UserSpice or UserCake database prefix
  44. //put it here.
  45. $db_table_prefix = "uc_"; //Old database prefix
  46.  
  47. //adding more ids to this array allows people to access everything, whether offline or not. Use caution.
  48. $master_account = [1];
  49.  
  50. $currentPage = currentPage();
  51.  
  52. //Check to see if user has a remember me cookie
  53. if(Cookie::exists(Config::get('remember/cookie_name')) && !Session::exists(Config::get('session/session_name'))){
  54. $hash = Cookie::get(Config::get('remember/cookie_name'));
  55. $hashCheck = DB::getInstance()->query("SELECT * FROM users_session WHERE hash = ? AND uagent = ?",array($hash,Session::uagent_no_version()));
  56.  
  57. if ($hashCheck->count()) {
  58. $user = new User($hashCheck->first()->user_id);
  59. $user->login();
  60.  
  61. }
  62. }
  63.  
  64. //Check to see that user is logged in on a temporary password
  65. $user = new User();
  66.  
  67. //Check to see that user is verified
  68. if($user->isLoggedIn()){
  69. if($user->data()->email_verified == 0 && $currentPage != 'verify.php' && $currentPage != 'logout.php' && $currentPage != 'verify_thankyou.php'){
  70. Redirect::to('users/verify.php');
  71. }
  72. }
  73. $timezone_string = 'EUROPE/LISBON';
  74. date_default_timezone_set($timezone_string);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement