image not deleting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    image not deleting

    can any one help with this please as the images are not deleting

    Code:
    <?php
    define('SCS',true);
    include("../core/main.inc");
    if(!connect()){
    dberror();
    exit();
    }
    cleardata();
    if(isipbanned(ip(),browser())){
    if(!isshield(uid_ses($ses))){
    ipban(uid_ses($ses));
    exit();}
    }
    if(!islogged($ses)){
    expired(uid_ses($ses));
    exit();
    } 
    if(isbanned(uid_ses($ses))){
    if(!isshield(uid_ses($ses))){
    banned(uid_ses($ses));
    exit();}
    }
    mysql_query("UPDATE members SET host='".host()."', browser='".browser()."', ip='".ip()."' WHERE uid='".uid_ses($ses)."'");
    
    if($add==yes){
    web_head(nick_ses($ses)."@".level($level)." Tools",1,uid_ses($ses));
    addonline(uid_ses($ses),"".level($level)." Tools","$PHP_SELF");
    if((isowner(uid_ses($ses)))||(ishost(uid_ses($ses)))){
    $title.="
    <b>Upload</b><br/>";
    $title.="Image Files<br/>";
    $size_bytes=2048000;
    $kb=$size_bytes/1024;
    $mb=$kb/1024;
    $title.="Max <b>$mb</b> Mb";
    
    $main.="<form method=\"post\" enctype=\"multipart/form-data\" action=\"$PHP_SELF?ses=$ses&amp;add=yes&amp;upload=yes\"><p style=\"text-align: center\">";
    $main.="<b>File:</b><br/><input type=\"file\" name=\"filetoupload\"><br>";
    $main.="<input type=\"Submit\" value=\"Upload\">";
    $main.="</form>";
    
    $upload_dir="./";
    $filename=$_FILES['filetoupload']['name'];
    $size=$_FILES['filetoupload']['size'];
    $extlimit="yes";
    $limitedext=array(".jpeg",".jpg",".JPEG",".JPG",".gif",".GIF",".png",".PNG");
    $ext=strrchr($_FILES['filetoupload'][name],'.');
    
    $main.="<p style=\"text-align: center\">";
    if($upload=="yes"){
    if(!is_uploaded_file($_FILES['filetoupload']['tmp_name'])){
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>No file selected!";
    }
    else if(($extlimit=="yes")&&(!in_array($ext,$limitedext))){
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>Invalid file type!";
    }
    else if($size>$size_bytes){
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>Exceeded File size limit! Maximum <b>$kb</b> Kb.";
    }
    else if(file_exists("$upload_dir/$filename")){
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>Filename already exists!";
    }
    else if(move_uploaded_file ($_FILES['filetoupload']['tmp_name'], "../image/$filename")){
    $main.="<img src=\"../$phpthumbs?src=../images/ok.gif\" alt=\"\"/><br/>$filename sucessfully uploaded!";
    }else{
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>Unknown error! Pls try again...";}
    }
    }
    $main.="</p>";
    $L1="<a href=\"$PHP_SELF?ses=$ses\">
    <img src=\"../$phpthumbs?src=../images/prev.gif\" alt=\"\"/><br/>Back</a>";
    $L2="<a href=\"../main.php?ses=$ses&amp;\">
    <img src=\"../$phpthumbs?src=../images/home.gif\" alt=\"\"/>Main Menu</a>";
    xhtml($ses,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
    webfoot();
    exit();
    }
    
    web_head(nick_ses($ses)."@".level($level)." Tools",1,uid_ses($ses));
    addonline(uid_ses($ses),"".level($level)." Tools","$PHP_SELF");
    $title.="<b>Site Images</b>";
    
    $main.="<p style=\"text-align: center\">";
    $items_per_page="10";
    if(!isset($page)){$page=0;}$total=0;
    if(!($dp=opendir("./")))die("Cannot open ./");
    $file_array=array();while($file=readdir($dp)){
    if(substr($file,0,1)!='.' and $file!="index.php"){
    $file_array[]=$file;}
    }
    $file_count=count($file_array);
    sort($file_array);	
    if($file_count>0){
    $first_record=$page*$items_per_page;
    $last_record=$first_record+$items_per_page;
    while(list($fileIndexValue,$file_name)=each($file_array)){
    if(($fileIndexValue>=$first_record)AND($fileIndexValue < $last_record)){
    if((isowner(uid_ses($ses)))||(ishost(uid_ses($ses)))){
    $delpic="[COLOR="red"]<a href=\"$PHP_SELF?page=$page&amp;delete=$file_name$sessions\">[/COLOR]
    <img src=\"../phpThumb/phpThumb.php?src=../images/delete.gif\" alt=\"[x]\"/></a><br/>";}
    $main.="<a href=\"$file_name\">$file_name</a> ".round(filesize($file_name)/1024,1)."kb$delpic<br/>";
    if($delete=="$file_name"){
    $main.="<p style=\"text-align: center\">";
    if((isowner(uid_ses($ses)))||(ishost(uid_ses($ses)))){
    unlink("./$file_name");
    $main.="<br/>$file_name deleted successfully<br/>";
    }else{
    $main.="<img src=\"../$phpthumbs?src=../images/error.png\" alt=\"\"/><br/>Daterbase Error!";
    }
    $main.="</p>";
    $L1="<a href=\"$PHP_SELF?ses=$ses\">
    <img src=\"../$phpthumbs?src=../images/prev.gif\" alt=\"\"/><br/>Back</a>";
    $L2="<a href=\"../main.php?ses=$ses&amp;\">
    <img src=\"../$phpthumbs?src=../images/home.gif\" alt=\"\"/>Main Menu</a>";
    xhtml($ses,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
    webfoot();
    exit();
    }
    
    $total=$total+filesize($file_name);}
    }
    $pages=(int) ceil($file_count/$items_per_page);
    $pages=($pages -1);
    if(($file_count>0)AND($page!=0)){
    $main.="<a href=\"$PHP_SELF?ses=$ses&amp;page=".($page-1)."\">
    <img src=\"../$phpthumbs?src=../images/prev.gif\" alt=\"Prev\"/></a> |";}
    if(($file_count>0)AND($last_record<$file_count)){
    $main.=" <a href=\"$PHP_SELF?ses=$ses&amp;page=".($page+1)."\">
    <img src=\"../$phpthumbs?src=../images/next.gif\" alt=\"Next\"/></a>";}
    if($file_count>10){$main.=pagejump("index",$ses,0,0,0,0);}
    $main.="<br/>$file_count ";
    if($file_count==1){$main.="file";}
    else{$main.="file's";}
    }$main.="</p>";
    $main.="<p style=\"text-align: center\">";
    if((isowner(uid_ses($ses)))||(ishost(uid_ses($ses)))){
    $L1="<a href=\"$PHP_SELF?ses=$ses&amp;add=yes\">Upload</a>";
    $L2="<a href=\"../tools/tools.php?ses=$ses\">".level($level)." Tools</a>";}
    $L3="<a href=\"../main.php?ses=$ses\">
    <img src=\"../$phpthumbs?src=../images/home.gif\" alt=\"\"/>Main Menu</a>";
    xhtml($ses,$title,1,$L1,$L2,$L3,$L4,$L5,0,0,0,$main);
    webfoot();
    exit();
    ?>
    HELP THEM WHO HELPS YOU



    i only work on wapdesire v_2 coding only

    #2
    First u ve to make sure u specify the right path to use unlink() func.

    Comment


      #3
      is the file name same as the path if not this is most likely the reason it wont.
      Want something coded email me at sales@webnwaphost.com for a prices.




      Comment


        #4
        check file perms n ownership.

        Comment


          #5
          unlink works with any info or ownership :P
          Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
          Visit: WapMasterz Coming Back Soon!
          _______
          SCRIPTS FOR SALE BY SUBZERO
          Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
          FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
          _______
          Info & Tips
          php.net
          w3schools.com

          Comment

          Working...
          X