Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

PHP session detection

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

PHP session detection

Postby musicmaster » Tue Apr 23, 2013 4:23 am

I am writing a script that other people should use on their servers. It uses passwords and sessions for security.

My problem is that many people have set their servers wrong so that they don't have writing rights in the directory meant for storing session data. As it is a free script and I don't want to spend lots of time on support for those cases I want to use cookies instead. My problem is that I don't know how to detect that the directory is write-protected.

Session_start() returns true and I can set and retrieve session_variables when the session directory is write protected. The problem only start when I redirect with a "header: location" to another page. So I am puzzled how I can detect the problem while I still am inside the login page.
musicmaster
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Apr 23, 2013 4:16 am

Re: PHP session detection

Postby johnj » Tue Apr 23, 2013 5:49 am

Please read about the php built-in function called is_writable(). That will tell you whether a directory is writable or not. http://php.net/manual/en/function.is-writable.php
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: PHP session detection

Postby musicmaster » Tue Apr 23, 2013 1:01 pm

Thanks, Johnj, that was just what I was looking for.
musicmaster
New php-forum User
New php-forum User
 
Posts: 2
Joined: Tue Apr 23, 2013 4:16 am


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.