[Wolves] Any PHP/MySQL experts who can help me?

Mike Peters mike at ice2o.com
Wed May 9 19:38:28 BST 2007


Hi,

I didn't catch the start of this thread so apologies if I'm repeating
anything which has already been said.

It looks like session data is not been written or is being
"lost". You can confirm this by trying to print out the session data.
Try the following in place of your normal logout script:

<?php

session_start();

include 'dbcon.php';

echo "Session Data:";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";

// Show your sql query
$userID = $_SESSION['user'];

$query = "UPDATE userAccount SET loggedOn = 'N' WHERE userID =
'$userID' ";

echo "<b>My query is:</b> $query";

?>


This will show you what is contained in the session data and what the
actual sql query you are trying to execute is. My guess is you will find
that $userID is empty, ie you mysql query looks something like "UPDATE
userAccount SET loggedOn = 'N' WHERE userID = ''".

This is most likely because the location where session data is stored
is not accessible when you are calling your logout script or that the
data wasn't written in the first place. In which case you need to set
the session save path to a directory you have write access to, local to
your site. Do this by adding:

php_value session.save_path /home/me/tmp

in a .htaccess file. Obviously set the path /home/me/tmp to something
relevant. Alternatively set the same by calling:

session_save_path ( "/home/me/tmp" );

in every file before you call session_start(). Note that the
directory /home/me/tmp (or whatever) should definitely not be accessible
by your web users.

On your home server, everything works because, most likely, the session
save path is set to the default of /tmp, which you have access to. On
sourceforge that will not be the case.

HTH
-- 
Mike
Web Site: http://www.ice2o.com
JabberID: mpeters at jabber.org
Registered Linux User #247123

BOFH excuse #218:

The UPS doesn't have a battery backup.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/wolves/attachments/20070509/77e69c9a/signature.bin


More information about the Wolves mailing list