473,820 Members | 3,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

restrict user access on certain pages

77 New Member
Hi PPL,

On my website i have setup user log in. once they log in i want to restrict certain users from certain pages.. and on some pages i want the user to enter their username and password again..but i am stuck on how to restrict them.. any user guides on how to tackle this issue..i am using dreamweaver cs3

many thanx
Jun 30 '08 #1
1 3056
whiteyoh
13 New Member
I had this problem. I got over it by using 2 sessions (User and Admin). Each page that contains the session at the top checks to see what type of session the user is in and either allows, or header redirects to the index.

Another way could be to have a separate section. for example

yourdomain.com

and
yourdomain.com/admin

The admin index would be exactly the same, just rename the sessions. You can also use sql statements in the session code too, meaning you could add a column in your user table to include access rights maybe?

Heres an example of what i have used

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. include "conn.inc.php";
  4.  
  5. if (isset($_POST['submit'])) {
  6.   $query = "SELECT username, password FROM user_info " .
  7.            "WHERE username = '" . $_POST['username'] . "' " .
  8.            "AND password = (PASSWORD('" . $_POST['password'] . "'))";
  9.   $result = mysql_query($query) 
  10.     or die(mysql_error());
  11.  
  12.   if (mysql_num_rows($result) == 1) {
  13.     $_SESSION['user_logged'] = $_POST['username'];
  14.     $_SESSION['user_password'] = $_POST['password'];
  15.     header ("Refresh: 5; URL=" . $_POST['redirect'] . "");
  16.     echo "You are being redirected to your original page request!<br>";
  17.     echo "(If your browser doesn't support this, " .
  18.          "<a href=\"" . $_POST['redirect']. "\">click here</a>)";
  19.   } else {
  20. ?>
  21.  
  22.  
Jun 30 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3139
by: Paul | last post by:
Hi all, at present I I've built a website which can be updated by admin and users. My problem, I've combined "log in" and "access levels" to restrict access to certain pages, using the built in "log in" and "user authentication, restrict access to page" features. But I find the after login I constantly get redirected from the restricted pages.
2
5864
by: Jaydeep | last post by:
Hi, I want to restrict any user if he types url directly in the browser without logging to my site. Like for example user should not see any listing page of my web site by typing url http://localhost/customerList.aspx or something like that, instead he should first login and then access this page. How to achieve this functionality. In classical ASP we used to include a common file which checks if cookie is set or not or using...
1
3646
by: Dave | last post by:
We have an intranet application that is under Integrated security. So in theory, anyone who has an Active Directory account in the company can access my app. So, to allow only certain users, I created a user table of domain accounts and check these in the Application_AcquireRequestState event by comparing the Identity.Name to names in my table. If OK, I set a session variable HasAccess to "1" since sessions are available in this event....
5
2973
by: toddles666 | last post by:
Hi- Is there any way of restricting access to a database by application & account? For example, I only want the application APP1 to access the database using the USER1 account. I've tried to use the DB2 Governor to do this, but it seems it always allows the the first query to be processed before forcing the connection. Here is my db2gov config file: --- start config
11
2161
by: pemo | last post by:
If you were to compile/run the code below, and get the result '30', I'd be very interested to know what compiler you're using - and its optimisation settings #include <stdio.h> int test(int * a, int * b) { *a = 5; *b = 6;
2
2638
by: Frederick Gotham | last post by:
I'm going to be using an acronym a lot in this post: IINM = If I'm not mistaken Let's say we've got translation units which are going to be compiled to object files, and that these object files will be supplied to people to link with their own projects. Here's a sample function in one of the object files: void Func(int const *const p) {
0
1575
by: kanu | last post by:
Hi, We have moved our domain controllers from win2K to win3K. The script below doesnt work at all now because by default Win3K disables "Network access: Let Everyone permissions apply to anonymous users" GetObject("WinNT://domain/domainController/username,user") We are using GetObject to get the user groups, so as to restrict them to certain parts of the website. It still works with one of the old DC's which is win2K.
2
2575
by: phpnoob | last post by:
I have a php script that processes a form and then posts the user input to a data file on the server in a comma delimited format. For simplicity call the file "data.csv." The script is working well and the data is posted correctly to the data file. The big problem is that anyone can point their web browser to www.mywebsite.com/data/data.csv and see exactly what is contained in the data file. Obviously, I want the data in that file to...
4
11566
by: vinpkl | last post by:
hi i am working on admin section which has a login page with login id and pasword form. in my admin section i have many pages say like manage_products.php, description.php, user.php etc. if i have to access the manage_products.php page then i can access it just typing like the link below http://localhost/vineet/admin/manage_products.php without entering login user and pasword.
0
10713
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10464
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10161
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6911
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5590
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5728
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3049
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.