Skip to main content
Participant
June 9, 2006
Question

PHP: Restrict access to a section of code

  • June 9, 2006
  • 3 replies
  • 589 views
hi guys,

I have implemented the login/user auth sections of my webby without any problems. Ive used the built in server behaviours in DW8. So i have a session variable called MM_username.

now instead of restricting access to a whole page, i just need to restrict access to certain sections inside a page. For example i have a user admin panel that i only want to show if they are logged in. and i only want the logout button to show if they are logged in etc.

im not great at hand coding php yet , so any help would be greatly appreciated.

thanks,

ted.
This topic has been closed for replies.

3 replies

Participant
June 9, 2006
oops i meant to put it in appdev :) thnx
Inspiring
June 9, 2006
On 09 Jun 2006 in macromedia.exchange.extensions.dreamweaver, tedrodgers
wrote:

> hi guys,

By the way: you'd be much better off in the macromedia.dreamweaver or
macromedia.dreamweaver.appdev groups; this group is fairly low volume.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Inspiring
June 9, 2006
On 09 Jun 2006 in macromedia.exchange.extensions.dreamweaver,
tedrodgers wrote:

> I have implemented the login/user auth sections of my webby without
> any problems. Ive used the built in server behaviours in DW8. So i
> have a session variable called MM_username.
>
> now instead of restricting access to a whole page, i just need to
> restrict access to certain sections inside a page. For example i
> have a user admin panel that i only want to show if they are logged
> in. and i only want the logout button to show if they are logged in
> etc.

<?php if($_SESSION['MM_username']) { ?>
<!-- HTML code you want displayed goes here -->
<form name="logoutform" method="POST" action="logout.php">
<input type="submit" name="Submit" value="Log Out">
</form>
<?php } ?>

http://www.php.net/manual/en/ref.session.php

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php