Rangitaki 0.8

This commit is contained in:
mmk2410 2015-07-14 22:10:16 +02:00
parent f996fbc1db
commit 34a8798b95
7 changed files with 34 additions and 83 deletions

View file

@ -1,55 +0,0 @@
<!DOCTYPE html>
<!--
The MIT License
Copyright 2015 mmk2410.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Rangitaki Control Center</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<link rel="stylesheet" href="../res/rcc.css" />
</head>
<body>
<div class="header">
<a href="../" class="title">Rangitaki Control Center</a>
</div>
<div class="main">
<section class="card">
<div class="headline">Password Generator</div>
<?php
$passwd = filter_input(INPUT_POST, "passwd");
if (passwd == "") {
?>
<form action="./" method="post">
<p>New password:<br><br><input type="password" class="itextfield" name="passwd"/></p>
<input type="submit" value="Get password" class="button"/>
</form>
<?php
} else {
echo "<p style='word-wrap: break-word;'>" . password_hash($passwd, PASSWORD_DEFAULT) . "</p>";
}
?>
</section>
</div>
</body>
</html>

View file

@ -36,8 +36,15 @@ THE SOFTWARE.
<div class="main">
<?php
include '../config.php';
$passwd = filter_input(INPUT_POST, "passwd");
if ($rcc == "yes") {
include 'password.php';
session_start();
if(isset($_POST['passwd'])){
$passwd = $_POST['passwd'];
$_SESSION['passwd'] = $_POST['passwd'];
} else if(isset($_SESSION['passwd'])) {
$passwd = $_SESSION['passwd'];
}
if ($passwd == "") {
?>
<section class="card">
@ -49,10 +56,8 @@ THE SOFTWARE.
</section>
<?php
} else {
chmod("passwd.txt", 0644);
$hash = file_get_contents("passwd.txt");
chmod("passwd.txt", 0000);
if (password_verify($passwd, $hash)) {
if ($passwd == $password) {
$_SESSION['login'] = true;
?>
<section class="card">
<div class="headline">File Upload</div>
@ -88,17 +93,6 @@ THE SOFTWARE.
<?php
}
}
?>
<section class="card">
<div class="headline">Password</div>
<p>
Generate a new password.
</p>
<a class="button" href="./genpas/">
GENERATOR
</a>
</section>
<?php
} else {
?>
<section class="card">

View file

@ -1 +0,0 @@
$2y$10$vgN9txL19vvXKAT.ywFy5u0ApyZ3XAgExBtSff53RUJcnwbsNGBAm

3
rcc/password.php Normal file
View file

@ -0,0 +1,3 @@
<?php
// Set here your RCC password
$password = "setyourpassword";

View file

@ -37,17 +37,20 @@ THE SOFTWARE.
<section class="card">
<div class="headline">File Upload</div>
<?php
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
$blog = filter_input(INPUT_POST, "blog");
$uploaddir = "../..//articles/$blog/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>";
session_start();
if($_SESSION['login']){
if ($_FILES['userfile']['name'] == "") {
echo "<p>You have to choose a file!</p>";
} else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
$blog = filter_input(INPUT_POST, "blog");
$uploaddir = "../..//articles/$blog/";
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "<p>The post was successfully uploaded and is now published.</p>";
} else {
echo "<p>During the uploading process an error occured! <br> Error Code:" . ($_FILES['userfile']['error'] . "</p>");
}
}
}
?>