Page 1 of 1

Problem with php sessions?

Posted: Tue Apr 10, 2007 7:45 pm
by Vera
Script URL: http://www.cadena-lirica.com/libretto/gbook.php
Version of script:1.5
Hosting company: trans-it.nl
URL of phpinfo.php: http://www.cadena-lirica.com/libretto/phpinfo.php
URL of session_test.php: http://www.cadena-lirica.com/libretto/session_test.php
What terms did you try when SEARCHING for a solution: php sessions, security image

Write your message below:

GBook is a simple but elegant guestbook script; exactly what I was looking for. Therefore I hope I can solve the problem I'm experiencing with the security images.

I installed the script exactly according to the instructions in the manual. (I only made a few changes to the css file). The permissions for the renamed entries text file and banned-ip.txt I set to 666.

The gd_test.php file works. But still I get the message: "wrong security code" without an image showing when I set autosubmit to 1. Even when I set autosubmit to 2 no text-based security number shows, only the message "wrong security code". Other browsers and computers show the same results.

By now (after reading half of the forum) I figured it probably has something to do with php sessions. So I send an e-mail to trans-it support. Unfortunately it takes them some time to ponder....it's been over a month now. I've resend the e-mail, but don't expect too much from them.

When anyone reading this has some useful tips it will be greatly appreciated.

Regards,
Vera

Posted: Tue Apr 10, 2007 10:19 pm
by Klemen
Hi,

The problem is probably that PHP on your server is set to automatically start sessions.

Try uploading the .htaccess file inside this Zip to your "libertto" folder:
http://www.phpjunkyard.com/extras/sessi ... access.zip

Inside is a .htaccess file that locally disables session auto-start. Make sure you upload the .htaccess file in ASCII mode and it must be named exactly ".htaccess"

Upload, close ALL browser windows and test it. Come back with results.

Posted: Wed Apr 11, 2007 7:43 pm
by Vera
Hi Klemen,

First of all thanks for the fast reply!

I uploaded the .htaccess file like you advised. Unfortunately it doesn't solve the problem. I tried it with the autosubmit option set to 1 as well as setting it to 2. This gives the same results as described in my first post (tested with different browsers on different computers to be sure).

Posted: Thu Apr 12, 2007 11:21 am
by Klemen
Is the htaccess file uploaded now? It doesn't seem so.

Or you can contact your host and ask them if they can disable PHP session.autostart locally for your http://www.cadena-lirica.com/libretto folder.

OR you can see if this helps:
- open gbook.php in Notepad
- find and delete these two lines 45 and 46:

Code: Select all

session_name('GBOOK');
session_start();
- save changes and upload the edited gbook.php
- do the same with file "print_sec_img.php" (lines 2 and 3)

Then close all browser windows and test if it works.

Posted: Thu Apr 12, 2007 7:44 pm
by Vera
Ah, I've got it! :D

I did upload the .htaccess file yesterday, so I tried editing the gbook.php and print_sec_img.php first. This option works!

But I also wanted to make the option with the .htaccess to work. The .htaccess file has the line "php_value session.auto_start 1" in it. When I looked in my phpinfo file, the session auto start was already on. So I changed the line into "php_value session.auto_start 0" and uploaded this .htaccess file and the original gbook.php and print_sec_img.php. And now I have this working too!

Thanks for your help,

Vera

Posted: Thu Apr 12, 2007 9:19 pm
by Klemen
Hi,

Oh, my mistake, should be autostart 0 of course :oops:

Glad to hear you got it working though :wink: