Guest User

Untitled

a guest
Oct 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.04 KB | None | 0 0
  1.     public function cookieFix(){
  2.  
  3.         $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
  4.  
  5.         //Set up P3P policy to allow cookies in iframe with IE
  6.         if(strpos($user_agent, 'MSIE')){
  7.             header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
  8.         }
  9.  
  10.         //Workaround for Safari - post a form with Javascript to create session cookie
  11.         if(empty($_COOKIE[session_name()]) && strpos($user_agent,'Safari') && isset($_GET['dr_auth_code']) && !isset($_GET['dr_cookie_fix'])){
  12.     ?>
  13.         <html><head><title>Iframe Cookie fix</title></head>
  14.         <body>
  15.             <form name="cookieFix" method="get" action="">
  16.                 <?php foreach($_GET as $key=>$val){
  17.                     echo '<input type="hidden" name="'.htmlspecialchars($key).'" value="'.htmlspecialchars($val).'" />';
  18.                 } ?>
  19.                 <input type="hidden" name="dr_cookie_fix" value="1" />
  20.                 <noscript><input type="submit" value="Continue" /></noscript>
  21.             </form>
  22.             <script type="text/javascript">document.cookieFix.submit();</script>
  23.         </body></html>
  24.     <?php
  25.             exit;
  26.         }
  27.  
  28.     }
Add Comment
Please, Sign In to add comment