javascript - PHP Redirect Loop with cross sessions -


the problem

while trying make sessions able go cross domain, ex. m.website.com , website.com have somehow created redirect loop.

thing is, when log in on m.website.com goes /home supposed says has redirect loop. know session thing working though because if right after go website.com/home i'm logged in , good.

if process vice versa (log website.com/home , try , go m.website.com/home) redirect loop aswell.

sqlconnect.php

$mysql_host = "localhost"; $mysql_database = ""; $mysql_user = ""; $mysql_password = "";  //establish mysql connection mysql_connect($mysql_host, $mysql_user, $mysql_password); mysql_select_db($mysql_database);  ini_set('session.cookie_domain', '.website.com' );  session_name("webtsite"); 

m.website.com/home.php

<?php include "sqlconnect.php"; include "class.user.php"; session_start(); if(!isset($_session['ok'])) {        header("location: index");     exit; } else {     $user = new user(); } if($user->userinfo['first_name'] == "") {     mysql_query("update `social_users` set `sessionkey`='dead' `sessionkey`='".session_id()."'") or die(mysql_error());     unset($_session['ok']);     session_set_cookie_params(0);     session_destroy();     setcookie("phpsessid", time()-3600);     session_regenerate_id(true);     header("location: index"); } ?> <?php     include "header.php"; ?> <title>website home</title> <script type="text/javascript"> $(document).ready(  function()  {   $('div#shoutloader').hide();   $('div#shoutloader').delay(5000).fadein();  } ); var loadme = true; function loadfeedresults(){     if(loadme == true){         loadme == false;  $('div#feed_loader').show();  $.ajax({  url: "feed_load_more_results.php?last_post="+ $(".feeditem:last").attr('id') ,  success: function(html) {  if(html){  $('div#feed_loader').hide();  $("#feed").append(html);  }else{  $('div#loadmore').hide();  $('div#feed_more').fadein();  $('div#feed_loader').hide();  }  }  });  } } </script> </head>  <?php     include "navigation.php"; ?> <div id="content">   <div id="shout"> <font  size="5">shout out!</font>     <form  method="post" action="shout.php" enctype="multipart/form-data">       <textarea name="shout" class="shoutbox" ></textarea><br />       add image &raquo;<input type="file" placeholder="upload" name="file"><br />       set mood &raquo; <input type="text" id="mood" class="mood" name="mood" placeholder="type mood *optional" maxlength="20"><br />       <input type="submit" class="shoutbox_submit" name="submit" value="shout!">&nbsp;     </form>   </div>   <div id="shout_divider"></div>   <div id="feed">         <center>             <img src="http://sociobubble.com/images/ajax-loader.gif" />         </center>   </div>   <div style="margin-bottom: 10px;" class="noshouts" id="shoutloader">     <div id="loadmore">         <a style="cursor:pointer;" onclick="loadfeedresults();">load more shouts</a>     </div>     <div id="feed_more" style="display:none;">no more shouts</div>     <div id="feed_loader" style="display:none;">         <center>             <img src="http://sociobubble.com/images/ajax-loader.gif" />         </center>       </div>   </div> </div> 

index.php

    <?php include "sqlconnect.php"; session_start(); if(isset($_session['ok'])) {        header("location: home");     exit; } else { } ?> <?php     include "header.php"; ?> <title></title> </head> <body class="loginbody">     <div class="content">         <div class="logo">             <img width="350px" src="http://.com/images/logo.png">         </div>         <div class="login">             <form method="post" action="login.php">                 username:<br />                 <input type="text" name="email" class="login_field"><br />                 password:<br />                 <input type="password" name="password" class="login_field"><br /><br />                 <input type="submit" class="login_submit" value="login"><br />                 <p style="font-size: 150%;">or register <a href="">here</a></p>             </form>         </div>     </div> </body> </html> 

edit: seemed of fixed self!? added .htaccess root of m.site.com


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -