This is a discussion on "Restrict Access To Page / php MySQL / DW" within the Databases section. This forum, and the thread "Restrict Access To Page / php MySQL / DW are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Restrict Access To Page / php MySQL / DW
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Restrict Access To Page / php MySQL / DW
Working through a Dreamweaver tutorial.
I have connected to a MySQL database using PHP. Set up Registration and Sign in Pages. These save to the database fine. Now I want to restrict access to pages before users sign in. I am using Dreamweaver Restrict Access To Page, server behaviour, but even when logged in, it restricts access and redirects to the sign in page?? All I can think is it is a session variable problem, I have copied the completed tutorial files onto my server and they still dont work. Is there a way to test if session variables are working?? The tutorial is pretty much the same as on here: http://www.macromedia.com/devnet/dre..._users_08.html Let me know if you want to see any code........... Last edited by Andy K; Feb 17th, 2006 at 18:22. |
|
|
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
This example assumes that the login page sets the session 'MM_level' retrieved from the db and that admin is level 1 and clients are level 0 and that you wish to restrict clients from lets say the admin area and redirect them to the clients area.
Quote:
Quote:
A quick test of whether a session is being passed is to set up 3 pages all beginning with session_start();. On the 1st page set the session and then either redirect to the 2nd page or have a basic link. On the 2nd page just have a basic link to the 3rd. On the 3rd page echo the session from the 1st page. |
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
Hi, thanks great help, but I am still having problems with the session variables.
I applied your code and it redirects correctly, or at least back to the login page. So I tried what you suggested for testing the session. 3 Pages, each with session_start(); at the top. signin.php This snipet of code declares the session variables,
This is the page users are directed to after successfull sign in. I setup a variable:
<p> <?php echo $MYusername; ?> </p> But nothing appears...... restricted.php This page is accessed via a link on the welcome page. And includes access code.
my UserGroup is set to either admin or visitor.. Is there anyting you can see which might be wrong? Does this look like the sessions are not active? |
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
This will be quick as I have to go out, but it looks like the session is not being registered:
|
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
A quick test to check go to:
http://www.choosespain.com/session1.php and click the link you should be shown the word Test on its own. Right gotta go... |
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
Thanks I will test after the match!!
|
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
Ok! Your link works correctly, the word 'Text' is shown.
I have done an exact copy on my server and it does not work..... http://www.graphicallies.com/test1.php ...... So it must be a server config issue..? I am running on Windows 2003 server with php installed, but I am not sure what version of php it is, waiting for my isp to get back to me. A quick search on the web at http://uk2.php.net/session , I found info about Quote:
|
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
I have successfully changed the path using session_save_path
I assigned to variable walkPATH to check using echo....
session_save_path("/domains/mydomain.com/sess"); session_start(); At the start of each page. However the session vars are still not being passed. So another search on the net and I found: To be able to use session variables in sites on a windows environments, you have to set session_set_cookies = 1 in php.ini. Im running off a commercial server, so I guess access to php.ini will be restricted, so I will contact my host providers. Am I on the right track here? This is really a php topic now, but with it involving a database I posted it in here. |
|
|||
|
Re: Restrict Access To Page / php MySQL / DW
I'm not sure how much of the php.ini files you can change, but it can be done either in script or htaccess using ini_set() http://www.php.net/manual/en/function.ini-set.php
however this is at the limit of my knowledge since I've not had the need to use it. To find out what version of php and the ini settings your server runs, create a blank php page with the code
|
![]() |
| Tags |
| restrict, access, page, php, mysql |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Best way to prevent access to page B except via page A? | Donny Bahama | PHP Forum | 1 | Apr 3rd, 2008 02:15 |
| How to connect the microsoft access database using HTML page | mazenbluee | Databases | 5 | Nov 21st, 2007 06:49 |
| Restrict Access | Mike Henson | JavaScript Forum | 17 | Sep 10th, 2007 09:47 |
| Printing single record from Access via Report in Web Page | Neotekk | JavaScript Forum | 0 | Jun 18th, 2007 15:20 |
| Access a HTML InputBox through the Code-Page | bwalker | ASP.NET Forum | 5 | Nov 10th, 2005 12:58 |