Forum

You are not logged in. Please note that you need to log in before posting.

Dear friends! Please note that hitAppoint will be on holidays till June 12, 2011 with a limited online access. We apologize for delayed replies. Every request will be promptly resolved on return.

#1 2010-05-03 22:34:31

HowToMove
Member
Registered: 2010-05-01
Posts: 118
Website

checking for cookies

Can I offer solutions here in addition to asking for help? Good!

When logging in, if cookies are blocked the user is not told what is wrong.
They just end up back at the login panel with no error message.

I figured out a workaround, which could perhaps be incorporated in the software:

Users see my hitAppoint home panel in an iframe of a standard HTML page.
I replaced the ref to index.php with a ref to booking.php, and also created another
script called bookingtest.php. The first script sets a cookie and redirects to the
second script. The second script tests for the cookie, and if it is there redirects
to hitAppoint's index.php. If the second script does not find the cookie, it prints
an error message telling the user what's wrong.

The redirects are required because PHP scripts can't set a cookie and immediately
test for it. Google for cookie testing and you'll see lots of places that say you can't
test on a page the first time the page is viewed. The redirect gimmick gets around that.

Comments? Suggestions? I'll eagerly remove my front end if the software starts
checking for cookies on its own.

file booking.php
<?php setcookie('TestForCookies'); ?>
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=./bookingtest.php">
</head>

file bookingtest.php
<?php setcookie('TestForCookies'); ?>
<?php
if(isset($_COOKIE['TestForCookies']))
  {
print
'<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=./hitAppointFolder/index.php">
</head>
';
  exit;
  }
?>
<html>
<head>
<title>Cookie Check</title>
</head>
<body>
Cookie Check
<p>
If you're reading this message, you apparently don't have cookies enabled.<br>
Sorry, but until your browser will accept cookies, our appointment calendar won't work for you.
<p>
<b>Please enable cookies in your browser's security settings.</b><br>
After enabling cookies, use your browser's <i>refresh</i> button or
click here for our <a href="./booking.php">online schedule</a>.
<p>
</body>
</html>

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson