Proyek ini digunakan untuk latihan koding PHP dan menyimpannya pada github.
This file contains 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 | |
echo "<h1>Hello World Biasa</h1>"; | |
?> |
This file contains 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; |
This file contains 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 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 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 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 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 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> |
OlderNewer