<?php
if ($c['level']=="superadmin") {

$id = $_POST['id'];
$title = $_POST['title'];
$provider = $_POST['provider'];
$players = $_POST['players'];
$status = $_POST['status'];
$sort = $_POST['sort'];

if($_FILES['image']['name']==""){
mysqli_query($koneksi,"
UPDATE tb_popular SET
title='$title',
provider='$provider',
players='$players',
status='$status',
sort='$sort'
WHERE id='$id'
");
}else{
$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
move_uploaded_file($tmp,"../../uploads/popular/".$img);

mysqli_query($koneksi,"
UPDATE tb_popular SET
title='$title',
provider='$provider',
image='$img',
players='$players',
status='$status',
sort='$sort'
WHERE id='$id'
");
}

echo "<script>alert('Popular berhasil diupdate');window.location='?page=popular'</script>";

}else{
echo "<script>window.location='?page=dashboard'</script>";
}
?>