Skip to main content
October 30, 2007
Answered

restricitng access to a page using PHP

  • October 30, 2007
  • 7 replies
  • 536 views
I need to restrict access to a display page that displays DB results from a contact page. The site is on a shared Win hosting plan with the global session variables turned off. I have a login page that works fine, but when I try to implement a "restrict access " server behavior on the display page, the login page just re-directs to the login page. I did research the problem and it appears the global session variables that are set on the login page are not passing, because they are not turned on at the server. So, I need a workaround. If some one could point me in the right direction, I would be grateful. almost done with this site, need to get it done. I can post code if anyone is interested but, it's just the standard server behavior in DW. I know it's cheating but I needed a quick fix, I did hand code my own contact page and the display page. Thanks.
This topic has been closed for replies.
Correct answer Newsgroup_User
steevo2 wrote:
> //declare two session variables and assign them
> $GLOBALS['MM_Username'] = $loginUsername;
> $GLOBALS['MM_UserGroup'] = $loginStrGroup;
>
> //register the session variables
> session_register("MM_Username");
> session_register("MM_UserGroup");

You're using an old version of Dreamweaver. Either update your version
of Dreamweaver or use the hand-coding fix that I posted in the friends
of ED forum three-and-a-half years ago:

http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=8033053165&m=324102421

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

7 replies

October 31, 2007
Oops, should have made that a new post instead of editing the thank you post above, but in case you didn't see it David :

quote:

Thanks David,
Coded up those changes, it worked well. Thanks! Yes I do have to upgrade DW, but need some money first. Plan on getting CS3 basic web package. And, continue to hone my PHP skills so I can at least recognize when I am using deprecated code. One of the pitfalls of using DW scripts I guess, but I can tell you , this one I will remember. : )
On to the crypt function. Cheers.!


Also , I had posted that last question b4 I got home and tried your fix, my apologies. Thanks again!


Inspiring
October 30, 2007
steevo2 wrote:
> Vamp, Thank you as well!

Unfortunately, the Vampmaster's suggestions won't work.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
October 30, 2007
steevo2 wrote:
> Thanks David, Is that fix just for the login page or is there a code change to the restrict access script as well.?

I no longer have MX 2004 installed, so I can't remember, but I'm fairly
confident that I didn't post just a half-solution. Make the changes
outlined in that post, and test your site. You'll soon see whether it works.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
October 30, 2007
Vamp, Thank you as well!
October 30, 2007
Thanks David,

Coded up those changes, it worked well. Thanks! Yes I do have to upgrade DW, but need some money first. Plan on getting CS3 basic web package. And, continue to hone my PHP skills so I can at least recognize when I am using deprecated code. One of the pitfalls of using DW scripts I guess, but I can tell you , this one I will remember. : )
On to the crypt function. Cheers.!

October 30, 2007
assign the session variables to a variable.

b4 leaving the login page, try

$access=$_SESSION['MM_Username']

another thing that has worked with me is refering to the variable as:

$MM_Username, but i'm not sure that will work everywhere
Newsgroup_UserCorrect answer
Inspiring
October 30, 2007
steevo2 wrote:
> //declare two session variables and assign them
> $GLOBALS['MM_Username'] = $loginUsername;
> $GLOBALS['MM_UserGroup'] = $loginStrGroup;
>
> //register the session variables
> session_register("MM_Username");
> session_register("MM_UserGroup");

You're using an old version of Dreamweaver. Either update your version
of Dreamweaver or use the hand-coding fix that I posted in the friends
of ED forum three-and-a-half years ago:

http://friendsofed.infopop.net/2/OpenTopic?a=tpc&s=989094322&f=8033053165&m=324102421

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/