Hi People,


I've created a couple of install pages for a client (install.php and install2.php) My question / problem is...

In install2.php i want to unlink install.php and install2.php via a hyperlink or button and i was wondering how best, if it is possible, to achieve this.

Can anyone help me out?

Cheers.

P.s i have tried google and the such but nothing constructive came of it!

<?php
//install2.php
if(isset($_GET['unlink']) && $_GET['unlink']=="true") {
  unlink("install.php");
   unlink("install2.php");
   header("location: success.php");
}
//rest of the code here
echo "<a href='install2.php?unlink=true'>Click here to remove the installation files ! </a>";
?>

Works on local machine. I haven't tested it on server!

If you want to do the same with a button, use a hidden variable, set some value to it and depending upon that value, repeat this action :)

Just out of curiosity, does this mean that scripts are loaded into the PHP interpreter in their entirety, so that anything can happen to the file during execution and the its execution will be unaffected?

Thanks for the quick reply,

Unfortunatly all that happens is the page reloads.

Thanks anyway for the reply

For the sake of an installation script, you should probably exit() after redirecting. As to why this isn't happening is beyond me.

Just out of curiosity, does this mean that scripts are loaded into the PHP interpreter in their entirety, so that anything can happen to the file during execution and the its execution will be unaffected?

Yeah, I think so too!

Thanks for the quick reply,

Unfortunatly all that happens is the page reloads.

Thanks anyway for the reply

page reloads ? Are you sure ? :-O It should redirect to the page success.php !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.