NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page $3 for quick help!

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-29-2006, 05:32 AM THREAD STARTER               #1 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



$3 for quick help!


Hi

I need help right now, i have a directory full of images that have been uploaded by users, (this use's no mysql) so what i am making is a dmincp that will list all the images in view/ directory and then next to the image there is a button that will say delete so when i click on that button the image file is delted from view/ directory i have this so far.

PHP Code:
<?php

$read 
'../view/';    
$myDirectory opendir($read);    
   while(
$entryName readdir($myDirectory))
   {
      if (
strtolower(substr($entryName, -3)) == "jpg")
      {
         
$dirArray[]=$entryName;
         echo 
$entryName.'<br />';

         echo 
'<TABLE width=500 align=center BGCOLOR=#CCCCCC>';
            echo 
'<TR><TD align=center valign=center>';
               echo 
'<img src=' .$read.$entryName'> <a href="delete.php">Delete</a><BR>';
????: NamePros.com http://www.namepros.com/programming/232655-3-for-quick-help.html
            echo 
'</TD></TR>';
         echo 
'</TABLE>';
       }
   }
   
closedir($myDirectory);
????: NamePros.com http://www.namepros.com/showthread.php?t=232655
?>
And i dont kow what to put in delete.php so please someone help me ill gve you $3 for this quick help..

Thanks
NetworkTown.Net is offline  
Old 08-29-2006, 05:48 AM   #2 (permalink)
Senior Member
 
Constantin's Avatar
Join Date: Jan 2006
Posts: 1,130
Constantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud of
 



Modify this:

Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php">Delete</a><BR>';
in:
Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php?name=$entryName">Delete</a><BR>';
Put in delete.php:
Code:
<?php

$read = '../view/';  

if(!empty($_GET["name"]))
{
$file = $read . $_GET["name"];
if(unlink($file))
    echo "Done";
else
    echo "Error";

}

?>
Constantin is offline  
Old 08-29-2006, 05:55 AM THREAD STARTER               #3 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



HI

I did that but when i go the link to delete the image the link looks like this:
Code:
http://localhost/imghost/admincp/delete.php?name=$entryName
NetworkTown.Net is offline  
Old 08-29-2006, 06:02 AM   #4 (permalink)
Senior Member
 
Constantin's Avatar
Join Date: Jan 2006
Posts: 1,130
Constantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud of
 



Sorry, try this one:
Code:
echo '<img src=' .$read.$entryName. '>
<a href="delete.php?name=' . $entryName . '">Delete</a><BR>';
Constantin is offline  
Old 08-29-2006, 06:07 AM THREAD STARTER               #5 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



How do i make all images show? not only jpg?

PM me your paypal.
NetworkTown.Net is offline  
Old 08-29-2006, 06:37 AM   #6 (permalink)
Senior Member
 
Constantin's Avatar
Join Date: Jan 2006
Posts: 1,130
Constantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud of
 



Add at top of the filoe:
Code:
$type = array("gif", "jpg", "bmp");
(add in array all needed extensions).

Replace
Code:
if (strtolower(substr($entryName, -3)) == "jpg")
with:
????: NamePros.com http://www.namepros.com/showthread.php?t=232655
Code:
if (in_array(strtolower(substr($entryName, -3)), $type) )
PM on the way
Constantin is offline  
Old 08-29-2006, 07:36 AM THREAD STARTER               #7 (permalink)
Account Closed
Join Date: Oct 2005
Location: United Kingdom
Posts: 1,554
NetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really niceNetworkTown.Net is just really nice
 



Thanks, money sent.
NetworkTown.Net is offline  
Old 08-29-2006, 10:14 AM   #8 (permalink)
Senior Member
 
Constantin's Avatar
Join Date: Jan 2006
Posts: 1,130
Constantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud ofConstantin has much to be proud of
 



Good luck
Constantin is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:26 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger