ok
Direktori : /proc/thread-self/root/home2/selectio/public_html/caliberembedded.com/new/admin/ |
Current File : //proc/thread-self/root/home2/selectio/public_html/caliberembedded.com/new/admin/addphoto.php |
<?php include"config/config.php"; if(isset($_POST['type']) && $_POST['type']=='add_gallery'){ try{ if(isset($_FILES['gallery']['name']) && $_FILES['gallery']['name']!=""){ $string1 = '0123456789'; $file1 = preg_replace("/\s+/", "_", $_FILES['gallery']['name']); $extension1 = end(explode(".", $_FILES["gallery"]["name"])); $menu_image1 = get_random_string($string1, 4) . "-" . date("Y-m-d") . "." . $extension1; $upload1 = move_uploaded_file($_FILES['gallery']['tmp_name'], 'gallery/' . $menu_image1); $upload_gallery_image = 'gallery/' . $menu_image1; $statement = $pdo->prepare("INSERT INTO `tbl_gallery`(`image`) VALUES (?)"); $result=$statement->execute(array($upload_gallery_image)); } }catch(exception $e){ } } if(isset($_POST['type']) && $_POST['type']=='add_certificate'){ try{ if(isset($_FILES['gallery']['name']) && $_FILES['gallery']['name']!=""){ $string1 = '0123456789'; $file1 = preg_replace("/\s+/", "_", $_FILES['gallery']['name']); $extension1 = end(explode(".", $_FILES["gallery"]["name"])); $menu_image1 = get_random_string($string1, 4) . "-" . date("Y-m-d") . "." . $extension1; $upload1 = move_uploaded_file($_FILES['gallery']['tmp_name'], 'certificate/' . $menu_image1); $upload_gallery_image = 'certificate/' . $menu_image1; $statement = $pdo->prepare("INSERT INTO `tbl_certificate`(`image`) VALUES (?)"); $result=$statement->execute(array($upload_gallery_image)); } }catch(exception $e){ } } if(isset($_POST['type']) && $_POST['type']=='delete'){ try{ unlink($_POST['image']); $statement = $pdo->prepare("delete from tbl_gallery WHERE id=".$_POST['id']); $result=$statement->execute(); if($result==1) { $message='Success..'; } else { $message='Failed..'; } echo $message; }catch(exception $e){ echo $e; } } if(isset($_POST['type']) && $_POST['type']=='certificate_delete'){ try{ unlink($_POST['image']); $statement = $pdo->prepare("delete from tbl_certificate WHERE id=".$_POST['id']); $result=$statement->execute(); if($result==1) { $message='Success..'; } else { $message='Failed..'; } echo $message; }catch(exception $e){ echo $e; } } ?>