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 Paginasi{ | |
| function __construct($pdo_connect, $sql, $num_per_page, $url_pattern){ | |
| $this->db = $pdo_connect; | |
| $this->sql = $sql; | |
| $this->npp = $num_per_page; | |
| $this->url = 'http://'.$_SERVER['HTTP_HOST'].$url_pattern; | |
| $this->cpage = (isset($_GET['p']) ? $_GET['p'] : 0); |
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
| ''' | |
| Langkahnya adalah: | |
| - create db for new wordpress | |
| - create db user for new db | |
| - download latest WP | |
| - untar WP | |
| - run wordpress in browser | |
| ''' |
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
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 16, | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", |
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> | |
| <meta charset="UTF-8"> | |
| <title>Admin Display</title> | |
| </head> | |
| <body> | |
| <h1>whatever you display in admin page</h1> | |
| <h2><?php echo "current user:".$user; ?></h2> | |
| <a href="process.php?action=logout">Logout</a> |
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 | |
| session_start(); | |
| // $user = $_SESSION['login']; | |
| $user = $_COOKIE['login']; | |
| if($user){ | |
| require "../php/admin_input_mhs.php"; | |
| } else { | |
| header("location:login.php"); | |
| } |
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 | |
| $db_name = 'test'; | |
| $db_host = 'localhost'; | |
| $db_username = 'root'; | |
| $db_passwd = ''; | |
| try { | |
| $db = new PDO("mysql:dbname=".$db_name.";host=".$db_host, | |
| $db_username, $db_passwd); |
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 | |
| session_start(); | |
| require "../pdo/connection.php"; | |
| function loginCheck(){ | |
| global $db; | |
| $prep = $db->prepare("select * from users where username=?"); | |
| $prep->execute(array($_POST['username'])); | |
| $res = $prep->fetch(); |
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> | |
| <meta charset="UTF-8"> | |
| <title>Login Page</title> | |
| </head> | |
| <body style="margin-left: auto; margin-right: auto; padding-top: 20px;"> | |
| <form action="process.php" method="post"> | |
| <table> | |
| <tr> |
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
| CREATE TABLE `users` ( | |
| `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| `username` varchar(50) NOT NULL, | |
| `password` varchar(50) NOT NULL, | |
| `full_name` varchar(100) NOT NULL, | |
| `email` varchar(100) NOT NULL | |
| ); |
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
| server { | |
| listen 80; | |
| server_name yourdomain.net; | |
| location /static { | |
| alias /home/youruser/webapp/staticfiles; | |
| } | |
| location / { | |
| sub_filter_types text/plain application/json; |