Forums

PHP

This topic is locked

UD4&PHP - Restricting access to pages

Posted 24 Aug 2001 20:51:50
1
has voted
24 Aug 2001 20:51:50 David Fee posted:
The PHP code UD writes when I use a server behavior to restrict access to certian pages works, but some of the code get displayed at the top of the pages, it seems that the code can't be read so it doesn't execute and gets dumped on the page. If someone has had this problem, I'd appreciate it if you can help. I've included the script that was generated and I've noted the section of code that gets displayed on the page.


<?php
// *** Restrict Access To Page: Grant or deny access to this page
$KT_authorizedUsers=" user";
$KT_authFailedURL="accesstopagedenied.html";
$KT_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["KT_Username"])) {
if (false || !(isset($HTTP_SESSION_VARS["KT_UserAuthorization"])) || $HTTP_SESSION_VARS["KT_UserAuthorization"]=="" || strpos($KT_authorizedUsers, $HTTP_SESSION_VARS["KT_UserAuthorization"])) {
$KT_grantAccess = 1;
}
}
if (!$KT_grantAccess) {
$KT_qsChar = "?";
if (strpos($KT_authFailedURL, "?") $KT_qsChar = "&";
$KT_referrer = $PHP_SELF;
if (strlen($QUERY_STRING)

(Everything below this was what is displayed on the webpage. The above code works to the extent that it does restrict access to the page, but there is obviously an error somewhere.)

> 0) $KT_referrer .= "?" . $QUERY_STRING;
$KT_authFailedURL = $KT_authFailedURL . $KT_qsChar . "accessdenied=" . urlencode($KT_referrer);
header("Location: $KT_authFailedURL";
exit;
}
?>


Again, I appreciate all the help.
Dave


Replies

Replied 25 Aug 2001 03:06:34
25 Aug 2001 03:06:34 Tim Green replied:
The fact that raw PHP code is being sent to your browser indicates to me that your server isn't correctly configured in some way.

However, without further details on your set up I can't comment (read the FAQ, link in my signature). As a guess though, it is probably something to do with undeclared variables (though you haven't indicated any error message that is generated, and if the server is properly configured, an error message should have been generated).

I would suggest, as a pure guess, that you look at the debug settings in your PHP.ini

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic