Пример #1
0
<?php

require_once 'assets/initialize.php';
if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION['ID'])) {
    //update tgl terakhir login
    $i = new laksanakan();
    $tdbase = " tgllogin = '******'";
    $ndbase = "user";
    $wheres = " id = " . $_SESSION['ID'];
    $i->updatedb($tdbase, $ndbase, $wheres);
    session_unset();
    session_destroy();
    session_write_close();
    setcookie(session_name(), '', 0, '/');
    session_regenerate_id(true);
    header("Location: index.php");
} else {
    header("Location: login.php");
}
Пример #2
0
    //cek apakah sudah ada session login kalau belum login arahkan form login
    header("Location: login.php");
}
$helpers = new helpers();
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 220;
$smarty->assign('basename', BASENAME);
$timestamp = time();
$smarty->assign('timestamp', $timestamp);
$md5salt = md5('unique_salt' . $timestamp);
$smarty->assign('md5salt', $md5salt);
$i = new laksanakan();
$tdbase = " u.*, h.nama AS hakakses ";
$ndbase = " user ";
#paging
$rowuser = $i->ambil(' count(id) AS jmlid ', $ndbase, " ");
$jml = $rowuser[0]->jmlid;
if (isset($_GET["page"])) {
    $page = $_GET["page"];
} else {
    $page = 1;
}
$offset = ($page - 1) * LIMITDB;
$totpag = ceil($jml / LIMITDB);
$smarty->assign('totalpage', $totpag);
$smarty->assign('page', $page);
#endpaging
Пример #3
0
if (isset($_SESSION['ID'])) {
    //cek apakah sudah ada session login kalau sudah login arahkan ke dashboard user
    header("Location: userdashboard.php");
}
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
$smarty->assign('basename', BASENAME);
$smarty->assign('link', LINK_URL);
/*
 * Located in the assets/classes folder
 */
$helpers = new helpers();
// cek password
if (isset($_POST['signin'])) {
    $i = new laksanakan();
    if (!empty($_POST['email']) || !empty($_POST['password'])) {
        $email = addslashes($_POST['email']);
        $pass = addslashes($_POST['password']);
        $inputdata = " `id`,`nama`, `password`, `email`, `hak`, `statuss` ";
        $wheres = " `email` = '" . $email . "' limit 1 ";
        $cekquery = $i->ambilDetail($inputdata, 'user', $wheres);
        if (!empty($cekquery[0]->password) || !empty($cekquery[0]->email)) {
            $password = $cekquery[0]->password;
            if (password_verify($pass, $password)) {
                if (!isset($_SESSION)) {
                    session_start();
                }
                $_SESSION['ID'] = $cekquery[0]->id;
                $_SESSION['NAMA'] = $cekquery[0]->nama;
                $_SESSION['HAK'] = $cekquery[0]->hak;
Пример #4
0
}
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 220;
$smarty->assign('basename', BASENAME);
/*
 * Located in the assets/classes folder
 */
$helpers = new helpers();
//cek apakah submit di klik
//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');
Пример #5
0
require_once 'assets/initialize.php';
require_once 'assets/classes/fungsi.class.php';
if (isset($_SESSION['ID'])) {
    //cek apakah sudah ada session login kalau sudah login arahkan ke dashboard user
    header("Location: userdashboard.php");
}
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
$smarty->assign('basename', BASENAME);
$smarty->assign('link', LINK_URL);
/*
 * Located in the assets/classes folder
 */
$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) {
Пример #6
0
require_once 'assets/initialize.php';
$helpers = new helpers();
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 220;
//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
Пример #7
0
require_once 'assets/initialize.php';
$helpers = new helpers();
$smarty = new Smarty();
$smarty->template_dir = 'theme';
$smarty->compile_dir = 'cache';
//$smarty->debugging = true;
//$smarty->caching = true;
//$smarty->cache_lifetime = 220;
//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);
//tampilakn isi berita
$G = new laksanakan();
#view user
$tdbase = " * ";
$ndbase = " user ";
#paging
$detailpaging = " ";
$rowuser = $G->ambil(' count(id) AS jmlid ', $ndbase, $detailpaging);
$jml = $rowuser[0]->jmlid;
if (isset($_GET["page"])) {
    $page = $_GET["page"];
} else {
    $page = 1;
}
$offset = ($page - 1) * LIMITDB;
$totpag = ceil($jml / LIMITDB);
$smarty->assign('totalpage', $totpag);
Пример #8
0
Released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
require_once 'assets/initialize.php';
if (!isset($_SESSION['ID'])) {
    //cek apakah sudah ada session login kalau belum login arahkan form login
    header("Location: login.php");
}
// Define a destination
$targetFolder = "images/uploads/" . $_SESSION['ID'] . "/";
// Relative to the root
if (!is_dir($targetFolder)) {
    mkdir($targetFolder, 0775);
}
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
    $i = new laksanakan();
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $FileData = strtolower(str_replace(' ', '_', $_FILES['Filedata']['name']));
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $imageFileType = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);
    if (isset($_POST['renamefile']) && !empty($_POST['renamefile'])) {
        $targetFile = $targetFolder . $_POST['renamefile'] . "." . $imageFileType;
        $namafile = $_POST['renamefile'] . "." . $imageFileType;
    } elseif (isset($_POST['slideshow']) && $_POST['slideshow'] == TRUE) {
        $targetFile = "images/uploads/" . $FileData;
        $namafile = $FileData;
    } else {
        $targetFile = $targetFolder . $FileData;
        $namafile = $FileData;
    }
    if (file_exists($targetFile)) {