Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2003, 01:00 AM
Registered User
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Restrict Accewss to Page Behavior

I am using the Login user and Restrict access for page from the Dreamweaver MX server behaviors panel. Here is my code for the adminLogin.php page
<?php require_once('Connections/newsConn.php'); ?>
// *** Start the session
// *** Validate request to log in to this site.
if (isset($HTTP_POST_VARS['auth_username'])) {
  $FF_rsUser_Source="SELECT auth_username, auth_password ";
  if ($FF_fldUserAuthorization != "") $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
  $FF_rsUser_Source .= " FROM author WHERE auth_username='" . $FF_valUsername . "' AND auth_password='" . $FF_valPassword . "'";
  mysql_select_db($database_newsConn, $newsConn);
  $FF_rsUser=mysql_query($FF_rsUser_Source, $newsConn) or die(mysql_error());
  $row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
  if(mysql_num_rows($FF_rsUser) > 0) {
    // username and password match - this is a valid user
    if ($FF_fldUserAuthorization != "") {
    } else {
    if (isset($accessdenied) && false) {
      $FF_redirectLoginSuccess = $accessdenied;
    $FF_login_failed = false;
    header ("Location: $FF_redirectLoginSuccess");
  $FF_login_failed = true;
  header ("Location: $FF_redirectLoginFailed");

and here is the code from the admin.php page in the admin folder that I am restricting access to for only admin

// *** Restrict Access To Page: Grant or deny access to this page
$FF_authorizedUsers=" admin";
if (isset($HTTP_SESSION_VARS["MM_Username"])) {
  if (false || !(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 = $HTTP_SERVER_VARS['PHP_SELF'];
  $FF_authFailedURL = $FF_authFailedURL . $FF_qsChar . "accessdenied=" . urlencode($FF_referrer);
  header("Location: $FF_authFailedURL");

For some reason I can not make this authenticate. I have a feild in my author table called access_id with a value of admin in it and still this code kicks me to the indexMain.htm page every time.

Can someone help me with this.

Reply With Quote
  #2 (permalink)  
Old June 9th, 2003, 06:11 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

Are you sure that your session mechanism is working correctly? I ran into this issue some time ago and had the same behavior that you described. It turned out that for each hit to the page, a new session was created. Checkout your temp / session folder and see if there are lots of temporary (session) files.

If there are, try out a few simple .php pages that start a session, and set some variables and see if you can get that to work correctly.


Reply With Quote
  #3 (permalink)  
Old June 20th, 2003, 04:53 PM
Registered User
Join Date: Jun 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

You can use this code also to restrict access to protected pages:

(phpversion() > "4.0.6") ? $HTTP_SESSION_VARS = &$_SESSION:"";
if (($HTTP_SESSION_VARS["sessionvarname"]) == ("sessionvarvalue")) {
header("Location: login.php"); }

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
restrict to paste values only jcellens Excel VBA 1 July 18th, 2006 11:36 AM
how can i restrict the acessing except login page. ramana123 ASP.NET 1.0 and 1.1 Basics 0 August 17th, 2005 12:10 AM
Restrict elements guozhang XML 0 April 28th, 2004 02:26 PM
unexpected behavior from microsoft web page ronaldo11 C# 0 July 6th, 2003 09:33 AM

All times are GMT -4. The time now is 04:29 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.