ex: If user=1 send to user1.php page or
if user=2 send to user2.php. else
redirect to user page login page.
cristi08
0
Junior Poster
Recommended Answers
Jump to PostHi cristi08,
In addition to the suggestion from lionaneesh, you could add the following code to the very top of each of the user pages.
<?php session_start(); if (!isset($_SESSION['user'])){ header("location:login.php"); exit(); }
This will prevent anyone from accessing your members pages by surfing directly to the …
Jump to PostSetting the session is fairly simple.
On the page that checks the user login, after they have actually logged in, add the following code.session_start(); $_SESSION['user'] = $username;
I am assuming you have set whatever the username is to the variable $username.
Zagga
Jump to PostOk, lets see if I understand this.
You have a login page that takes the username and password that is typed into the form.
To get the username from the form you must have used something like$username = $_POST['username']
Is that right so far?
Jump to PostIn your database, is there a field that says if the user is type 1 or type 2?
Jump to PostOk
in register.php at lines 128 and 129 you set some session variables
$_SESSION['user_logged'] = $_POST['username']; $_SESSION['user_password'] = $_POST['password'];
add
$_SESSION['utilizator'] = $_POST['utilizator'];
then add the following code to index.php (wherever you redirect the logged in users)
if ($_SESSION['utilizator'] == …
All 24 Replies
lionaneesh
-4
Junior Poster
cristi08
0
Junior Poster
Zagga
Zagga
lionaneesh
-4
Junior Poster
cristi08
0
Junior Poster
cristi08
0
Junior Poster
lionaneesh
-4
Junior Poster
Zagga
lionaneesh
-4
Junior Poster
cristi08
0
Junior Poster
Zagga
cristi08
0
Junior Poster
cristi08
0
Junior Poster
Zagga
cristi08
0
Junior Poster
Zagga
cristi08
0
Junior Poster
Zagga
cristi08
0
Junior Poster
cristi08
0
Junior Poster
Zagga
cristi08
0
Junior Poster
Zagga
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.