On Jul 1, 8:11*am, Geoff Berrow <blthe...@ckdog .co.ukwrote:
Message-ID:
<d13ffd7f-9315-46ee-97dc-96067c246...@i7 6g2000hsf.googl egroups.comfrom
tomrue contained the following:
That's a very helpful suggestion. The problem, for me, unfortunately,
is that I don't know how to do it. Hence my question.
I wasn't being deliberately unhelpful. There are plenty of PHP tutorials
around which will show you how to use sessions or cookies. Se my own
examples for cookies below.
I suggested cookies because I thought it would be simpler for you to
decide when they expire.
For cookieshttp://www.ckdog.co.uk/phpcourse/Lesson6/remember.php
Codehttp://www.ckdog.co.uk/phpcourse/Lesson6/remember.phpsht tp://www.ckdog..co.u k/phpcourse/Lesson6/remember2.phps
--
Regards,
Geoff Berrow
My suggestion as an alternative would be to have a regular expression
at the top of your download page that checks the page refferal. I'd
call the page .inc.php and include it when it should be displayed. The
regular expression would test for the .inc.php in the request for the
page and reject it if its found. That would mean someone is trying to
view it directly by opening the page (eg download.inc.ph p) rather than
from the point you want to view it.
It does mean that you would need another place from which to use an
include() on the download page. So on the submission of the last page
of the quiz, the php handler for the form (i'm assuming there is a
form involved in your quiz pages) would simply have
include("downlo ad.inc.php"); as the only action to perform.
Sorry if this isn't clear, a session/cookie variable to track the quiz
status is far simpler if your quiz isn't setup in a compatible way.
Regular expression (Not very PHP5 way of doing it I know you could use
a different server array)
if (eregi(".inc.ph p",$HTTP_SERVER _VARS['PHP_SELF']) ||
eregi(".inc.php ",$_SERVER['PHP_SELF'])) {
echo "<html>\r\n<hea d>\r\n<title>Fo rbidden 403</title>\r\n</head>\r
\n<body><h3>For bidden 403</h3>\r\nThe document you are requesting is
forbidden.\r\n</body>\r\n</html>";
exit;
}
This will only allow the file to be included and not directly viewed.
Clear as mud :-)
Regards,
John