Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict Access to Page () Behavior

Status
Not open for further replies.

VeronicaCBurgess

Technical User
Apr 25, 2003
27
US
I am having a problem with Dreamweavers "Restrict Access to Page()". When this is added to the page, it automatically redirects me to the failure page. This has just began happening after working fine before. Here is some code (I am using PHP 4 and MySql)
-------------------------------------------
Code:
<?php require_once('../../Connections/vonbarlow.php'); ?>
<?php
// *** Logout the current user.
$FF_Logout = $HTTP_SERVER_VARS['PHP_SELF'] . "?FF_Logoutnow=1";
if (isset($HTTP_GET_VARS['FF_Logoutnow']) && $HTTP_GET_VARS['FF_Logoutnow']=="1") {
  session_start();
  session_unregister("MM_Username");
  session_unregister("MM_UserAuthorization");
  $FF_logoutRedirectPage = "adminlogin.php";
  // redirect with URL parameters (remove the "FF_Logoutnow" query param).
  if ($FF_logoutRedirectPage == "") $FF_logoutRedirectPage = $HTTP_SERVER_VARS['PHP_SELF'];
  if (!strpos($FF_logoutRedirectPage, "?") && $HTTP_SERVER_VARS['QUERY_STRING'] != "") {
    $FF_newQS = "?";
    reset ($HTTP_GET_VARS);
    while (list ($key, $val) = each ($HTTP_GET_VARS)) {
      if($key != "FF_Logoutnow"){
        if (strlen($FF_newQS) > 1) $FF_newQS .= "&";
        $FF_newQS .= $key . "=" . urlencode($val);
      }
    }
    if (strlen($FF_newQS) > 1) $FF_logoutRedirectPage .= $FF_newQS;
  }
  header("Location: $FF_logoutRedirectPage");
  exit;
}

// *** Restrict Access To Page: Grant or deny access to this page
$FF_authorizedUsers=" ";
$FF_authFailedURL="/jazz/backend/login_failure.php";
$FF_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["MM_Username"])) {
  if (true || !(isset($HTTP_SESSION_VARS["MM_UserAuthorization"])) || $HTTP_SESSION_VARS["MM_UserAuthorization"]=="" || strpos($FF_authorizedUsers, $HTTP_SESSION_VARS["MM_UserAuthorization"])) {
    $FF_grantAccess = 1;
  }
}
if (!$FF_grantAccess) {
  $FF_qsChar = "?";
  if (strpos($FF_authFailedURL, "?")) $FF_qsChar = "&";
  $FF_referrer = "Restricted Area";
  $FF_authFailedURL = $FF_authFailedURL . $FF_qsChar . "accessdenied=" . urlencode($FF_referrer);
  header("Location: $FF_authFailedURL");
  exit;
}

$maxRows_Calendar = 3;
$pageNum_Calendar = 0;
if (isset($HTTP_GET_VARS['pageNum_Calendar'])) {
  $pageNum_Calendar = $HTTP_GET_VARS['pageNum_Calendar'];
}
$startRow_Calendar = $pageNum_Calendar * $maxRows_Calendar;

mysql_select_db($database_vonbarlow, $vonbarlow);
$query_Calendar = "SELECT EventDate, EventTime, EventTitle, EventDetails, EventLocation FROM tblCalendar ORDER BY EventDate DESC";
$query_limit_Calendar = sprintf("%s LIMIT %d, %d", $query_Calendar, $startRow_Calendar, $maxRows_Calendar);
$Calendar = mysql_query($query_limit_Calendar, $vonbarlow) or die(mysql_error());
$row_Calendar = mysql_fetch_assoc($Calendar);

if (isset($HTTP_GET_VARS['totalRows_Calendar'])) {
  $totalRows_Calendar = $HTTP_GET_VARS['totalRows_Calendar'];
} else {
  $all_Calendar = mysql_query($query_Calendar);
  $totalRows_Calendar = mysql_num_rows($all_Calendar);
}
$totalPages_Calendar = ceil($totalRows_Calendar/$maxRows_Calendar)-1;
?>

Any answers are appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top