Exemple #1
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
$result = -3;
//khong dươc phep
include_once '../include/functions.php';
include_once '../objects/taikhoan.php';
include_once '../objects/tailieu.php';
if (isset($_SESSION['taikhoan'])) {
    $tk = unserialize($_SESSION['taikhoan']);
    if ($tk->Admin == 1) {
        if (isset($_GET['Ten']) && isset($_GET['TacGia']) && isset($_GET['DanhMucCon']) && isset($_GET['ID'])) {
            $id = $_GET['ID'];
            $ten = $_GET['Ten'];
            $mota = $_GET['MoTa'];
            $tacgia = $_GET['TacGia'];
            $danhmuccon = $_GET['DanhMucCon'];
            if (strlen($id) > 0 && strlen($ten) > 0 && strlen($danhmuccon) > 0) {
                $result = TaiLieu::SuaTaiLieu($id, $ten, $tacgia, $danhmuccon);
            } else {
                $result = -2;
                //thieu thong tin
            }
        }
    }
}
echo $result;
//-1 da co, 0 khong duoc, 1 ok