Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

302 Zeilen
10 KiB

<?php
ini_set('session.use_only_cookies', TRUE);
ini_set('session.use_trans_sid', FALSE);
session_start();
require_once("conn/db.php");
require_once('utils/helper.php');
if (!isset($_SESSION['nim'])) {
header('location:login.php');
} else {
$nim = $_SESSION['nim'];
}
$queryStudent = "SELECT
TOP 1
a.nim,
b.nim_panitia,
b.role,
COUNT(c.id_pemilu) AS votes
FROM
tb_mhs AS a
LEFT JOIN
tb_panitia b ON b.nim_panitia = a.nim
LEFT JOIN
tb_pemilu c ON c.nim_mhs = a.nim
WHERE
a.nim = '$nim'
GROUP BY
a.nim,
b.nim_panitia,
b.role";
$execStudent = odbc_exec($koneksi, $queryStudent);
$student = dbGet($execStudent)[0];
// Cek dia panitia
if ($student['nim_panitia'] != null) {
if ((int) $student['role'] === 1) {
header('location:private.php');
} else {
header('location:tampilanSION.php');
}
}
// Cek dia udah vote atau belom
if ((int) $student['votes'] > 0) {
header('location:tampilanSION.php');
} else {
if (empty($_SESSION['token'])) {
if (function_exists('mcrypt_create_iv')) {
$_SESSION['token'] = bin2hex(mcrypt_create_iv(32, MCRYPT_DEV_URANDOM));
} else {
$_SESSION['token'] = bin2hex(openssl_random_pseudo_bytes(32));
}
}
$token = $_SESSION['token'];
}
// Ambil profil calon
$queryCandidates = "SELECT
a.id_calon,
a.nama_calon,
a.photo,
a.id_status,
b.visi,
b.misi
FROM
tb_calon AS a
INNER JOIN
tb_visimisi b ON b.id_calon = a.id_calon
ORDER BY a.photo";
$execCandidates = odbc_exec($koneksi, $queryCandidates);
$candidates = dbGet($execCandidates);
$sema = array_filter($candidates, function ($item) {
return $item['id_status'] === 'KTU3vVnd';
});
$balma = array_filter($candidates, function ($item) {
return $item['id_status'] === 'S9af54pY';
});
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Poling Pemilu Raya <?= date('Y') ?></title>
<link href="public/css/bootstrap.css" rel="stylesheet">
<link href="public/css/normalize.css" rel="stylesheet">
<link href="public/css/style.css" rel="stylesheet">
</head>
<body>
<header>
<div>
<img class="img-responsive shd one" src="public/images/banner.png">
</div>
<div class="clearfix"></div>
</header>
<main>
<form action="validate.php" method="post">
<div class="text-center lists-striped" data-toggle="buttons">
<h1 class="ttl" style="font-size:50px; margin-bottom:24px;">POLLING PEMILU RAYA <?= date('Y') ?><br></h1>
<p class="text-warning" style="font-size:16px; margin-bottom:24px;">
<em>
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Pilih 1 calon Sema dan 1 calon Balma, kemudian klik tombol <b>Simpan</b> yang berada di paling bawah untuk menyimpan vote anda.
</em>
</p>
<!--data-toggle="buttons"-->
<input type="hidden" name="token_" value="<?= $token ?>" />
<?php
if (isset($_SESSION['get'])) {
$get = $_GET['get'];
if ($get == 1) {
$msg = 'Ada Katagori yang belum di polling';
} else if($get == 2) {
$msg = 'Tidak bisa melakukan poling lagi';
} else if($get == 3) {
$msg = 'Tidak dapat melakukan poling';
} else {
$msg = 'Tidak dapat melakukan poling, silahkan coba kembali !';
}
?>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-push-3 col-sm-10 col-sm-push-1">
<div class="alert alert-danger alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<strong>
<span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> <?= $msg; ?>
</strong>
</div>
</div>
</div>
</div>
<?php
}
unset($_SESSION['get']);
?>
<!-- <div class="stripe"></div> -->
<h1 class="ttl">Calon Ketua & Wakil Ketua Senat Mahasiswa</h1>
<div class="lines"></div>
<p class="text-warning">
<em>
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Klik salah satu foto atau nama untuk polling
</em>
</p>
<div class="container">
<div class="row">
<?php
$no = 1;
$inputName = 'senat';
foreach ($sema as $key => $item) {
?>
<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12">
<?php include('./components/card-vote.php'); ?>
</div>
<?php
}
?>
</div>
</div>
<div class="clearfix" style="margin-top:10px;"></div>
<!-- <div class="stripe-reverse"></div> -->
</div>
<!--end for senat-->
<div class="clearfix"></div>
<div class="shadow"></div>
<!--for balma-->
<div class="text-center lists" data-toggle="buttons">
<!-- <div class="stripe"></div> -->
<h1 class="ttl">Calon Ketua Badan Legislatif Mahasiswa</h1>
<div class="lines"></div>
<p class="text-warning">
<em>
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> Klik salah satu foto atau nama untuk polling
</em>
</p>
<div class="container">
<div class="row">
<?php
$no = 1;
$inputName = 'balma';
foreach ($balma as $key => $item) {
?>
<div class="col-lg-push-2 col-lg-4 col-md-6 col-sm-6 col-xs-12">
<?php include('./components/card-vote.php'); ?>
</div>
<?php
}
?>
</div>
</div>
<div class="clearfix" style="margin-top: 15px;"></div>
<!-- <div class="stripe-reverse"></div> -->
</div>
<!--end for balma-->
<div class="clearfix"></div>
<!--end for modal-->
<div class="text-center">
<button type="submit" name="formSubmit" value="Submit" class="btn btn-lg btn-success submit">Simpan <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span></button>
</div>
</form>
</main>
<footer>
<div class="clearfix"></div>
<div class="text-center">
<img class="img-responsive one" src="public/images/banner2.png">
<div class="lists-footer">
<p style="margin:0 5px;">Copyright &copy; <?= date('Y') ?> IT Support Pemira</p>
</div>
</div>
</footer>
<!--for modal-->
<div class="modal fade" id="visimisi" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" style="text-align:center;"></h4>
</div>
<div class="modal-body">
<div class="imginsert" style="text-align:center;"></div>
<h2 style="text-align:center;">Visi</h2>
<div class="visi"></div>
<h2 style="text-align:center;">Misi</h2>
<div class="misi"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
</div>
</div>
</div>
</div>
<script src="public/js/jquery-3.3.1.min.js"></script>
<script src="public/js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
$('#visimisi').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var recipient = button.data('kandidat')
var recipient2 = button.data('visi')
var recipient3 = button.data('misi')
var recipient4 = button.data('img')
var modal = $(this)
modal.find('.modal-title').text(recipient)
modal.find('.visi').html(recipient2)
modal.find('.misi').html(recipient3)
modal.find('.imginsert').html('<img class="img-responsive img-thumbnail" src="' + recipient4 + '" alt="asdad">')
});
});
</script>
</body>
</html>