Page 1 of 1

Must be logged in when adding images to entries. [SOLVED]

Posted: Sat Jan 15, 2005 12:47 am
by leonardb
When making an entry and trying to add images i get the error.

"You have to be logged in to view this page

i'm obviously logged in as i'm making an entry :)

any help is appreciated..

Re: Must be logged in when adding images to entries.

Posted: Sat Jan 15, 2005 3:14 pm
by garvinhicking
It seems your PHP sessions are wrongly configured. Check all session relevant settings (especially session.save_path) and check your phpinfo() output to see that sessions are enabled. Also make sure your browser supports cookies.

Regards,
Garvin

Re: Must be logged in when adding images to entries.

Posted: Sat Jan 15, 2005 3:30 pm
by leonardb
garvinhicking wrote:It seems your PHP sessions are wrongly configured. Check all session relevant settings (especially session.save_path) and check your phpinfo() output to see that sessions are enabled. Also make sure your browser supports cookies.

Regards,
Garvin
From the phpinfo output

Session Support enabled

session.name PHPSESSID PHPSESSID


session.save_path /tmp /tmp (path does exist)

thanks for the help.. cookies are enabled.

Re: Must be logged in when adding images to entries.

Posted: Sat Jan 15, 2005 3:39 pm
by garvinhicking
Is your /tmp path world-writable? Which Linux/Unix are you using, and which PHP version?

Re: Must be logged in when adding images to entries.

Posted: Sat Jan 15, 2005 3:56 pm
by leonardb
garvinhicking wrote:Is your /tmp path world-writable? Which Linux/Unix are you using, and which PHP version?
path is world writtable

using Gentoo Linux

PHP= PHP/4.3.10

thanks..

Re: Must be logged in when adding images to entries.

Posted: Sat Jan 15, 2005 4:45 pm
by garvinhicking
Please save this file as test.php and execute it:

Code: Select all

<?php
session_start();
$_SESSION['dummy'] = time();
?>
<html><body>
<?php
if ($_GET['output'] == 'true') {
    echo 'DUMMY IS: ' . $_SESSION['dummy'];
} else {
    echo '<a href="#" onclick="window.open(\'test.php?output=true\')">click me and read ' . $_SESSION['dummy'] . '</a>';
}
?>
</body></html>
This is a simple test to see if sessions work properly on your machine. When calling the file via HTTP you should see the output "click me and read XXXXX" whereas XXXX is an integer. When you click the link a new window should open and give you the same integer number.

If it doesn't, then either your PHP sessions don't work properly, or the cookie support is deactivated, or your browser does have problems with cookies.

If it works, then there's a bug within Serendipity and I'll try to catch it; but I may need a simple user account access to your blog then...

Regards,
Garvin

Posted: Sat Jan 15, 2005 4:49 pm
by leonardb
ok ..

test.php opens..

click me and read 1105803454


when i click it, i get

DUMMY IS: 1105803507


so the problem, is on my end, just great!

any suggestions? im not too knowledgeable about sessions..

Posted: Sat Jan 15, 2005 4:56 pm
by leonardb
could it possibly be

The domain for which the cookie is valid.
session.cookie_domain =

its blank .. but i do host multiple domains?

Posted: Sat Jan 15, 2005 5:02 pm
by garvinhicking
Argh, I'm sorry, the test.php code was wrong. Please try again with this:

Code: Select all

<?php
session_start();
?>
<html><body>
<?php
if ($_GET['output'] == 'true') {
    echo 'DUMMY IS: ' . $_SESSION['dummy'];
} else {
    $_SESSION['dummy'] = time();
    echo '<a href="#" onclick="window.open(\'test.php?output=true\')">click me and read ' . $_SESSION['dummy'] . '</a>';
}
?>
</body></html>
(session.cookie_domain is right for you!)

Posted: Sat Jan 15, 2005 5:04 pm
by leonardb
garvinhicking wrote:Argh, I'm sorry, the test.php code was wrong. Please try again with this:

Code: Select all

<?php
session_start();
?>
<html><body>
<?php
if ($_GET['output'] == 'true') {
    echo 'DUMMY IS: ' . $_SESSION['dummy'];
} else {
    $_SESSION['dummy'] = time();
    echo '<a href="#" onclick="window.open(\'test.php?output=true\')">click me and read ' . $_SESSION['dummy'] . '</a>';
}
?>
</body></html>
(session.cookie_domain is right for you!)
Now it looks right

click me and read 1105804431

DUMMY IS: 1105804431

So cookies and sessions is working correctly..

Posted: Sat Jan 15, 2005 5:12 pm
by garvinhicking
Hm, now I'm a bit out of clues.

Could you create me a simple Userlevel 0 account on your blog, so I could try it on your machine, please? If yes, please mail me privately at "serendipity (at) supergarv [dot} de"

Posted: Sat Jan 15, 2005 5:27 pm
by leonardb
garvinhicking wrote:Hm, now I'm a bit out of clues.

Could you create me a simple Userlevel 0 account on your blog, so I could try it on your machine, please? If yes, please mail me privately at "serendipity (at) supergarv [dot} de"
done, you've got mail :)

Posted: Sat Jan 15, 2005 6:58 pm
by leonardb
i think maybe it was because i did have sessions set to a single domain. then after clearing it and leaving it blank. i had to log out and relog back in but clear cookies before.. now it all works .. garvin you rock ..

Posted: Sat Jan 15, 2005 7:12 pm
by garvinhicking
Phew, great we figured that out finally :-D

Regards,
Garvin