$helpers = new helpers(); $i = new laksanakan(); //cek jiga reset mempunyai nilai if (isset($_GET['reset'])) { $inputdata = " `id`,`email`,`resetpasswd` "; $wheres = " `resetpasswd` = '" . $_GET['reset'] . "' limit 1 "; $cekquery = $i->ambilDetail($inputdata, 'user', $wheres); if (!empty($cekquery[0]->id)) { $smarty->assign('resetpass', $cekquery[0]->id); //jika pass di simpan if (isset($_POST['savepass']) && $_POST['savepass'] == 'ok' && !empty($_POST['password'])) { $ndbase = " user "; $password = password_hash($_POST['password'], PASSWORD_DEFAULT); $tdbase = " password = '******' , resetpasswd = '' "; $wheres = " id = " . $cekquery[0]->id . " "; $hasil = $i->updateDB($tdbase, $ndbase, $wheres); if ($hasil) { $helpers->setAlert('alert-success', 'Reset Password Berhasil, silakan logout dan login kembali'); } else { $helpers->setAlert('alert-danger', 'Ganti Password Gagal'); } } } } // cek password if (isset($_POST['lupapassword'])) { if (!empty($_POST['email'])) { $emailpost = addslashes($_POST['email']); $inputdata = " `nama`,`email` "; $wheres = " `email` = '" . $emailpost . "' limit 1 "; $cekquery = $i->ambilDetail($inputdata, 'user', $wheres);
$detailqueryhak = " "; $usershak = $i->ambil($tdbasehak, $ndbasehak, $detailqueryhak); $smarty->assign('userhak', $usershak); } else { $detailquery = " AS u JOIN hak AS h ON u.hak=h.hak WHERE id = '" . $_SESSION['ID'] . "' "; } if (!empty($_GET['l'])) { //$urllink = $_GET['l']; switch ($_GET['l']) { case "profile": if (isset($_POST['hak']) && $_SESSION['HAK'] == 11) { //rubah hak user $tdbases = " hak = '" . $_POST['hak'] . "'"; $ndbases = " user "; $wheress = " id = " . $_POST['uid'] . " "; $hasil = $i->updateDB($tdbases, $ndbases, $wheress); } #hapus user if (isset($_GET['l']) && isset($_GET['delid'])) { if ($_GET['l'] === 'profile' && !empty($_GET['delid'])) { $delndbase = ' user '; $delid = "id = " . $_GET['delid'] . " "; #cek apakah pernah posting $cquery = " WHERE user = "******"User Sudah di Hapus"); if (!empty($cekpost)) { foreach ($cekpost as $key => $value) { $upquery = " id='" . $value->id . "'"; $i->updateDB(" user = 1 ", " berita ", $upquery);
$execu = resizeImage($targetFile, $_POST['newwidth'], $_POST['newheight'], $imageFileType, $targetFile); } if (isset($_POST['thumbnail']) && $_POST['thumbnail'] == TRUE && isset($_POST['thumbnewwidth']) && isset($_POST['thumbnewheight'])) { $dirthumb = $targetFolder . "thumb/"; if (!is_dir($dirthumb)) { mkdir($dirthumb, 0775); } $filethumb = $dirthumb . $FileData; $execu = resizeImage($targetFile, $_POST['thumbnewwidth'], $_POST['thumbnewheight'], $imageFileType, $filethumb); } if (isset($_POST['profile'])) { echo " <img class='img-thumbnail' src=" . $targetFile . ">"; $ndbases = " user "; $tdbases = " photo = '" . $targetFile . "'"; $wheress = " id = " . $_SESSION['ID'] . " "; $i->updateDB($tdbases, $ndbases, $wheress); } else { #kembailkan nilai yang di upload $li = "<div class='col-md-2'><div class='panel panel-default'><div class='panel-heading '><p class='heading-images'>" . $namafile . "</p></div>\n \t\t \t\t<div class='panel-body'><img class='img-thumbnail' src='" . $filethumb . "' >"; echo $li; //simpan ke database $token = $_POST['tokenedit']; $inputdata = array('iduser' => $_SESSION['ID'], 'namaphoto' => $namafile, 'linkphoto' => $targetFile, 'thumbnail' => $filethumb, 'token' => $token, 'tanggal' => date("Y-m-d H:i:s"), 'statuss' => '0'); $_POST['update'] = 'false'; $i->simpan($inputdata, 'images'); } //end isset profile } else { echo "<div><div><div><p class='bg-danger'>Invalid file type. </p>"; } }