hostName = $hostName; $clsMySQL->dbName = $databaseName; $clsMySQL->usrName = $databaseUser; $clsMySQL->usrPwd = $databasePw; $clsMySQL->connDB(); if($_REQUEST['acttype']=='ajax') { $fileExt = array('','_show','_thumb'); foreach($fileExt as $fe) { $fileName = str_replace('.jpg',$fe.'.jpg',$_REQUEST['url']); if( file_exists($fileName) ) { unlink($fileName); $done++; } } if($done) { echo 'ok'; } else { echo 'Photo do not exists'; } } elseif($_GET['action']=='deletefile' && is_numeric($_GET['aid'])) { $aid = $_GET['aid']; $clsMySQL->execQuery("SELECT * FROM attachment WHERE a_id='$aid'"); $a = $clsMySQL->fetchArray(); if($a['a_resize']) { $re = explode(',',$a['a_resize']); foreach($re as $r) { if(!@unlink('../../'.img_path($a['a_path'],$r))) { //echo 'Some files cannot be deleted';exit; } } } if(@unlink('../../'.$a['a_path']) || !file_exists('../../'.$a['a_path'])) { $clsMySQL->execQuery("Delete FROM attachment WHERE a_id='$aid'"); echo 'ok'; } else { echo 'Some files cannot be deleted'; } } ?>