PHP double submit cookie pattern
Login Details
Email = test@test.com
Password = test123
How to use
- Login using above credentials
- Fill the form with requested details on Send Request page
(Can't access to this page without successful login) - If your token matched you can see " Request Successfully Sent! Token Matched. " message in top of the page
- If your token not matched you can see " Request Sending Failed! Token Miss-Match. " message
===========================================================
//Cookie generating function
function getCookie() {
var name = "user" + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return 0;
}