Advertisement
thedevil

PHP Session problem

Jul 25th, 2011
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2.  
  3. header('Content-Type: text/html; charset=UTF-8');
  4.  
  5. $main_domain = $_SERVER["HTTP_HOST"];
  6. $expld = explode('.', $main_domain);
  7.  
  8. if(count($expld) > 2) {
  9.    $tld = array_pop($expld);
  10.    $domain = array_pop($expld);
  11.    $main_domain = $domain . "." . $tld;
  12. }
  13.  
  14. $main_domain = ".localhost";
  15.  
  16. session_name('sid');
  17. session_set_cookie_params (0, '/', $main_domain);
  18. session_start();
  19. echo session_id();
  20. exit;
  21.  
  22.  
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement