Skip to main content
Inspiring
March 7, 2007
Question

Restrict Access to Page (k)

  • March 7, 2007
  • 28 replies
  • 2430 views
I know just enough PHP to get myself in trouble.

I'm working on a simple employment section for one of my clients. All
PHP pages work, but now I am trying to make some of them password protected.

I have a table in mySQL with a username and password.

I have a form in a webpage with spaces to write the username and
password. I used the Login User server behavior through Dreamweaver. It
appears to work since the user jumps to the page I want them to instead
of the failure page.

The problem is that once on that page the user gets kicked off. That
page I used the Server Behavior "Restrict Access to Page". Instead of
seeing a valid login, it kicks the user to the page indicated in a
failed login.

Any ideas?

-Kirk
This topic has been closed for replies.

28 replies

Inspiring
March 8, 2007
W. Kirk Lutz wrote:
> Dreamweaver's wrote this code on the page the login page jumps to after
> login:
>
> //initialize the session
> if (!isset($_SESSION)) {
> session_start();
> }

Fine. That means you have the code for starting a session. However, you
also need to check that your server supports sessions. Most do, but you
can find out by running phpinfo(). Details of session support are very
close to the bottom of the page. It needs to say Session support
enabled. You also need to make sure that session.save_path points to a
valid folder.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
March 8, 2007
Dreamweaver's wrote this code on the page the login page jumps to after
login:

//initialize the session
if (!isset($_SESSION)) {
session_start();
}



David Powers wrote:
> W. Kirk Lutz wrote:
>> How do I continue a session?
>
> You need this at the top of the page:
>
> <?php session_start(); ?>
>
> http://www.php.net/manual/en/ref.session.php
>
Inspiring
March 8, 2007
W. Kirk Lutz wrote:
> How do I continue a session?

You need this at the top of the page:

<?php session_start(); ?>

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

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
March 8, 2007
W. Kirk Lutz wrote:
> No idea. They need to be in order for this to work?

Yes.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
March 7, 2007
How do I continue a session?

-Kirk

lands1ide wrote:
> Try to continue a session on each page. This has worked for me. Not sure if it is the correct method but it works.
Inspiring
March 8, 2007
once you get passed the login page create a recordset using a table that has their info. For example a table with the users names. When creating the recorset use a unique filter such as ssn then change where it say URL perimiter to session varable then to the left input MM_Username and hit ok. Then on the page you created the recordsent insert application object then go to dynamic text and select something like thier name to display at the top. Then if the page is attempted to be access without logging in it wil display an error and no information will be shown. continue this method on each page until the session ends then close the session. I hope that helps.
Inspiring
March 7, 2007
Try to continue a session on each page. This has worked for me. Not sure if it is the correct method but it works.
Inspiring
March 7, 2007
No idea. They need to be in order for this to work?

-Kirk



David Powers wrote:
> W. Kirk Lutz wrote:
>> The problem is that once on that page the user gets kicked off. That
>> page I used the Server Behavior "Restrict Access to Page". Instead of
>> seeing a valid login, it kicks the user to the page indicated in a
>> failed login.
>
> Are sessions enabled on your server?
>
Inspiring
March 7, 2007
W. Kirk Lutz wrote:
> The problem is that once on that page the user gets kicked off. That
> page I used the Server Behavior "Restrict Access to Page". Instead of
> seeing a valid login, it kicks the user to the page indicated in a
> failed login.

Are sessions enabled on your server?

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/