Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 09-14-2004, 07:17 PM   #1 (permalink)
Monster Techie
 
Join Date: May 2004
Location: Tucson, AZ, USA
Posts: 1,184
Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Question User Validation/LARGE web site, suggestions on how to do this?

I have a fairly large web site, and just recently added the ability for users to login/store preferences ETC. While that is great, I'm trying to figure out a way to have a nice easy-to-format page, and right now...can't figure a good way to do this! Here's what I'm trying to do...

Index.php
this page contains all the formatting, normal nav. bar, Etc. And links all other pages to it.
Such as...
<?php
session_start();
$topic=$_GET['topic'] . ".php";
if (!$topic) {
$topic="home.php";
}
?>
<html>
<title>Blah</title>
<body>
<?php include("nav.php"); include("$topic"); ?>
</body>
</html>

But I'm lost on how to ensure the user is validated on certain pages that are within the page. Since all pages are included...I'm not sure how to control whether the information is shown.

I'm using "links.php" as an example, and have been fiddling with it...also for the user/pass, I'm using MySQL...but that part is all good and fine!

links.php
<?php require("loginrequired.php"); ?>
http://www.tech-forums.net

loginrequired.php
<?php require("config.inc.php"); ?>
if logged in, show info (in links.php) {
if not, include "login.php".

Anyways...I'm pretty sure the part it's getting screwed up is with the multiple php tags in one another, such as:
<?php include("links.php") ?>

which would turn to...
<?php
<?php require("loginrequired.php"); ?>
http://www.tech-forums.net
?>

Ugh, as you can probably guess I'm not very good with this, and would appreciate any suggestions. Also know, the whole point of doing this is to (hopefully) be able to re-design/do any part of it without going into each page and editing the code (such as the login, general site design etc).

Thanks...hope this makes sense...!!
Vormund is offline   Reply With Quote
Old 09-15-2004, 09:28 PM   #2 (permalink)
Super Techie
 
Join Date: Apr 2004
Posts: 316
Default

I'm not familiar with sessions but I imagine you can like check if it's active or if a cookie is stored. If you have includes you can check the session/cookie on each page and a simple if statment can't deny them access if they aren't logged in or allowed.

Unfourtunately I don't know sessions or cookies so I can give you an exact answer.
__________________
BlazingWolf



Gaming-Forums.org


BlazingWolf is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 10:34 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0