mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 04:26:22 +05:30
Fix sent header error
Fix sent header error.
This commit is contained in:
parent
bd5474c435
commit
97a678fc64
7 changed files with 172 additions and 135 deletions
|
|
@ -1,18 +0,0 @@
|
||||||
<div id="login">
|
|
||||||
<?php if (login()) { ?>
|
|
||||||
|
|
||||||
<div class="nav">
|
|
||||||
<a href="<?php echo config('site.url');?>/admin">Admin</a>
|
|
||||||
<a href="includes/create_post.php">Create post</a>
|
|
||||||
<a href="includes/logout.php">Logout</a>
|
|
||||||
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
|
||||||
</div>
|
|
||||||
<?php include 'includes/post_list.php';?>
|
|
||||||
|
|
||||||
<?php } else {?>
|
|
||||||
|
|
||||||
<?php include 'includes/login.php';?>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
@ -4,28 +4,7 @@ date_default_timezone_set('Asia/Jakarta');
|
||||||
require '../../system/includes/dispatch.php';
|
require '../../system/includes/dispatch.php';
|
||||||
config('source', '../../admin/config.ini');
|
config('source', '../../admin/config.ini');
|
||||||
include '../includes/session.php';
|
include '../includes/session.php';
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Create post</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="../resources/style.css" />
|
|
||||||
<link rel="stylesheet" type="text/css" href="../editor/css/editor.css" />
|
|
||||||
<script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script>
|
|
||||||
<script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script>
|
|
||||||
<script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="wrapper-outer">
|
|
||||||
<div class="wrapper-inner">
|
|
||||||
<?php if (login()) { ?>
|
|
||||||
<div class="nav">
|
|
||||||
<a href="<?php echo config('site.url');?>/admin">Admin</a>
|
|
||||||
<a href="../includes/logout.php">Logout</a>
|
|
||||||
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if(isset($_POST['submit'])) {
|
if(isset($_POST['submit'])) {
|
||||||
$post_date = date('Y-m-d-H');
|
$post_date = date('Y-m-d-H');
|
||||||
$post_tag = $_POST['tag'];
|
$post_tag = $_POST['tag'];
|
||||||
|
|
@ -45,10 +24,27 @@ include '../includes/session.php';
|
||||||
}
|
}
|
||||||
header('location: ../index.php');
|
header('location: ../index.php');
|
||||||
}
|
}
|
||||||
|
if (login()) {
|
||||||
?>
|
?>
|
||||||
<?php } else {?>
|
<!DOCTYPE html>
|
||||||
<?php header('location: ../index.php');?>
|
<html>
|
||||||
<?php } ?>
|
<head>
|
||||||
|
<title>Create post</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="../editor/css/editor.css" />
|
||||||
|
<script type="text/javascript" src="../editor/js/Markdown.Converter.js"></script>
|
||||||
|
<script type="text/javascript" src="../editor/js/Markdown.Sanitizer.js"></script>
|
||||||
|
<script type="text/javascript" src="../editor/js/Markdown.Editor.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrapper-outer">
|
||||||
|
<div class="wrapper-inner">
|
||||||
|
<div class="nav">
|
||||||
|
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
|
||||||
|
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
|
||||||
|
<a href="../includes/logout.php">Logout</a> |
|
||||||
|
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
||||||
|
</div>
|
||||||
<div class="wmd-panel">
|
<div class="wmd-panel">
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
Tag: <br><input type="text" name="tag"/><br><br>
|
Tag: <br><input type="text" name="tag"/><br><br>
|
||||||
|
|
@ -78,3 +74,4 @@ include '../includes/session.php';
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
<?php } else {header('location: ../index.php');} ?>
|
||||||
|
|
@ -3,13 +3,24 @@
|
||||||
date_default_timezone_set('Asia/Jakarta');
|
date_default_timezone_set('Asia/Jakarta');
|
||||||
require '../../system/includes/dispatch.php';
|
require '../../system/includes/dispatch.php';
|
||||||
config('source', '../../admin/config.ini');
|
config('source', '../../admin/config.ini');
|
||||||
include '../includes/session.php';;
|
include '../includes/session.php';
|
||||||
|
|
||||||
if(isset($_GET['url'])) {
|
if(isset($_GET['url'])) {
|
||||||
$url = $_GET['url'];
|
$url = $_GET['url'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
header('location: ../index.php');
|
header('location: ../index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isset($_POST['submit'])) {
|
||||||
|
$post_content = $_POST['content'];
|
||||||
|
}
|
||||||
|
if(!empty($post_content)) {
|
||||||
|
file_put_contents('../'. $url, print_r($post_content, true));
|
||||||
|
header('location: ../index.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (login()) {
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
@ -24,25 +35,13 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper-outer">
|
<div class="wrapper-outer">
|
||||||
<div class="wrapper-inner">
|
<div class="wrapper-inner">
|
||||||
<?php if (login()) { ?>
|
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
<a href="<?php echo config('site.url');?>/admin">Admin</a>
|
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
|
||||||
<a href="../includes/create_post.php">Create post</a>
|
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
|
||||||
<a href="../includes/logout.php">Logout</a>
|
<a href="../includes/create_post.php">Create post</a> |
|
||||||
|
<a href="../includes/logout.php">Logout</a> |
|
||||||
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
||||||
</div>
|
</div>
|
||||||
<?php } else {?>
|
|
||||||
<?php header('location: ../index.php');?>
|
|
||||||
<?php } ?>
|
|
||||||
<?php
|
|
||||||
if(isset($_POST['submit'])) {
|
|
||||||
$post_content = $_POST['content'];
|
|
||||||
}
|
|
||||||
if(!empty($post_content)) {
|
|
||||||
file_put_contents('../'. $url, print_r($post_content, true));
|
|
||||||
header('location: ../index.php');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<div class="wmd-panel">
|
<div class="wmd-panel">
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
<div id="wmd-button-bar" class="wmd-button-bar"></div>
|
||||||
|
|
@ -70,3 +69,4 @@
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
<?php } else {header('location: ../index.php');} ?>
|
||||||
|
|
@ -1,32 +1,74 @@
|
||||||
<?php
|
<?php
|
||||||
|
include '../includes/session.php';
|
||||||
|
|
||||||
if(isset($_POST['submit'])) {
|
if(!empty($_REQUEST['user']) && !empty($_REQUEST['password'])) {
|
||||||
|
|
||||||
$user = $_POST['user'];
|
$user = $_REQUEST['user'];
|
||||||
$user_file = 'users/' . $user . '.txt';
|
$pass = $_REQUEST['password'];
|
||||||
$pass = $_POST['password'];
|
|
||||||
|
$user_file = '../../admin/users/' . $user . '.txt';
|
||||||
$user_pass = @file_get_contents($user_file);
|
$user_pass = @file_get_contents($user_file);
|
||||||
|
|
||||||
if(file_exists($user_file)) {
|
if(file_exists($user_file)) {
|
||||||
if($pass === $user_pass) {
|
if($pass === $user_pass) {
|
||||||
$_SESSION['user'] = $user;
|
$_SESSION['user'] = $user;
|
||||||
header('location: index.php');
|
header('location: ../index.php');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo 'Username and password not match!';
|
echo <<<EOF
|
||||||
}
|
<!DOCTYPE html>
|
||||||
}
|
<html>
|
||||||
else {
|
<head>
|
||||||
echo 'Please create username.txt inside "admin/users" folder and put your password inside it.';
|
<title>Admin Panel</title>
|
||||||
}
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" />
|
||||||
|
</head>
|
||||||
}
|
<body>
|
||||||
?>
|
<div class="wrapper-outer">
|
||||||
|
<div class="wrapper-inner">
|
||||||
|
<p>Password and username not match!</p>
|
||||||
<p>Login Form</p>
|
<p>Login Form</p>
|
||||||
<form method="POST">
|
<form method="POST" action="login.php">
|
||||||
User:<br>
|
User:<br>
|
||||||
<input type="text" name="user"/><br><br>
|
<input type="text" name="user"/><br><br>
|
||||||
Pass:<br>
|
Pass:<br>
|
||||||
<input type="password" name="password"/><br><br>
|
<input type="password" name="password"/><br><br>
|
||||||
<input type="submit" name="submit" value="Login"/>
|
<input type="submit" name="submit" value="Login"/>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo <<<EOF
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Admin Panel</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="../resources/style.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrapper-outer">
|
||||||
|
<div class="wrapper-inner">
|
||||||
|
<p>Please create username.txt inside "admin/users" folder and put your password inside it.</p>
|
||||||
|
<p>Login Form</p>
|
||||||
|
<form method="POST" action="login.php">
|
||||||
|
User:<br>
|
||||||
|
<input type="text" name="user"/><br><br>
|
||||||
|
Pass:<br>
|
||||||
|
<input type="password" name="password"/><br><br>
|
||||||
|
<input type="submit" name="submit" value="Login"/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header('location: ../index.php');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -112,23 +112,20 @@ function get_profile($profile, $page, $perpage){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
if (isset($_SESSION['user'])) {
|
||||||
|
|
||||||
<table>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$posts = get_profile($_SESSION['user'], null, null);
|
$posts = get_profile($_SESSION['user'], null, null);
|
||||||
|
|
||||||
if(!empty($posts)) {
|
if(!empty($posts)) {
|
||||||
|
|
||||||
|
echo '<table>';
|
||||||
foreach($posts as $p) {
|
foreach($posts as $p) {
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td>' . $p->file . '</td>';
|
echo '<td>' . $p->file . '</td>';
|
||||||
echo '<td><form method="GET" action="includes/edit_post.php"><input type="submit" name="submit" value="Edit"/><input type="hidden" name="url" value="' . $p->file . '"/></form></td>';
|
echo '<td><form method="GET" action="includes/edit_post.php"><input type="submit" name="submit" value="Edit"/><input type="hidden" name="url" value="' . $p->file . '"/></form></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
echo '</table>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
|
||||||
</table>
|
|
||||||
|
|
@ -12,5 +12,3 @@ function login() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
ob_start();
|
|
||||||
date_default_timezone_set('Asia/Jakarta');
|
date_default_timezone_set('Asia/Jakarta');
|
||||||
require '../system/includes/dispatch.php';
|
require '../system/includes/dispatch.php';
|
||||||
config('source', '../admin/config.ini');
|
config('source', '../admin/config.ini');
|
||||||
|
|
@ -14,7 +13,29 @@ include 'includes/session.php';
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper-outer">
|
<div class="wrapper-outer">
|
||||||
<div class="wrapper-inner">
|
<div class="wrapper-inner">
|
||||||
<?php include 'includes/auth.php'; ?>
|
<?php if (login()) { ?>
|
||||||
|
|
||||||
|
<div class="nav">
|
||||||
|
<a href="<?php echo config('site.url');?>" target="_blank">Home</a> |
|
||||||
|
<a href="<?php echo config('site.url');?>/admin">Admin</a> |
|
||||||
|
<a href="includes/create_post.php">Create post</a> |
|
||||||
|
<a href="includes/logout.php">Logout</a> |
|
||||||
|
<span class="welcome">Welcome <?php echo $_SESSION['user'];?>!</span>
|
||||||
|
</div>
|
||||||
|
<?php include 'includes/post_list.php';?>
|
||||||
|
|
||||||
|
<?php } else {?>
|
||||||
|
|
||||||
|
<p>Login Form</p>
|
||||||
|
<form method="POST" action="includes/login.php">
|
||||||
|
User:<br>
|
||||||
|
<input type="text" name="user"/><br><br>
|
||||||
|
Pass:<br>
|
||||||
|
<input type="password" name="password"/><br><br>
|
||||||
|
<input type="submit" name="submit" value="Login"/>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue