session problem?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

session problem?

Post by pleigh »

don't know if this is a session problem,...i have a login page so i can have full access to the web page, unfortunately, when any user tried to access, for example the index.php page without logging in, he can access the page but have errors in session for he does not provide anything to be authenticated.....my idea is to limit them from accessing other pages without logging in.....in my login page, i have declared session keys....so every page of my site has this code session_start()....how can i solve this problem?

thanks a lot..
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

You'll need to show us your code
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post by pleigh »

i included the session_start() to the header.inc file then all pages are includeing the header.inc

Code: Select all

<?
session_start();
require_once ('dbconnect.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><? echo $pagetitle ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="templates/site.css" type="text/css">
</head>

<body bgcolor="#000000" topmargin="2" leftmargin="2" rightmargin="2" bottommargin="2">
<div align="center">
this is the header....i want to code somehting that prevents the user from going straight to the page if the user is not logged in
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what are these "errors" ?
Post Reply