Hello there! Im quite new to php, I've done some coding of it before but I gues im still new, so go easy on me! 🙂 ive got stuck with getting a client backend of a site working and im almost there but stuck at the last bit......
Ive got three files, one called user_login_st1.php, the second called user_login.php and the third called logon_common.php.
The first of these files is what the user is redirected to after the index page after putting in their user ID and pass. it puts these basically into variables and then redirects to user_login which checks the login details, and sets up the page, which shud end up in a client area. Within the user_login page is an /include referance which links it to logon_common. this contains key variables for the login process and this is where im stuck....
Extract from logon_common.php:
// Site dir
$site_root_dir = "../";
// Images
$site_image_rel_url = "../resources/images/";
$site_image_root_dir = $site_root_dir."resources/images/";
$site_image_temp_dir = $site_root_dir."resources/temp/";
$site_ssl_url_abs_image_url = $site_ssl_url."resources/images/";
// Logos
$site_logo_rel_url = "../resources/logos/";
$site_logo_root_dir = $site_root_dir."resources/logos/";
$site_logo_temp_dir = $site_root_dir."resources/temp/";
$site_ssl_url_abs_logo_url = $site_ssl_url."resources/logos/";
// Stationary
$site_stationary_rel_url = "../resources/stationary/";
$site_stationary_root_dir = $site_root_dir."resources/stationary/";
$site_stationary_temp_dir = $site_root_dir."resources/temp/";
$site_ssl_url_abs_stationary_url = $site_ssl_url."resources/stationary/";
// Collateral
$site_collateral_rel_url = "../resources/collateral/";
$site_collateral_root_dir = $site_root_dir."resources/collateral/";
$site_collateral_temp_dir = $site_root_dir."resources/temp/";
$site_ssl_url_abs_collateral_url = $site_ssl_url."resources/collateral/";
// Tasklist
$site_tasklist_rel_url = "../resources/tasklist/";
$site_tasklist_root_dir = $site_root_dir."resources/tasklist/";
$site_tasklist_temp_dir = $site_root_dir."resources/temp/";
$site_ssl_url_abs_tasklist_url = $site_ssl_url."resources/tasklist/";
// Resources
$site_repository_rel_url = "repository/files/";
$site_repository_root_dir = $site_root_dir."client_area/repository/files/";
$site_repository_temp_dir = $site_root_dir."client_area/repository/temp/";
$site_ssl_url_abs_repository_url = $site_ssl_url."client_area/repository/files/";
$site_collateral_repository_rel_url = "repository/collateral/";
$site_collateral_repository_root_dir = $site_root_dir."client_area/repository/collateral/";
$site_collateral_repository_temp_dir = $site_root_dir."client_area/repository/temp/";
$site_ssl_url_abs_collateral_repository_url = $site_ssl_url."client_area/repository/collateral/";
$site_branding_repository_rel_url = "repository/branding/";
$site_branding_repository_root_dir = $site_root_dir."client_area/repository/branding/";
$site_branding_repository_temp_dir = $site_root_dir."client_area/repository/temp/";
$site_ssl_url_abs_branding_repository_url = $site_ssl_url."client_area/repository/branding/";
$site_generated_pdfs_repository_rel_url = "repository/generated_pdfs/";
$site_generated_pdfs_repository_root_dir = $site_root_dir."client_area/repository/generated_pdfs/";
$site_generated_pdfs_repository_temp_dir = $site_root_dir."client_area/repository/temp/";
$site_ssl_url_abs_generated_pdfs_repository_url = $site_ssl_url."client_area/repository/generated_pdfs/";
// Used for currency images
$currency_rel_url = "images/currency/";
// Database control
include "config/config.php";
//////////////////////////////////////////////////////////////////////////////////
// path for cookies
$cookie_path = "/";
[b]$session_path = $site_root_dir."sessions/";[/b]
// timeout value for the cookie
$cookie_timeout = 86400; // in seconds (24 hours)
// timeout value for the garbage collector
// we add 300 seconds, just in case the user's computer clock
// was synchronized meanwhile; 600 secs (10 minutes) should be
// enough - just to ensure there is session data until the
// cookie expires
$garbage_timeout = $cookie_timeout + 600; // in seconds
// set the PHP session id (PHPSESSID) cookie to a custom value
session_set_cookie_params($cookie_timeout, $cookie_path);
// set the garbage collector - who will clean the session files -
// to our custom timeout
ini_set('session.gc_maxlifetime', $garbage_timeout);
// we need a distinct directory for the session files,
// otherwise another garbage collector with a lower gc_maxlifetime
// will clean our files aswell - but in an own directory, we only
// clean sessions with our "own" garbage collector (which has a
// custom timeout/maxlifetime set each time one of our scripts is
// executed)
//strstr(strtoupper(substr($_SERVER["OS"], 0, 3)), "WIN") ? $sep = "\\" : $sep = "/";
// $sessdir = ini_get('session.save_path');
//echo "1 sessdir=$sessdir<br>";
// if (!is_dir($sessdir)) { mkdir($sessdir, 0777); }
[b]ini_set('session.save_path', $session_path);[/b]
// $sessdir = ini_get('session.save_path');
//echo "2 sessdir=$sessdir<br>";
// now we're ready to start the session
.........
the script continues but the error im getting relates to the writing and reading of temporary files in the sessions folder. This is the error im getting:
Warning: ini_set(): SAFE MODE Restriction in effect. The script whose uid is 10995 is not allowed to access /usr/local/psa/home/vhosts/doyoudream.co.uk owned by uid 0 in /usr/local/psa/home/vhosts/doyoudream.co.uk/httpsdocs/common/logon_common.php on line 180
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/psa/home/vhosts/doyoudream.co.uk/httpsdocs/common/logon_common.php:180) in /usr/local/psa/home/vhosts/doyoudream.co.uk/httpsdocs/common/logon_common.php on line 190
Warning: Cannot modify header information - headers already sent by (output started at /usr/local/psa/home/vhosts/doyoudream.co.uk/httpsdocs/common/logon_common.php:180) in /usr/local/psa/home/vhosts/doyoudream.co.uk/httpsdocs/user_login_st1.php on line 7
I dunno if i got the URL linking for where to save the session files right but I think it's ok?
Im sure the main fault has something to do with the fact that my host has safe mode enabled and as such I cannot read/write to these session files to make script work as my UID is on the script that issues the request but when the files are made they are made with the servers UID, is this correct? and if so is there a workaround that I can do?
I'm on mac OS 10.4.6 and my host is running PHP 4.4.2. thanks in advance of any help, sorry if im being dumb or anything like I said I know a bit but not loads! ta r00ster