Thursday, 8 September 2016

php - Why does my phpsessid is change between 2 ajax requests

I use 2 ajax requests to communicate to my other site



first : authenticate to the site
second : get the data base on user authentication



When I create the user session in first request the session is created,
but I only get null data when I request the data because user session is lost.



This does not happen if I test it by manually filling in the url address in browser.



I see the phpssid is changed :
phpsessid



ajax request :



var url = 'https://xxx.mysite.co.id/index.php/';
$(document).ready(function(){
$.ajax({
url: url+"main/authenticate_user/user/123456/undefined/11",
dataType : 'json',
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(authenticate){
if(authenticate.state == 'success'){
$.ajax({
url: authenticate.url,
dataType : 'text',
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(login){
$.ajax({
url: url+"main/module/lead/get_data/lead_id/LEAD26016",
dataType : 'json',
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(lead){
$.ajax({
url: authenticate.url,
dataType : 'text',
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(login){
$.ajax({
url: url+"main/module/lead/get_data/lead_id/LEAD26016",
dataType : 'json',
beforeSend: function(xhr){
xhr.withCredentials = true;
},
success: function(lead){
}
});

}
});
}
});

}
});
}
}
});
});


i request from
hxxp://localhost/



Updated :
i really stuck for this problem,
i just change the session process to my own filecache class.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...