Nov 8, 2009

How To Delete Files When Session Ends

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

How To Delete Files When Session Ends

vicky99
Dear Friends
I need solution to a problem. The problem is as under:
I am creating certain files (playlist) in server disk when user selects some songs. The files are created in ram format. What I want to do is to delete these files created during a particular session. Is it possible to do so? Now I am deleting these files using on Unload event fired by JavaScript. I am using PHP.

Comment/Reply (w/o sign-up)

TavoxPeru
I think it is possible to delete the files before the session is ended by using the unlink() php function, but you need the correct system priviligies to do it.

Best regards,

Comment/Reply (w/o sign-up)

Hercco
Or use a system call?

Comment/Reply (w/o sign-up)

TavoxPeru
QUOTE(Hercco @ Aug 16 2006, 02:48 PM) *

Or use a system call?

Yes you are right, it is another solution but many host servers for security reasons disable this functions so you can't use it.

Best regards,

Comment/Reply (w/o sign-up)

Humphrey1988
QUOTE(vicky99 @ Aug 14 2006, 01:12 PM) *

Dear Friends
I need solution to a problem. The problem is as under:
I am creating certain files (playlist) in server disk when user selects some songs. The files are created in ram format. What I want to do is to delete these files created during a particular session. Is it possible to do so? Now I am deleting these files using on Unload event fired by JavaScript. I am using PHP.


Hi

I have just learnt how to do it. I think you can use the session_destroy() function. More information can be found at http://sg.php.net/session_destroy

I hope that the website would give you the answer that you are searching for.

Cheers.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : delete, files, session, ends

  1. Magic Quotes And $_files
    (3)
  2. How To Create/edit/delete Ftp Accounts With Php
    Help me to create one php page to create FTP user accounts in Unix Ser (2)
    Thanks /cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /> ....
  3. How To Protect Included Files
    (10)
    Hey! How can i make my included files 100% safe. Like if I include a file witht his code.. CODE
    include "bla.php"; How can i make it 100% safe? I know I must close the php tags in the
    included files. but what more =?....
  4. Reading Files And Folders
    (1)
    I am in the process of writing a small content management system for my niche sites and need to be
    able to accomplish the following two items. Any assistance would be appreciated: I have a
    directory that has nothing but sub directories in it and I need to be able to identify each
    directory name and return them in an option drop down selection menu which will be included in an
    identifying URL. ALSO: I am in need of a script that could be included on a returned page
    that will read the content of a table and identify various keywords within the content and pl....
  5. Run A Script When Expires A Session
    (6)
    For example, when a user logins to a page -with a login form- and after validating and verifying
    it's credentials i store some information related to this user in session variables and a table
    with his state -connected- is updated, then i use it in other pages, etc. When this user logouts
    -by clicking a logout link- i release -unregister, destroy, etc- all the session variables stored
    and the same table is updated with his state -disconnected-. All of this funcionality works very
    well, the problem comes when the user do not click on the logout link and the session ....
  6. Php Session Problem
    (7)
    i have downloaded easyphp on my PC and i am a bit noob with php mysql commands. i have a problem
    making session work the problem that the session file in my server get deleted after leaving the
    page where the session was start for the first time. the problem that the session can only be used
    within the creation page unless you leave it. why?? i have no idea ... i have been looking around
    for three days now .. thank in advance for any help. if you need more details let me know
    /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />. Joe.k....
  7. Php File Upload
    About uploading files through php (3)
    Right i have done a check for a tutorial on this as well as a question about it but php is not
    allowed in the search box. So i thought i'd just ask what i want to know. I have a form which
    uploads a file, it refreshes the page, uploads the file and then alerts the user to if the file has
    uploaded. To be honest im not sure why i keep getting the error. But here is the code: This is the
    form that is used for the user to select the file &fid= " method="POST"> Choose a file to
    upload: This is the upload code if ($op == "up"....
  8. Already Sent Session Cookies?
    (2)
    Er, this is the second topic I've posted about session problems. Here's the html file that
    keeps showing up: CODE Warning: session_start() : Cannot send session cookie - headers already
    sent by (output started at C:\Program Files\xampp\htdocs\index2\loggingin.php:2) in C:\Program
    Files\xampp\htdocs\index2\loggingin.php on line 39 Warning: session_start() : Cannot send session
    cache limiter - headers already sent (output started at C:\Program
    Files\xampp\htdocs\index2\loggingin.php:2) in C:\Program Files\xampp\htdocs\index2\loggingin.php on
    line 39 Fatal ....
  9. Help To Transfer Files Within Hosting Space Using Php
    (4)
    I want to transfer files from one folder to another or an entire folder in my web space. I don't
    want to download it and upload it, can I do this using a PHP script. Please help me. I'm just
    learning the basics of PHP....
  10. How To Delete File Using PHP Shell Script
    (3)
    i have this problem regarding file access seems that my admin host or the server system itself have
    locked up the acces to create new file, delete a file.. change file permissions and such controls
    to file.. someone told me to use php shell script.. can you help me out here? ******** i just
    need to find out how to use php shell script and add it to my php scripts to delete a file.. thanks....
  11. How To Edit Php Files?
    (16)
    Hi, You can use frontpage to preview HTML files, but how can I edit and preview PHP files offline.
    I'm not well-known with PHP and I see more and more using this script to manage their site.....
  12. User Authentication Session Handling Problems
    Authorization server variables not staying across pages (14)
    This is quite a bit of problem I am facing, and I cannot point exactly where I am going wrong. I
    have been lurking around here at the Asta Host forums with regard to login and user authentication
    scripts and I have got as far as this: - Starting a session - Registering a session variable -
    Using the variable to check if the user is authenticated or not. - Authenticating the user through
    MySQL database - Logging of the user, by setting the session variable to un-authenticated I have
    been able to achive the following things too that I think is not related to this proble....
  13. Session And Security
    (0)
    Hi everyone, I'd like to explain my idea for basic session handling to you guys. I've
    thought about it, and I can't see any problem with it, but I'd like other's opinions as
    well, please. Ok, here goes. So basically, there's two base cases that can happen. User
    visits any page, session class is initialized, etc. Case 1 - User not logged in; no cookie or
    session info in DB If the user is not logged in, has no cookie, and/or there is no session info in
    the DB for this user, any specified activities, protected like so: php: if ( $session....
  14. Need Help - How To Remove Session ID From URL
    (6)
    Oflate I was going through Google information for webmasters and I noticed the following technical
    guideline for the webmasters: QUOTE Allow search bots to crawl your sites without session IDs or
    arguments that track their path through the site. These techniques are useful for tracking
    individual user behavior, but the access pattern of bots is entirely different. Using these
    techniques may result in incomplete indexing of your site, as bots may not be able to eliminate URLs
    that look different but actually point to the same page. It clearly shows that undesir....
  15. Deleting Files With PHP
    is this possible? (6)
    It is posible for PHP to delete files on a server? If so, how is this possible? Just out of
    interest.......
  16. Php And Session
    Talk about Session Handling in PHP (4)
    I have a problem in handling Session. When I log on to my site using the passwords and username that
    i have maintained in my database... After authentication, I start a session... but still when i
    again visit the admin page it asks me the username and password... I have added all the
    authentication and checking.......
  17. Php : Variables Included Dont Work In Functions
    Variables from Included files dont work (4)
    Today, I came up with this strange PHP behaviour. Just wanted to know if anyone has any
    suggestions! I make a common variable/function file called config.php. I put in my generally used
    functions in it. Suppose this is my file CODE // -----VARIABLES --- // $a=10,$b.... //
    -----FUCTIONS--- // function doit() { print "A value is " . $a; } ?> Here, suppose we execute
    this file directly. Since A has a global scope, it does work perfectly. But if this same file is
    imported in another file say, mainfile.php CODE // -----VARIABLES --- // $c,$d.... include &#....
  18. How Do I Create And Write To Files?
    creating, writing, deleting files (4)
    Hi, Can someone please tell me how to create files and write to them in PHP. I just want to create
    a simple file containing text, and then be able to read it or update it. Thanks Alfie....
  19. Getting Files From Other Sites
    Using wget (3)
    Hello. A while ago, a friend showed me this PHP code (wget) which allows you to get files from other
    sites. I was a simple one liner type thing. Since my old host (Nytka) went down, I've lost it,
    as has my friend. Do you know anything about wget, and could tell me it?....
  20. Php, Sql Lite: Storing Session's Data?
    how so store session in SQLITE? (1)
    normally, in windows, session data is saved in the location as directed by the "session.save_path"
    directives. they only show how to store session data in file. is it possible to store it inside the
    SQLite? anyone?....

    1. Looking for delete, files, session, ends

See Also,

*SIMILAR VIDEOS*
Searching Video's for delete, files, session, ends
advertisement



How To Delete Files When Session Ends

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com