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

Philip Harper ph004h7245 at blueyonder.co.uk
Mon May 14 19:52:02 BST 2007


Right, now fixed it!

It was just a problem with a mistyped session variable, and where I was 
including db connection settings file.  Sourceforge lets you save your 
PHP sessions in /tmp/persistent/<YOUR PROJECT NAME> and I had already 
set this up.

Mike Peters wrote:
> 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
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wolves LUG mailing list
> Homepage: http://www.wolveslug.org.uk/
> Mailing list: Wolves at mailman.lug.org.uk
> Mailing list home: https://mailman.lug.org.uk/mailman/listinfo/wolves





More information about the Wolves mailing list