Beispiel #1
0
//set format tanggal
$config['date'] = ' %A, %d %B %Y jam %H:%M:%S';
//$config['time'] = '';
$smarty->assign('config', $config);
$smarty->assign('basename', BASENAME);
$smarty->assign('link', LINK_URL);
$G = new laksanakan();
#jumbotron/slideshow
$slide = $G->ambil("id, judul, konten, linkphoto ", " vslideshow ", " GROUP BY token ORDER BY id ");
$smarty->assign('slide', $slide);
#simpan komentar
if (isset($_POST['postkomen']) && isset($_SESSION['ID']) && !empty($_POST['komentar'])) {
    $komentar = htmlspecialchars(addslashes(nl2br($_POST['komentar'])));
    $inputdata = array('idberita' => $_POST['idkomen'], 'tglkomen' => date("Y-m-d H:i:s"), 'user' => $_POST['user'], 'komentar' => $komentar);
    $_POST['update'] = 'false';
    $G->simpan($inputdata, 'komentar');
    $helpers->setAlert('alert-success', "Komentar berhasil");
}
//tampilakan isi berita
$tdbase = " * ";
$ndbase = " vberitaapprove ";
#paging
$limitdb = 15;
if (isset($_GET['kat'])) {
    $detailpaging = " WHERE namakategori ='" . $_GET['kat'] . "'";
} else {
    $detailpaging = " ";
}
$rowuser = $G->ambil(' count(id) AS jmlid ', $ndbase, $detailpaging);
$jml = $rowuser[0]->jmlid;
if (isset($_GET["page"])) {
Beispiel #2
0
//jika isset submit terisi maka proses data untuk masukan pendaftaran ke db
if (isset($_POST['submit'])) {
    $i = new laksanakan();
    //cek jika data yang di $_POST tidak kosong
    if (!empty($_POST['nama']) || !empty($_POST['email']) || !empty($_POST['notelp']) || !empty($_POST['tgllahir']) || !empty($_POST['alamat']) || !empty($_POST['kodepos']) || !empty($_POST['jeniskelamin']) || !empty($_POST['password'])) {
        //rubah passwoar menjadi hash
        $nama = addslashes($_POST['nama']);
        $email = addslashes($_POST['email']);
        $pass = addslashes($_POST['password']);
        $password = password_hash($pass, PASSWORD_DEFAULT);
        //form input masukan dalam satu array
        $inputdata = array('nama' => $nama, 'email' => $email, 'notelp' => $_POST['notelp'], 'tgllahir' => $_POST['tgllahir'], 'alamat' => $_POST['alamat'], 'kodepos' => $_POST['kodepos'], 'jeniskelamin' => $_POST['jeniskelamin'], 'password' => $password, 'tgldaftar' => date("Y-m-d"), 'hak' => '99', 'status' => '0');
        //set update=false
        $_POST['update'] = 'false';
        //simpan data user ke db
        $i->simpan($inputdata, 'user');
        //tampilkan pesan bila pendaftaran berhasil
        $helpers->setAlert('alert-success', 'Pendaftaran Berhasil');
    }
}
/*
 * Post back when delete is selected
 */
/*
if(isset($_GET['action']) == 'delete') {
    $i->deleteInvoice($_GET['invoiceId']);
    $helpers->setAlert('alert-success', 'Invoice Deleted!');
    $helpers->redirect_to('http://' . SITE_URL);
}
*/
/*
        }
        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>";
    }
}
//fugsi resize image
function resizeImage($filename, $newwidth, $newheight, $extension, $thumbnail)
{
    list($width, $height) = getimagesize($filename);
    if ($width > $height && $newheight < $height) {
        $newheight = $height / ($width / $newwidth);
    } else {
        if ($width < $height && $newwidth < $width) {
            $newwidth = $width / ($height / $newheight);