lordphate Posted June 28, 2006 Share Posted June 28, 2006 is there a way to make a file removed by clicking a link?/ here is my code [code]<?php$id = $_GET["id"];$ip = $_SERVER[REMOTE_ADDR];include 'header.php';include 'sidebar.php';include './library/db.php';include './library/sessions.php';if ($member == "arshem") { if($id != "") { $query = "SELECT id, name, size, path, uploader FROM upload";$result = mysql_query($query) or die('Error, query failed');if(mysql_num_rows($result) == 0){ echo "No Files to Delete...Be the first Uploader! <br>";}else{while(list($fileid, $filename, $size, $filePath, $uploader) = mysql_fetch_array($result)) { ?><html><head><title>Delete File</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><div id="main"> You're Being Watched <?=$ip;?>... <br /><br /><a href="admin.php?id=<?=$fileid;?>">-<?=$filename;?></a> <br><?php include 'footer.php';?></div></body></html><?phpunlink("$filePath"); mysql_query("DELETE FROM upload WHERE id = '$fileid'") or die('mysql_error()');} } } }?>[/code]any help would be helpful thanks Quote Link to comment https://forums.phpfreaks.com/topic/13164-unlink-working-with-links/ Share on other sites More sharing options...
Eugene Posted June 29, 2006 Share Posted June 29, 2006 FTP access.You can use it to delete files.[a href=\"http://us3.php.net/manual/en/ref.ftp.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.ftp.php[/a]If you have the files in the database, I think your doing everything right. Quote Link to comment https://forums.phpfreaks.com/topic/13164-unlink-working-with-links/#findComment-50638 Share on other sites More sharing options...
redarrow Posted June 29, 2006 Share Posted June 29, 2006 [!--quoteo(post=389068:date=Jun 29 2006, 02:21 AM:name=G F D)--][div class=\'quotetop\']QUOTE(G F D @ Jun 29 2006, 02:21 AM) [snapback]389068[/snapback][/div][div class=\'quotemain\'][!--quotec--]FTP access.You can use it to delete files.[a href=\"http://us3.php.net/manual/en/ref.ftp.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.ftp.php[/a]If you have the files in the database, I think your doing everything right.[/quote]Try to use the full path on the unlink to see if it is deleting a file ok. Quote Link to comment https://forums.phpfreaks.com/topic/13164-unlink-working-with-links/#findComment-50651 Share on other sites More sharing options...
lordphate Posted June 29, 2006 Author Share Posted June 29, 2006 Yes the files are int he database and on my server...so unlink will not work with links...i have to use FTP... the way i HAD it set up was when i went to the script page it would end up deleting EVERYTHING...instead of a certain file...No clicking was needed to delete all the files, it owuld just delete them on it's own...Any ideas besides the FTP function to make Unlink() work with active links...user needs to click on link to delete the database and file server entries... Quote Link to comment https://forums.phpfreaks.com/topic/13164-unlink-working-with-links/#findComment-50793 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.