session getting expired
Posted: Wed Mar 11, 2009 8:37 am
Hi,
I have a file uploading form which uploads the data.
in the upload processing page i have this code
Now the problem is each time i try to upload a file it shows the session has expired. The settings for session in the ini file are as follows
Thought its a time out problem but cant figure out where.. please help
I have a file uploading form which uploads the data.
Code: Select all
//this is at the start of the page to know if the user is logged in or not
//check for session integrity
if(!isset($_SESSION))
{
session_start();
}
//see if the user is authenticated
if($_SESSION['authenticate']!="1")
{
//redirect to session expire page
//this is the form i put in the page
<form action ="uploadvideo.php" method ="post" enctype="multipart/form-data" onsubmit = " return validate_form();">
Upload form to be embedded here.
<br />
<input type="file" id= "uploadvideo" name="video" />
<input type ="submit" value ="UPLOAD" onclick="show_upload();" />
Code: Select all
//check for session integrity
if(!isset($_SESSION))
{
session_start();
echo "Session was not set";
}
//see if the user is authenticated
if($_SESSION['authenticate']!="1")
{
session_regenerate_id();
session_destroy();
include_once("template_start.php");
echo '<FONT COLOR="#FF0000 "><center>
<b>Unauthorized login.. Please Login again</b>
</center></FONT>';
include_once("loginbody.php");
include_once("template_end.php");
exit();
}
include_once("template_start.php");
include_once("utilities.php");
include_once("vars.php");
$loginID = $_SESSION['LoginID'];
//create a unique file name
$unique_filename = generate_random_string(16,$loginID);
//get the original file base name to be stored in database as videoname
$videoname = basename($_FILES['video']['name']);//to be stored in mysql
//check for the file size and send back if not proper
if($_FILES['video']['size']>$g_file_size_limit)
{
echo "File size is more than 12MB cannot upload file<br />";
echo "<a href=\"videolist.php\">BACK</a>";
include_once("template_end.php");
exit();
}
echo "size of the file is ".$_FILES['video']['size'];
//have to move the uploaded file to temp folder for conversion
$temp_path =$g_temp_files_folder.$videoname;
//move the uploaded file to the location
if(!move_uploaded_file($_FILES['video']['tmp_name'],$temp_path))
{
echo "file could not be moved <br />";
echo "<a href=\"videolist.php\">BACK</a>";
include_once("template_end.php");
exit();
}
Code: Select all
session.auto_start Off
session.bug_compat_42 On
session.bug_compat_warn On
session.cache_expire 180
session.cache_limiter nocache
session.cookie_domain no value
session.cookie_httponly Off
session.cookie_lifetime 0
session.cookie_path /
session.cookie_secure Off
session.entropy_file no value
session.entropy_length 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440
session.gc_probability 1
session.hash_bits_per_character 4
session.hash_function 0
session.name PHPSESSID
session.referer_check no value
session.save_handler files
session.save_path no value
session.serialize_handler php
session.use_cookies On
session.use_only_cookies Off
session.use_trans_sid 0