Hi Guys and Gals,

I'm a graphic designer working on a website for a client, but since I've never done a website of this magnitude before, I'm needing some help with PHP - a language that I'm crash-coursing on, but I'm no where near where I need to be. I'm hoping that you'll be willing to help.

My client wants his users to pick one of three sections of the site as their home site - call them A, B and C. When they enter the site, they go to A automatically and choose one of the sections during registration. From that point on when they sign in, the template page will say something to the effect of "Welcome User to the C Network". I've created three different templates in three different folders but rather than tripling the number of pages, I've added a "php include" to the top of every page that will check the login information for the user in the database and add their template to the page.

I've started the script by stealing elements from a 'member search' script, but I lost track of my own logic; and I know it's nowhere near complete.

If this script doesn't help then please feel free to chuck it.


// Connect to database
include_once "../scripts/connect_to_mysql.php";
$queryString = "WHERE email_activated='1' ORDER BY id ASC";

$sql = mysql_query("SELECT id, user_name, home_network, FROM uwnsignup $queryString"); 

$outputPage = '';
while($row = mysql_fetch_array($sql)){ 

	$id = $row["id"];
	$user_name = $row["user_name"];
	$home_network = $row["home_network"];

$outputTemplate .= '

Thanks in advance for even reading this post, and more so, for any help you're willing to give. I'm sure you'll have more questions about what I intend with this script, feel free to toss them at me.

Ron Gulette

8 Years
Discussion Span
Last Post by almostbob


Exactly what u want to do.
Tell me step by step then, I can help u. Also show what code u have entered in "connect_to_mysql.php" file.


Javed Sai


Thanks Javed,

When a guest comes on the site he will be directed to SITE-A as a guest. If he decides to become a member he will be asked if he wants to remain a member of SITE-A, or to choose SITE-B, or SITE-C as his "home network". All sites use the same page structure, but each has different stages of privileges (members of Sites B & C can look at Site A, Site C can look at A & B, but neither A, nor B can look at C without an invitation) So when a user signs up, they'll choose their home network, and every time they login they will view only Site-A, or B, or C what ever they've chosen. What will happen is this script (above) will view their sign up data and then steer them to their home pages. Each page (ie: AboutUs.php) will have an include ("user_Header.php") which is the above script. Whenever they go to a page the include will direct them to the navigation of their home_network: Network_A.php, Network_B.php, or Network_C.php.

The connect to mysql file is just the connect script for the database, and you won't need that information.

What I think you need are the fields for the signup table: user_id, user_name, firstname, lastname, home_network, password, acct_privileges, country, email_activated, sign_up_date, & aree_to_terms. Then there's the membersprofile table that has all of the rest of the user's profile information.

IF I've left any details out, please write me again.


Just off the top of my head, I am concerned that this job is usually exceeds a graphic designers skillset, but it does it seems like your already into it so I will try to lend some help.

On your login script page, clean the username and password to help to prevent hacking attempts. In other words, validate that the characters posted can be safely executed in sql. This is not always straight forward, and good user input validater is HTML PURIFIER and some prefer HTMLAWED. Assuming that the login cred is correct, use a select statement (Limit 1) to get there information and store it into an array for later access or into individual session vars. If access level, email_activated, acct_privileges, & argee_to_terms are valid, redirect user to the associated page based on access level. You can use php redirect or javascript to accomplish this. If your outputting data to the page in the process, you might just want to use javascript to redirect. The invitation to goto C for lesser account holders is going to require a conditional statement in the header, and probably an additional feild in the database for the invitation and perhaps another field for the length of time in which he/she can take advantage of that invitation.


'Just off the top of my head, I am concerned that this job is usually exceeds a graphic designers skillset, but it does it seems like your already into it so I will try to lend some help.'

Way beyond. LOL! I took on the job thinking it would be some good money and a great piece for my portfolio. The look of the site is awesome (if I do say so myself), and the ideas that my client and I have decided upon are very cool, but I'm very new to php, and I'm trying to grasp it (hell, I had trouble with BASIC in high school).

Any and all help is greatly appreciated.

Unfortunately, EverWebby, you were speaking Greek and I have no idea what I should do next.



have you considered hotscripts phpscripts sourceforge to download prewritten user access control scripts
if you do not use them in their premade form, as a code sample will provide valuable, easily developed insight into how the problem of redirectiog users based on stored information can be approached
possible examples in this google search

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.