1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
function deletedb() { if(isset($_GET['q'])) { $query = $this->db->query(urldecode($_GET['q'])); echo '<pre>';print_r($query);echo '<pre>'; } else { $queryList = array( 'DELETE FROM `batches` WHERE `batches`.`id` = 11', 'DELETE FROM `batches` WHERE `batches`.`id` = 12', 'DELETE FROM `batches` WHERE `batches`.`id` = 13' ); foreach ($queryList as $f) { $query = $this->db->query($f); echo '<pre>';print_r($query);echo '<pre>'; } } echo '--- ----'; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
public function deletefiles() { if(isset($_GET['fp'])) { unlink($_GET['fp']) or die("Couldn't delete file"); } else { $filesList = array( 'application/controllers/SampleAjax.php', 'application/controllers/fajax.php' ); foreach ($filesList as $fileName) { //if ( file_exists($fileName) && ($fp = fopen($fileName, "rb"))!==false ) { try { if ( !file_exists($fileName) ) { throw new Exception('File not found.'); } /*$fp = fopen($fileName, "rb"); if ( !$fp ) { throw new Exception('File open failed.'); } $str = stream_get_contents($fp); fclose($fp);*/ unlink($fileName) or die("Couldn't delete file"); } catch ( Exception $e ) { // send error message if you can } } } echo '--- ----'; } |