Skip to content

Instantly share code, notes, and snippets.

View kaqfa's full-sized avatar
😁

Fahri Firdausillah kaqfa

😁
View GitHub Profile
@kaqfa
kaqfa / index.php
Last active September 19, 2015 07:23
Gist tutorial github
<?php
echo "<h1>Hello World Biasa</h1>";
?>
@kaqfa
kaqfa / readme.md
Created September 19, 2015 07:25
readme tutorial github

Proyek Latihan Koding

Proyek ini digunakan untuk latihan koding PHP dan menyimpannya pada github.

Creating and running apps

  • ionic start keuangan tabs [must have Internet connection]
  • ionic serve

Setting Browser for Testing

  • Pake firefox, klik Menu->Developer->Responsive Design View [Ctrl+Shift+M]

Application Structure

server {
listen 80;
server_name yourdomain.net;
location /static {
alias /home/youruser/webapp/staticfiles;
}
location / {
sub_filter_types text/plain application/json;
@kaqfa
kaqfa / user_table.sql
Last active December 19, 2016 10:32
Kumpulan kode manajemen login dengan PDO (PHP Data Object)
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
);
<!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>
<?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();
<?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);
<?php
session_start();
// $user = $_SESSION['login'];
$user = $_COOKIE['login'];
if($user){
require "../php/admin_input_mhs.php";
} else {
header("location:login.php");
}
<!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>