This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* getPolling adalah fungsi untuk mengambil dan menambilkan | |
* poling atau hasil vote yang diperoleh, sekaligus di convert | |
* kedalam persen | |
* | |
* @param int $id id_opsi | |
* @return string | |
*/ | |
function getPolling($id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'config.php'; | |
if (isset($_GET['nomer']) && ! empty($_GET['nomer'])) { | |
$nomerVote = $_GET['nomer']; | |
// sql untuk menambahkan vote kedatabase | |
$sql = "INSERT INTO voting (id_opsi, date_create) VALUES ('$nomerVote', NOW()) "; | |
$insert = $connect->query($sql); | |
if ($insert) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// koneksi database | |
require 'config.php'; | |
?> | |
<html> | |
<head> | |
<title>Sistem Vote</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dbhost = 'localhost'; | |
$dbuser = 'root'; | |
$dbpass = ''; | |
$dbname = 'votes'; | |
$connect = new mysqli($dbhost, $dbuser, $dbpass, $dbname); | |
if ($connect->connect_error) { | |
die('Error Koneksi : ' . $connect->connect_error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<!-- Required meta tags --> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<!-- Bootstrap CSS --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
$instance = array(); | |
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; | |
return $instance; | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
// nilai default bila $instance['title'] belum diset / kosong (empty) | |
$title = ! empty( $instance['title'] ) ? $instance['title'] : esc_html__( 'New title' ); | |
?> | |
<p> | |
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:' ); ?></label> | |
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" | |
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" | |
type="text" value="<?php echo esc_attr( $title ); ?>"> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .... | |
$widget_html = $args['before_widget']; | |
$nama = ""; | |
if ( ! empty( $instance['title'] ) ) { | |
$widget_html .= $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; | |
$nama = $instance['title']; | |
} | |
$widget_html .= "<b>Nama Widget : </b> " . $nama; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Widget extends WP_Widget { | |
/** | |
* Mengatur Nama Widget | |
*/ | |
public function __construct() { | |
$widget_ops = array( | |
'classname' => 'my_widget', // class pada html | |
'description' => 'My Widget is awesome', // deskripsi tentang widget |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sekarang Jam <time>19:00</time>. |