<?php $data = array(); $data['title'] = "Thêm mới tin tuyển dụng"; $data['template'] = "recruitment/add_rec"; $data['act'] = 4; $db = new libraries_recruitment(); if (isset($_POST['ok'])) { $title = $_POST['rec_title']; $author = $_POST['rec_author']; $info = $_POST['rec_info']; $full = $_POST['rec_full']; $rewrite = replace($_POST['rec_title']); $dir = "../uploads/recruitment/thumb/"; //Bạn nên thay đổi đường dẫn cho phù hợp //Kiều file, Gif, jpeg, zip ::bạn có thể sửa đổi nếu thích $types = array("image/gif", "image/GIF", "image/JPG", "image/jpg", "image/JPEG", "image/jpeg", "image/png", "image/PNG", "application/x-zip-compressed", "application/msword", "application/vnd.ms-excel"); //Check to determine if the submit button has been pressed //Shorten Variables $tmp_name = $_FILES["upload"]["tmp_name"]; $new_name = $_FILES["upload"]["name"]; //Check MIME Type if (in_array($_FILES["upload"]["type"], $types)) { //Move file from tmp dir to new location move_uploaded_file($tmp_name, $dir . $new_name); $img = $_FILES["upload"]["name"]; } else { //Print Error Message echo "<script>alert('Định dạng file không hợp lệ !'); window.location.href='index.php?mod=recruitment&act=add'</script>"; //Debug //$name = $_FILES["upload"]["name"];
<?php $id = $_GET['rid']; $db = new libraries_recruitment(); $db->del_rec("tbl_recruitment", $id); header("location:index.php?mod=recruitment&act=list");
<?php $data = array(); $data['title'] = "Danh sách tin tuyển dụng"; $data['template'] = "recruitment/list_rec"; $data['act'] = 4; $rec = new libraries_recruitment(); $pager = new libraries_pager(); $limit = 10; $pager->set_link("index.php?mod=recruitment&act=list"); $total = $rec->total_rec(); $start = $pager->start(); $pages = $pager->page($total, $limit); $data['pagelist'] = $pager->listpage($pages, $start, $limit); $data['rec'] = $rec->list_rec($start, $limit); loadview("layout", $data);
<?php $data = array(); $data['title'] = "Sửa tin tuyển dụng"; $data['template'] = "recruitment/edit_rec"; $data['act'] = 4; $id = $_GET['rid']; $rec = new libraries_recruitment(); $data['info'] = $rec->getdata($id); if (isset($_POST['ok'])) { $title = $_POST['rec_title']; $author = $_POST['rec_author']; $info = $_POST['rec_info']; $full = $_POST['rec_full']; $rewrite = replace($_POST['rec_title']); $dir = "../uploads/recruitment/thumb/"; //đường dẫn //Kiểu file, Gif, jpeg, zip ::bạn có thể sửa đổi nếu thích $types = array("image/gif", "image/GIF", "image/JPG", "image/jpg", "image/JPEG", "image/jpeg", "image/png", "image/PNG", "application/x-zip-compressed", "application/msword", "application/vnd.ms-excel"); //Check to determine if the submit button has been pressed //Shorten Variables $tmp_name = $_FILES["upload"]["tmp_name"]; $new_name = $_FILES["upload"]["name"]; //Check MIME Type if (in_array($_FILES["upload"]["type"], $types)) { //Move file from tmp dir to new location move_uploaded_file($tmp_name, $dir . $new_name); $img = $_FILES["upload"]["name"]; } else { //Print Error Message echo "<script>alert('Định dạng file không hợp lệ !');</script>";