...

View Full Version : Session problem



Dan13071992
12-19-2010, 03:37 PM
ive been having a bit of trouble with a new project im working on, it now keeps you logged in as before it didnt however once you logged in before you could see what was on the page now it just keeps you logged in but you cant see anything, i will show you the old scripts and the new.

NEW

Login Check:

<?php

if (isset($_SESSION['uID'])) {
$query=mysql_query("SELECT * FROM users WHERE id=".$_SESSION['uID']);
$user=mysql_fetch_object($query);
}
function logincheck(){
if (empty($_SESSION['uID'])){
header('Location: index.php');
exit;
}}
?>

Updates:


<?php
include('includes/db_connect.php');
include('includes/inc-logincheck.php');
include('includes/inc-functions.php');
//include('includes/smile.php');
$strTitle='Welcome';
$strMessage='';

$intUserID=$_SESSION['uID'];
$fetch=$user;
include('includes/inc-head.php');
?>


OLD

Login Check:


<?php
if (isset($_SESSION['uID'])) {
$query=mysql_query("SELECT * FROM users WHERE id=".$_SESSION['uID']);
$user=mysql_fetch_object($query);
} else {
header('Location: index.php');
exit;
}
?>

now I know its something to do with the login check. can anyone please help :(

abduraooft
12-19-2010, 03:52 PM
ow it just keeps you logged in but you cant see anything, i will show you the old scripts and the new. I think you missed the important part, a call to function session_start() at the top of all pages.

.. and where's the call to logincheck() ?

Dan13071992
12-19-2010, 04:00 PM
well this is the error that comes up with putting session_start() in the first line of every page


Parse error: syntax error, unexpected T_INCLUDE in /home/tacticsc/domains/360-tactics.co.uk/public_html/crimewave/adminupdates.php on line 3

i fixed that, however the same problem exist with not being able to see what is on the page except for the background colour

Dan13071992
12-19-2010, 04:48 PM
<?php
include "config.php";
session_start();
include_once "db_connect.php";
$username=$_SESSION['username'];
function logincheck(){
if (empty($_SESSION['username'])){
echo "
<SCRIPT LANGUAGE='JavaScript'>
window.location='index.php';
</script>
";

exit();

}}


that was how the old logincheck worked when it was in my functions.php now i have a new functions that isnt included yet and has nothing to do with the login.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum