| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/nhadatkhangdien.net-bk/public_html/admin/sources/ |
Upload File : |
<?php if(!defined('_source')) die("Error");
$act = (isset($_REQUEST['act'])) ? addslashes($_REQUEST['act']) : "";
switch($act){
case "capnhat":
get_gioithieu();
$template = "doitac/item_add";
break;
case "save":
save_gioithieu();
break;
default:
$template = "index";
}
function fns_Rand_digit($min,$max,$num)
{
$result='';
for($i=0;$i<$num;$i++){
$result.=rand($min,$max);
}
return $result;
}
function get_gioithieu(){
global $d, $item;
$sql = "select * from #_doitac limit 0,1";
$d->query($sql);
if($d->num_rows()==0) transfer("Dữ liệu chưa khởi tạo.", "index.php");
$item = $d->fetch_array();
}
function save_gioithieu(){
global $d;
$file_name=fns_Rand_digit(0,9,5);
if(empty($_POST)) transfer("Không nhận được dữ liệu", "index.php?com=doitac&act=capnhat");
if($photo = upload_image("file", 'jpg|png|gif|JPG|jpeg|JPEG',_upload_hinhanh,$file_name)){
$data['photo'] = $photo;
$d->setTable('doitac');
$d->select();
if($d->num_rows()>0){
$row = $d->fetch_array();
delete_file(_upload_hinhanh.$row['photo']);
}
}
$data['mota'] =addslashes( $_POST['mota']);
$data['noidung'] = addslashes($_POST['noidung']);
$d->reset();
$d->setTable('doitac');
if($d->update($data))
transfer("Dữ liệu được cập nhật", "index.php?com=doitac&act=capnhat");
else
transfer("Cập nhật dữ liệu bị lỗi", "index.php?com=doitac&act=capnhat");
}
?>