topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 1:29 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Is there a way to ZCode for self destruct in PHP?  (Read 3205 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Is there a way to ZCode for self destruct in PHP?
« on: September 18, 2014, 06:00 PM »
have to run a web-installer written in php that has to be deleted after it is run. It is a run-once setup process that for security reasons needs to be removed so it cannot be run again. The final lines of code display that the routine successfully completed then exits. Is there a way to script in for the file to "self destruct" after displaying that message?

It has never failed a successful run so I am not very worried about having to add another copy of it if that happens.

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,649
    • View Profile
    • Donate to Member
Re: Is there a way to ZCode for self destruct in PHP?
« Reply #1 on: September 18, 2014, 07:12 PM »
Run
unlink($filename);

from the calling file after the installer file returns...or try running it on installer file exit (I haven't tested this, but it's worth a shot).

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Re: Is there a way to ZCode for self destruct in PHP?
« Reply #2 on: September 19, 2014, 02:12 AM »
Thanks.  I had someone else tell me similar  Have to check the exact layout but whatever i tried , it did not work
The script fi al chatacter is a "?"  for input .  As in OK or ..
it is always OK
anyway I added the "unlink" after it and i think i need to get rid of the ? input mark.
Will try again tomorrow
Just a little bitty niggle that I would have liked to add.  I forget to delete the installer sometimes

Thanks Stoic..