Jump to content

removing all files within a specified directory - unlink?


wmguk

Recommended Posts

hey guys,

 

I have googled unlink, and I think this is the thing I need.. Basically I have a delete button, when clicked it removes a row from the database where login = $login and that works, however i also need to remove all files within clients/$login

 

I cannot see the context for *.*

 

can anyone suggest a way to empty a directory and then delete that directory?

 

I have this so far:

 

<?PHP
//Get the data to update

  $login = $_POST['login'];
  $thisdir = "/var/www/vhosts/domain.co.uk/httpdocs/clients";
// Make Connection
include 'connection.php';
if (!$con)
  {
  die('Could not connect: ' . mysql_error() );
  }
  mysql_select_db($db, $con);

//Run the update query
$sql = "DELETE FROM album WHERE login = '$login'";

  mysql_query( $sql , $con ) or die( "<strong>Query Error</strong>: " . mysql_error() . "<br><strong>Query</strong>: $sql<br><br>" ); 
  
  unlink  ($thisdir ."/login", *.*); //I dont think *.* will work?
  rmdir($thisdir ."/$login");

//Close the connection
  mysql_close($con);
?>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=../display.php">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.