Buggy Cookies

| No Comments
I created Alumni Association of Western Pennsylvania School for the Deaf website to use PHP and MySQL to make this programmable & function through register and login users.

I learned from the registered users frustrated with the login problem on their computer: The registered user sign their login to access the member’s web page, and he/she click into another member’s web page, and it kept bouncing back to login page, vice versia.

Thanks to Cathy Adams, WPSD Class of 1974 for active feedback through email about the login problem on her computer. I found what the problem caused:

Cookie.

I sent her a help instructions to solve this problem, and she chose Mozilla Firefox web browser and the login worked.

I found PHP.net to borrow their script forums: host browser accepts cookies in login page. I added the warning message will appear after login submitting w/ cookie disabled in the same page.

<?php

header("P3P: CP=\"ALL DSP COR NID CURa OUR STP PUR\""); 

$nocookies = false;
$reloaded = $_GET["ckset"];
$querystring = $_SERVER[QUERY_STRING];
$querystring = str_replace("ckset=ok", "", $querystring);

setcookie("check_cookie", "on", time()+(1000000));

if ($reloaded == "" and !isset($check_cookie)) {
   $nocookies = true;
   exit;
} else {
   if (!isset($check_cookie)) $nocookies = true;
}

If ($nocookies) {
   echo "Your browser is not accepting cookies. 
  Please turn them on or update your browser";
} else {
   echo "Your browser is accepting cookies";
}
?>
That’s it. Now, the registered users who have disabled cookies on their browser will receive the warning message and unable to log-in.

I learned my valuable experience with that kind of problem.

Archives

Master Archives

What am I doing

    Tag cloud

    View All Tags

    SUBSCRIBE

    Powered by Movable Type 4.23-en