How To Ensure Deletion Of Session Files
I am looking for the setting in php.ini what can be configured to make sessions expire and session files removed. Can it be the following entry or is it something else?
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
IE6 & Cookie Deletion
I have always previously always used cookies for authentication and on both sides (Netscape & IE) it has always operated flawlessly. Now that I have finally decided to try out IE6 i'm finding some problems with deleting cookies. Are there any bugs out there that I should know of?
Selecting Db Results For Deletion.
I am having a problem trying to select a number of unique db results from a db driven printed table (using a loop to print). I want the results selected (via a checkbox button) to be identified using their unique ID number, then passed to a php deletion script and deleted from the DB (the ID nums are passed) In other words I am trying to delete threads from a forum DB.
Timed Deletion In Database
Does anybody have any pointers for code that will delete a record by setting an expiration date for it. I want to have news stories delete say 2 weeks after they have been posted automatically, I am using php and mysql?
Deletion And Editing Of Modules
i'm creating a miniature CMS. At the moment i'm working on the creation/deletion and editing of modules. I've got the creation working. But i'm struggling on the deletion and editing. This is what i was thinking: [Deletion] 1. (ID) Module 1 [Delete] (Link: modules.php?do=delete?name=Module%201&id=1) [Editing] 1. (ID) Module 1 [Edit] (Link: modules.php?do=edit?name=Module%201&id=1) How would i make it so the URL was that?
Mass Deletion/Paging
I am a first timer here and I hope to enjoy the forum in the long run. I have a question regarding mass deletion and pagination or paging. I have the following code/method which displays the search result and I want, within the search result, to allow staff or members with appropriate access to be able to delete (multiple records via checklist) records from the database. The methods are under index.php and here is the code below: Code:
How Do I Return Result Of Mysql Row Deletion
The data entered by a user on form 1 on page1.php is posted to delete.php to remove that row from a table. After the SQL operation the user is returned to page1.php. How can I determine the success or failure of the SQL operation so I can display an appropriate response message to the user?
How Do I Ensure That Numbers Are Entered Into A Variable?
I have a page where a customer can input the quanitiy of items they wish to buy of four different things: tires, spark plugs, oil, and engine blocks. I'm trying to ensure that the visitors only put integers into the text boxes but i keep getting errors. Here is my php code that is problematic: Code:
Ensure A Variable Passed Through Through URL Exists?
It just donned on me that I need an error message if someone tries to go to a page with a variable in the URL that doesn't correspond to a database entry. For example, http://www.domain.com/poetry.php?piece=4 does not yet exist. Say I only have three poems in the database right now. What are some ways (or the best way) to make sure the variable leads to content or to otherwise display an error message?
Challenging The User With A Dynamic GIF To Ensure Theyre Human
On some sites there is an image that is dynamically generated at page load, which simply has a few random characters like "a5J7" printed on it (which change with each page refresh), and the user must enter in those characters they see in a textbox as if it was a password. This allows the website to confirm that the visitor is a human, and not just an automated script. Does anyone know how (if?) this can be done with PHP? my Googling wasnt very fruitful :(
Session Files
In developing a recent project, I want to implement a feature, that certain query results will be written to a text file, after the user's session end for twenty minutes, the text file will be deleted automatically. I know in win/IIS/asp how to config this feature, but no idea how to do these in linux/apache/php. Php manual's session_save explain is not helpful enough. Anybody have such experience??
Session Files
Is there a setting to make any session file created expire after a certain time, at which time it gets deleted?
Session Files Will Not Be Deleted
My problem: - i dont wan´t to destroy the session - i want that the session will be deleted by "php" when the gc maxlifetime parameter hits - i can turn this parameter on what i want - nothing will be deleted! - in my specail case - i make use of session_save_path - i use my own Could it be, that "php" doesnt delete session files in own session_save_paths ?
Session Tmp Files Empty
I have PHP 4.0.6 (I'm stuck with this till I can find a hosting company that realizes that upgrading would be a good idea) and I have this simple test: In "test1.php" <? session_start(); $HTTP_SESSION_VARS['test'] = "hey"; header("Location: test2.php"); ?> In "test2.php" <? session_start(); var_dump($HTTP_SESSION_VARS);?> It prints an empty array. So I logged int via telnet and looked at the session files in /tmp and they are all empty and have a file size of 0.
When Do Session Files Get Erased?
I am using filebased sessions with and they get created in a folder called c:php5appssessions I have cookies enabled. I clear the cookies, but when to the session files eventually get erased? Does PHP check the sessions folder everytime for expired sessions and erase them?
Session Management And Include Files
Can I manage my sessions through an include file? Example, can I put the following code into an include file: session_start(); $time = $_SESSION['Time']; $user = $_SESSION['User']; $now = time(); echo $now; echo "<BR>$time"; if($now > ($time + 1200)) { $query2 = "UPDATE users SET online = 'n' WHERE username = '$user'"; $result2 = mysql_query($query2); session_destroy();?> <script language=javascript> window.parent.location.href = "index.php"; </script> <? } Then call it from a normal file like so: include "./sess_mgmt.inc"; Also, can I have an include file inside an include file?
Session Data In Included Files
How does a script access the variables in a session file? Scenario: <?-- this is the main script include("main.inc.php") $Username = $myname //myname is a variable in the session file $html = new html; //html class defined in main.inc.php sneds out headers and so on do lots of other php stuff $html -> send_footer() // found in main.inc.php and itself 'includes' footer.php ?> Now footer.php 'included' from within the function send_footer defined in main.inc.php and called by the primary script wants to access $myname, the session variable that stores my user name. i can't seem to get it at all. Has anyone any idea or am i being too vague here? Do I need to do something else at the beginning of footer.php that 'gets' the variable again from the session file? If so, how? The session ID is accessible to it cos I had it print it out to make sure, and the session file does definately hold a variable of the right name, I just can't return the data for some reason.
How To Delete All Sessions (session Files)?
What line(s) of PHP code can I use to delete ALL existing session files? I tried: $_SESSION = array(); session_destroy(); ......but those two lines appear to only delete the session file that was created for the current session.
File Permissions Of PHP Session Files
I noticed that the file permissions (unix) of the PHP session files have only read and write permissions for the Apache process (600 or rw- --- ---). Does anyone have any idea where this permission is set ? I can't find any umask or chmod settings for it in the php.ini file. Can't find anything in the httpd.conf either. Is it set in the PHP code that implements session_start()?
Type Casting To Float To "ensure Reliable Comparison" ?
Web Database Application with PHP and MySQL, 2nd ed. on chapter 9 the author give an example for age validation : (simplified code, not a direct quote) $dob = mktime(0,0,0, 5, 3, 1983); if ((float)$dob > (float)strtotime("-18years")) { print "...."; return false; } my question is why the type casting to float ? after all the return type of both mktime & strtotime is int, why the need to cast to float? the authors emphasize this in the explanation section by "We use the mktime() function to convert the date of birth to a large numeric Unix timestamp value, and the strtotime() function to discover the timestamp of exactly 18 ago. *Both are cast to a large floating number to ensure reliable comparison...*
Session Based Access Restriction To Zip-files
How can you restrict access to some files (not PHP-files!) that are in one directory? I know .htaccess, but I'd like it to be session-based in one way or another, or cookie-based, so that I can control the user information through a database. Is there a way to do this?
Session Array Showing Empty In Some Files?
i got a index page, which is login, works perfectly fine start sessions and registered the user. and take me to the appropriate page and print_r($_SESSION); prints all the stored values inside it. But when i clicked any links on my second level, the print_r($_SESSION); is showing empty array(), its strange although i am using session_start on every page. i got 15 pages on second level(i mean links from this page to another .php pages) and every page shows empty array(); although every page got session_start(); and validation if(strlen(trim($_SESSION['SESS_USERNAME'])) > 1) at the begining of the file before anything else.I don't know what to do? its KILLING me for weeks.
Session Variables Do Not Persist Into Included Files
In my index.php file I set a session variable $_SESSION['product'] = "foo"; and then in my html part of index.php I include a file menu.php using require_once() which I use to build the menu tree. However, the session variable is not available to me inside that include file. It is available to me inside index.php because if I echo it I can see it. If I go to page2.php it is also there. Just not in the include file.
How Can I Ensure A PAGE2.php Is Opened Only After Viewing PAGE1.php AND Is Opened In HTTPS?
I have a web page where certain pages have to be opened in a certain order and should only be available when the user openes them in HTTPS. They are all forms and the form action sends you to the next https:// page but you can also take the S out of https:// and it opens also. That's what I need to avoid as well as making certain they got to a certain page FROM a certain page. When I try: if (isset($_SERVER['HTTPS']!='on')) it crashes and is not even listed on php.net as a valid variable.
How Can I Remove Session Files In The "tmp" Directory?
How Can I Remove Session Files In The "tmp" Directory? I have just started working with "sessions." A Unix server stores a temporary file in a "tmp" directory. The temporary files include a string of numbers for the sessions variable. I need to devise a way to remove the temporary sessions files from the "tmp" directory on the server. If you would, please respond and indicate: 1). What is the best way to remove the sessions files from the "tmp" directory? or 2). What is the best way to handle the sessions files in the "tmp" directory?
A "few" Old Session Files Never Deleted?
I have session files stored in a special tmp directory specific to a virtual host instance. The Max_lifetime is long 86400 (1 day) which I don't suppose is the problem. Anyway the sessions do indeed expire and "most" of the old session files disappear as expected. Not all however. I am finding several old session files with Unix last mod times weeks in the past. This behavior observed on PHP 4.2 and 4.3.
Session Problem: Session Exists, But Session Variables Don't Lasts
I have some troubles with session variables. I can easily create a session, but the variable I append to global session array ( $_SESSION) lasts only until the end of current function. I prepared an example that can demonstrate the problem (see code bellow): The program flow is this: (1) It starts with "session_start()" and displays "login_form()". (2) When user enters his username and password, it goes to "login()" function which sets $_SESSION variables. (3) This function also "Echoes" session_id and user name to the screen. (4) Then it goes to "MyProgram()" function. It only "Echoes" the same variables to the screen. Strange is, that the session_id is the same in (3) and (4), but the user name ($_SESSION["username"]) is only in (3), but not in (4). By other words - $_SESSION["username"] variable filled up by "login()" function is immediately cleared. I don't know why. There must be something missing, but after 3 days of watching it, I can not find a problem here. =========================================== <? Function login($uzivatel, $heslo) { $_SESSION["username"] = $uzivatel; $_SESSION["pass"] = $heslo; $U_Name=$_SESSION['username']; echo "Login username: $U_Name<BR>"; echo "Login session ID: "; echo session_id(); echo "<BR>"; } Function login_form() { echo ("<DIV ALIGN='center'> <H1>Test</H1> <P>Please enter your username and password:</P> <form action='test.php' method='get'> <INPUT TYPE='HIDDEN' NAME='login' VALUE=TRUE> <TABLE BORDER=Ɔ'> <TR> <TD ALIGN='right'><U>U</U>ser name:</TD> <TD><INPUT NAME='uzivatel' SIZE=25 ACCESSKEY='U' TYPE='TEXT'></TD> </TR> <TR> <TD align='right'><U>P</U>assword:</TD> <TD><INPUT NAME='heslo' SIZE=25 ACCESSKEY='P' TYPE='PASSWORD'></TD> </TR> <TR> <TD COLSPAN=2 ALIGN='RIGHT'><INPUT NAME='OK' ACCESSKEY='O' TYPE='SUBMIT' VALUE='OK' TABINDEX=3></TD> </TR> </TABLE> </FORM></DIV></HTML>"); } Function MyProgram() { $U_Name=$_SESSION['username']; echo "Program username: $U_Name<BR>"; echo "Program session ID: "; echo session_id(); echo "<BR>"; } { session_start(); if ($_SESSION['username']): MyProgram(); else: { if (!$login): login_form(0); else: login($uzivatel, $heslo); MyProgram(); endif; } endif; } ?> ===========================================
Including Files In Different Direcories That Include Files From Teirs
Okay, I made a simple AJAX shoutbox and I want to include it on all my pages. To insert the shoutbox I simply type <? include('/shoutbox/shoutbox.php');?> into my HTML page. The problem is, that in /shoutbox/shoutbox.php I also include settings.php, functions.php, and some other files, and when I include /shoutbox/shoutbox.php into my index page, /shoutbox/shoutbox.php tries to call settings.php from the same folder that my index file is in, since I just 'included' it in index's source. So my question is, is there any way, without using frames, to include a PHP file as it would be if you link directly to it in the address bar, but placed into another file in a different directory?
How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file, "conn.php", so it's out of the web accessible file structure. I understand putting them in the php include directory shoudl do this. For example, let's say the directory I put them in is /www/phpIN/, and /www/ht/ is the root web directory. So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and removed it form CONNECTIONS directory.
How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file, "conn.php", so it's out of the web accessible file structure. I understand putting them in the php include directory shoudl do this. For example, let's say the directory I put them in is /www/phpIN/, and /www/ht/ is the root web directory. So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and removed it form CONNECTIONS directory. Now it doesn't work. What do I need to change?
Creating Dir, Copy Files And Pass Variables To 2 Files
I need to create a folder on the server weekly named by the user. To this folder copy the contents of an /Original folder. Inside the new folder edit one of the files to insert a data with a XML path generated in another application, copied (via memory) and pasted within the very first form and passed to the file in question. <param name="FlashVars" value="xmlfile= $lanofile" /> the $lanofile is the value that I need to pass from the form to be read by this file. I have created an form (n.php) that POST the name of the folder to a second file (creatdir.php) everything is cool until I have to edit the third file. How can I pass the value of one of the formfileds to a second file and them read this value as a variable to be consumed as mentioned above? Or actually right whatever is on the third field to this position (not using variables).
Trying To Unset Single Session Variable Unsets Entire Session
I have all the data being stored in session variables, so when the student puts in his student ID, it passes it from one page to the next. After the student votes, I use a function called logout that checks if the vote was counted, then uses session_unset($_SESSION['studentID']) and I also have a place that passes an error through session to let the user know of various problems with their login, such as if they have already voted. if voting is disabled, or if there are no candidates to vote on. The problem I am having is when I use session_unset, it unsets ALL session variables, not just the ones I want. php.net says not to use session_unregister if register_globals is disabled, which it is. What else can I do? I need to be able to unset only $_SESSION['error'] (the returned error message) and $_SESSION['studentID'], instead of unsetting the whole session.
Session Limit (maximum File Size Of A Session)
We all now that upon calling session_start(), it will create a file and in this file the session variables that you assigned will be stored. My question is how big can a session file can be? is there a limit or maximum file size for a session file?
Session Timeouts: Altering Session.gc_maxlifetime
I'm using PHP sessions to control authentication for a Content Management System for a site I'm working on. I have my own dedicated Linux/Apache server (ie.i have root access). In the php.ini file , I see that session.gc_maxlifetime = 1440 ...means that after a user successfully logs in, they have 1440 secs (24 mins) before the session will timeout. My questions: 1. Presumably, whenever the 'logged-in' user interacts with a page on the site (ie. causing the a new page to appear or the existing page to be refreshed), this 24 minute 'countdown' is reset to 24 mins? Correct? Are there any issues I should know about that might impact this count, such as browser caching? 2. If I want to change this setting on a per site basis, I can't find a function that will do this in my script, so I guess I'd have to put something like this in my .htaccess file: php_value session.gc_maxlifetime 2000 Would this be correct? 3. Is there any limit to the php.ini settings that can be overridden by .htaccess settings such as the one above? 4. Is it always true that if the php.ini settings use '=' to set a variable (eg. session.gc_maxlifetime=2000), then the equivalent .htaccess setting must discard the '=' (as per q.2)?
Check If Session & Session Variable Exist
I'm setting up a basic "shopping cart" using a multi-dimensional array stored in a session. I want to check if the session exists & if the cart has anything in it to determine whether or not to display "view cart" or "nothing in cart" - easy enough to do. BUT, I don't want to just session_start and then check if my variable is registered - or count() the variable (I'm thinking - why start a session if there is no need to at that stage?). Seeing as you can't session_start(); before sending headers to the browser, I thought I could run this function at the very top of every page that needs to know if the cart has items in it, while trying not to start a session if one DOESN'T exist: PHP Code:
Session Data Stored But New Session Everytime!
I am running out of time with a problem I have running PHP 5.04 and Apache 2.0 and really need help :(. I have a page that stores a variable in session but each time I reload that page the session seems to be re-created and is an empty array. I have checked the session file and the variable is being stored against the session id, but I dont know why PHP is not picking up the session after I reload.. I have tried the usual suspects of register_long_arrays etc but no luck.. slowly winding down to a quick death before our old server is taken out of commission and all our sites will be served from here, but at this rate its not gonna happen.
Session Data Loss Because Of Session.cache_expire?
we have a php-based application that is hosted by Yahoo! Webhosting. Ever since the application was created, it has been plagued by periodic session data loss. Here's a typical example: We will successfully input 7 clients into the system, but upon submitting the 8th, all session data fails to enter the MySQL database. After viewing the record in the database, the row is empty except for data that was not stored in a session. I have been studying the phpinfo() page and came across the session.cache_expire variable. Here is what I found out about this variable: session.cache_expire specifies time-to-live for cached session pages in minutes, this has no effect for nocache limiter. Defaults to 180. Forgive my ignorance, but does this mean that after 180 minutes, a session will expire and be destroyed? If so, is there any way to keep the session alive, atleast until after the process has been completed (ex: the client has been added to the system)? Also, our application utilizes session data extensively- is there anything that we can do to foster session health (like perform a session_destroy() after every process to reset things?)
Session.save_handler And Session.save_path
I'm having a problem getting the .tmp files (I assume these are how PHP is storing session information) to go into the directories specified by session.save_path and session.save_handler. Right now they are going into the root directory. Also, I have session.save_path and session.save_handler directed at F:PHPsessiondata, will the automatic garbage collection work? My filesystem is NTFS, I'm running a windows based server with IIS.
Create A New Session Id Within A Current Session.
Is there anything that would create a new session id within a current session. On my pages, I pull sesion id using sessiond_id(). on some of my pages, it pulls one session id, then on others, it pulls a different one. the is no killing of the session, but I can go to one page that has one id, then to another that pulls a different id, then go back and reload the original page and it has the original id.
Upload Audio Files Of Type .wav & Video Files Of Type .avi
I need to upload audio files of type .wav & video files of type .avi / .mov but my current file unloader is not helping me with that. My unloader works with application types, images, txt, pdf , mp3, mpg, mpeg but not with those .wav & .mov/.avi files........
Warning: Session Start() [function.session-start]: Open(/tmp/sess 8b10
Hello. Could someone tell me why i am getting these warnings on my php pages? And what i can do to fix it? Thanks. Warning: session_start() [function.session-start]: open(/tmp/sess_8b107ef6a1cde0a7426aedc044c14cb2, O_RDWR) failed: Disk quota exceeded (122) in /home/ployjam/public_html/admin/login.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/ployjam/public_html/admin/login.php:2) in /home/ployjam/public_html/admin/login.php on line 2 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/ployjam/public_html/admin/login.php:2) in /home/ployjam/public_html/admin/login.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /home/ployjam/public_html/admin/login.php:2) in /home/ployjam/public_html/admin/login.php on line 23 Warning: Unknown: open(/tmp/sess_8b107ef6a1cde0a7426aedc044c14cb2, O_RDWR) failed: Disk quota exceeded (122) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0
Files Inside Files
im creating something new with alot of php files, and i remembered that alot of times on message boards and things like that you see like "misc.php?action=list" or something like that. i would really like to decrese the amount of files i have for this new thing im creating. can someone show me how to put multi files in one?
Two Sessions: Session A By A Program Destroys Session B By A Program
I have two separate programs that I want to use together on a website Program A starts first and calls session_start(). Program B is started by the user clicking on a link and it also calls session_start(). The session started by program B blows away the session started by program...
PHP Session Is Empty And Session File Is Empty
I am trying to save a SESSION variable which looks to succeed because right after I print it out to verify it. I do so as follows: session_start(); <snip> $_SESSION['security_code'] = $code; The problem is that I submit a form on the same page and I need to check if the $_SESSION['security_code'] == $_POST['security_code'] however this condition is always false because $_SESSION['security_code'] is empty. I also checked the security files that are created in the PHP 'save_path' directory and it appears to be creating an empty session file. Can anyone suggest anything here? Also prior to the condition, I also do a session_start() and that doesn't help either. I got this code from a open source area and on that web site, if I test it it works fine. On my localhost it does not work. I'm not sure if I'm missing some configuration or whether PHP 5.2.2 has problems with sessions.
Files
My problem is not a php problem but something to do with uploading a file to a folder on a remote server. On the remote server I have my upload script in a folder called lets say "img_upload" and in that same folder I have another folder called "images" where I will be uploading all my images. Now I specify the path to this folder in my code but the images never get uploaded. I have tested this code on my local machine and from another machine in the office and it works fine. But uploading the image to a remote server is a bit of a pain in the butt. If any of you guys have uploaded a file to a folder on a remote server could you please tell me what path I would have to put in my code??
ZIP Files
I have to do a script which read a zip file and update with it a database, I need to know if there is a way to uncompress .zip files with PHP.
.txt Files
Does anyone know where I can find out how to get PHP to save a text file. Also, How can I combine text boxes and check boxes within one form? I would like to write a simple script which will take a url, and allow me to choose a description(from 4 or so options) and write a text file which could be used as a SSI.
Not Able To Run The Php Files
i get these two warnings when i run the php page. Warning: Cannot send session cookie - headers already sent by (output started at /usr/local/apache/htdocs/ticketsmith/config.inc.php:62) in /usr/local/apache/htdocs/ticketsmith/common.inc.php on line 380 Warning: Cannot send session cache limiter - headers already sent (output started at /usr/local/apache/htdocs/ticketsmith/config.inc.php:62) in /usr/local/apache/htdocs/ticketsmith/common.inc.php on line 380 and the code that generates the warnings is : Code:
|