This commit is contained in:
s416267 2018-11-16 11:50:05 +01:00
commit ef6ad619e3
11 changed files with 913 additions and 0 deletions

132
admin-zone/css/style.css Normal file
View File

@ -0,0 +1,132 @@
.navbar {
margin-bottom: 0;
border-radius: 0;
}
/* Add a gray background color and some padding to the footer */
footer {
background-color: #f2f2f2;
padding: 25px;
}
.carousel-inner img {
width: 100%; /* Set width to 100% */
margin: auto;
min-height:200px;
}
/* Hide the carousel text when the screen is less than 600 pixels wide */
@media (max-width: 600px) {
.carousel-caption {
display: none;
}
}
.nag1{
border: 2px dotted black;
}
/* panel cms */
.wrapper{
display:flex;
align-items: stretch;
}
#sidebar{
min-width:250px;
max-width:250px;
min-height: 100vh;
}
#sidebar.active{
margin-left:-250px;
}
@media (max-width: 768px) {
#sidebar{
margin-left: -250px;
}
}
@import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a, a:hover, a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
#sidebar {
/* don't forget to add all the previously mentioned styles here too */
background: #7386D5;
color: #fff;
transition: all 0.3s;
}
#sidebar .sidebar-header {
padding: 20px;
background: #6d7fcc;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #47748b;
}
#sidebar ul p {
color: #fff;
padding: 10px;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #7386D5;
background: #fff;
}
#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
background: #6d7fcc;
}
ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
background: #6d7fcc;
}
a[data-toggle="collapse"] {
position: relative;
}
.span {
font-size:18px;
}
a[aria-expanded="false"]::before, a[aria-expanded="true"]::before {
content: '\e259';
display: block;
position: absolute;
right: 20px;
font-family: 'Glyphicons Halflings';
font-size: 0.6em;
}
a[aria-expanded="true"]::before {
content: '\e260';
}

178
admin-zone/css/style2.css Normal file
View File

@ -0,0 +1,178 @@
/*
DEMO STYLE
*/
@import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";
body {
font-family: 'Poppins', sans-serif;
background: #fafafa;
}
p {
font-family: 'Poppins', sans-serif;
font-size: 1.1em;
font-weight: 300;
line-height: 1.7em;
color: #999;
}
a, a:hover, a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
.navbar {
padding: 15px 10px;
background: #fff;
border: none;
border-radius: 0;
margin-bottom: 40px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}
.navbar-btn {
box-shadow: none;
outline: none !important;
border: none;
}
.line {
width: 100%;
height: 1px;
border-bottom: 1px dashed #ddd;
margin: 40px 0;
}
/* ---------------------------------------------------
SIDEBAR STYLE
----------------------------------------------------- */
#sidebar {
width: 250px;
position: fixed;
top: 0;
left: 0;
height: 100vh;
z-index: 999;
background: #7386D5;
color: #fff;
transition: all 0.3s;
}
#sidebar.active {
margin-left: -250px;
}
#sidebar .sidebar-header {
padding: 20px;
background: #6d7fcc;
}
#sidebar ul.components {
padding: 20px 0;
border-bottom: 1px solid #47748b;
}
#sidebar ul p {
color: #fff;
padding: 10px;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #7386D5;
background: #fff;
}
#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
background: #6d7fcc;
}
a[data-toggle="collapse"] {
position: relative;
}
a[aria-expanded="false"]::before, a[aria-expanded="true"]::before {
content: '\e259';
display: block;
position: absolute;
right: 20px;
font-family: 'Glyphicons Halflings';
font-size: 0.6em;
}
a[aria-expanded="true"]::before {
content: '\e260';
}
ul ul a {
font-size: 0.9em !important;
padding-left: 30px !important;
background: #6d7fcc;
}
ul.CTAs {
padding: 20px;
}
ul.CTAs a {
text-align: center;
font-size: 0.9em !important;
display: block;
border-radius: 5px;
margin-bottom: 5px;
}
a.download {
background: #fff;
color: #7386D5;
}
a.article, a.article:hover {
background: #6d7fcc !important;
color: #fff !important;
}
/* ---------------------------------------------------
CONTENT STYLE
----------------------------------------------------- */
#content {
width: calc(100% - 250px);
padding: 40px;
min-height: 100vh;
transition: all 0.3s;
position: absolute;
top: 0;
right: 0;
}
#content.active {
width: 100%;
}
/* ---------------------------------------------------
MEDIAQUERIES
----------------------------------------------------- */
@media (max-width: 768px) {
#sidebar {
margin-left: -250px;
}
#sidebar.active {
margin-left: 0;
}
#content {
width: 100%;
}
#content.active {
width: calc(100% - 250px);
}
#sidebarCollapse span {
display: none;
}
}

114
admin-zone/index.php Normal file
View File

@ -0,0 +1,114 @@
<?php
if( !isset( $_SESSION ) ) session_start();
if(empty($_SESSION['user'])){
header('Location: login.php');
}
?>
<html>
<head>
<meta charset="utf-8">
<title>Panel CMS</title>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- JS STYLE AND BS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../css/style2.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
</head>
<body>
<div class="wrapper">
<nav id="sidebar">
<div class="sidebar-header">
<h3>Panel użytkownika</h3>
</div>
<ul class="list-unstyled components">
<li><a href="">Strona główna</a></li>
<li class="active"><a target="zawartosc" name="dodajemy" href="index.php">Posty</a></li>
<li><a href="newsy.php">Newsy</a></li>
</ul>
</nav>
<div id="content">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span>
</button>
</div>
</div>
</nav>
<table class="table table-striped">
<tr>
<th>ID Postu</th>
<th>Tytuł</th>
<th>Opis</th>
<th>Treść</th>
<th>Data dodania</th>
<th>Data modyfikacji</th>
</tr>
<?php
$trash = '';
include "../settings/db_connect.php";
if ($sql = $mysqli->prepare("SELECT * FROM post ORDER BY data_dodania"))
{
$sql->execute();
$sql->bind_result($post_id,$trash,$title,$description,$main,$date,$mod_date);
while ($sql->fetch())
{
echo "<tr>
<td>$post_id</td>
<td>$title</td>
<td>$description</td>
<td>$main</td>
<td>$date</td>
<td>$mod_date</td>
<td><a href=\"edit.php?nr=$post_id\" class=\"btn btn-info\">Edytuj</a></td>
<td><a href=\"usun.php?nr=$post_id\" class=\"btn btn-danger\" onclick=\"javascript:return confirm('Czy na pewno usunąć?'); \">Usuń</a></td>
</tr>";
}
$sql->close();
}
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin." );
$mysqli->close();
?>
</table>
<a href="dodaj.php" class="btn btn-success">Dodawanie nowego</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- Bootstrap Js CDN -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- jQuery Custom Scroller CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#sidebar").mCustomScrollbar({
theme: "minimal"
});
$('#sidebarCollapse').on('click', function () {
$('#sidebar, #content').toggleClass('active');
$('.collapse.in').toggleClass('in');
$('a[aria-expanded=true]').attr('aria-expanded', 'false');
});
$('#dodajemy').click(function(){
$("#zawartosc").load('index.php');
});
});
</script>
</body>
</html>

14
admin-zone/login.php Normal file
View File

@ -0,0 +1,14 @@
<?php
include "logincheck.php";
?>
<html>
<body>
<form action="" method="POST" style="text-align:center;">
<p>Login: <input type="text" placeholder="Login" id="user" name="user"></p>
<p>Hasło: <input type="text" placeholder="Hasło" id="password" name="password"></p>
<input type="submit" value="Login" name="submitas" />
<span><?php echo $error; ?></span>
</form>
</body>

25
admin-zone/logincheck.php Normal file
View File

@ -0,0 +1,25 @@
<?php
if( !isset( $_SESSION ) ) session_start();
$error='';
if(isset($_POST['submitas'])){
if(empty($_POST['user']) || empty($_POST['password'])){
$error='Login lub hasło jest nieprawidłowe!';
}
else{
$user=$_POST['user'];
$password=md5($_POST['password']);
include "../settings/db_connect.php";
$query = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'");
$rows = mysqli_num_rows($query);
if($rows == 1){
header("Location: index.php");
$_SESSION['user']=$user;
$_SESSION['loggedIn']=1;
}
else{
$error="Login lub hasło są nieprawidłowe!";
}
mysqli_close($mysqli);
}
}
?>

95
css/global.css Normal file
View File

@ -0,0 +1,95 @@
.body{
background-color: azure;
}
.navHeader{
position:absolute;
width: 100%;
height: 200px;
margin-right: 0;
margin-left: 0;
z-index: -1;
}
.navHeader img {
width: 100%;
height: 200px;
z-index: -1;
}
.elementsOnHeader {
position: sticky;
width: 100%;
height: 500px;
margin-right: 0;
margin-left: 0;
}
.elementsOnHeader .login {
left: 82%;
top: 2%;
padding: 0;
}
.elementsOnHeader .register {
text-align: center;
top: 30%;
padding: 0;
}
.elementsOnHeader .search {
left: 20%;
top: 85%;
padding: 0;
}
.mainrow {
top: 68%;
left: 2%;
max-width: 98%;
}
.mininote h3 {
text-align: center;
}
.mininote img {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
.mininote p {
text-align: justify;
}
.footer {
background-color: lightgray;
width: 100%;
}
.footer p{
font: "Comic Sans MS";
font-size: 25px;
width: 100%;
text-align: center;
}
.button {
background-color: #f4c242;
border: 1px solid #f4b241;
border-radius: 6px;
color: gray;
padding: 12px 22px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
transition-duration: 0.2s;
}
.button:hover {
background-color: #f4b241;
color: white;
}

267
css/register.css Normal file
View File

@ -0,0 +1,267 @@
*{
margin:0;
padding:0;
}
h1 {
font-size: 2em;
font-family: "Core Sans N W01 35 Light";
font-weight: normal;
margin: .67em 0;
display: block;
}
#registered {
margin-top: 50px;
}
#registered img {
margin-bottom: 0px;
width: 100px;
height: 100px;
}
#registered span {
clear: both;
display: block;
}
img {
margin-bottom: 20px;
}
.avatar {
margin: 10px 0 20px 0;
}
.module{
position:relative;
top:10%;
height:65%;
width:450px;
margin-left:auto;
margin-right:auto;
}
.user {
color: #66d8fc;
font-weight: bold;
}
.userlist {
float:left;
padding: 30px;
}
.userlist span {
color: #0590fc;
}
.welcome{
position:relative;
top:30%;
height:65%;
width:900px;
margin-left:auto;
margin-right:auto;
margin-top: 50px;
}
::-moz-selection {
background: #19547c;
}
::selection {
background: #19547c;
}
input::-moz-selection {
background: #037db6;
}
input::selection {
background: #037db6;
}
body{
color: #fff;
background-color:#f0f0f0;
font-family:helvetica;
}
.body-content{
position:relative;
top:20px;
height:700px;
width:800px;
margin-left:auto;
margin-right:auto;
background: transparent;
}
select,
textarea,
input[type="text"],
input[type="password"],
input[type="email"]
{
height:30px;
width:100%;;
display: inline-block;
vertical-align: middle;
height: 34px;
padding: 0 10px;
margin-top: 3px;
margin-bottom: 10px;
font-size: 15px;
line-height: 20px;
border: 1px solid rgba(255, 255, 255, 0.3);
background-color: rgba(0, 0, 0, 0.5);
color: rgba(255, 255, 255, 0.7);
-moz-box-sizing: border-box;
box-sizing: border-box;
border-radius: 2px;
}
select,
textarea,
input[type="text"],
input[type="password"],
input[type="email"] {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
-webkit-transition: background-position 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
transition: background-position 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
select:hover,
textarea:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover {
border-color: rgba(255, 255, 255, 0.5);
background-color: rgba(0, 0, 0, 0.5);
color: rgba(255, 255, 255, 0.7);
}
select:focus,
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
border: 2px solid;
border-color: #1e5f99;
background-color: rgba(0, 0, 0, 0.5);
color: #ffffff;
}
.btn {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin: 3px 0;
padding: 6px 20px;
font-size: 15px;
line-height: 20px;
height: 34px;
background-color: rgba(0, 0, 0, 0.15);
color: #00aeff;
border: 1px solid rgba(255, 255, 255, 0.15);
box-shadow: 0 0 rgba(0, 0, 0, 0);
border-radius: 2px;
-webkit-transition: background-color 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
transition: background-color 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn.active,
.btn:active {
padding: 7px 19px 5px 21px;
}
.btn.disabled:active,
.btn[disabled]:active,
.btn.disabled.active,
.btn[disabled].active {
padding: 6px 20px !important;
}
.btn:hover,
.btn:focus {
background-color: rgba(0, 0, 0, 0.25);
color: #ffffff;
border-color: rgba(255, 255, 255, 0.3);
box-shadow: 0 0 rgba(0, 0, 0, 0);
}
.btn:active,
.btn.active {
background-color: rgba(0, 0, 0, 0.15);
color: rgba(255, 255, 255, 0.8);
border-color: rgba(255, 255, 255, 0.07);
box-shadow: inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.5);
}
.btn-primary {
background-color: #098cc8;
color: #ffffff;
border: 1px solid transparent;
box-shadow: 0 0 rgba(0, 0, 0, 0);
border-radius: 2px;
-webkit-transition: background-color 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
transition: background-color 0.2s, box-shadow 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
background-image: -webkit-linear-gradient(top, #0f9ada, #0076ad);
background-image: linear-gradient(to bottom, #0f9ada, #0076ad);
border: 0;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #21b0f1;
color: #ffffff;
border-color: transparent;
box-shadow: 0 0 rgba(0, 0, 0, 0);
}
.btn-primary:active,
.btn-primary.active {
background-color: #006899;
color: rgba(255, 255, 255, 0.7);
border-color: transparent;
box-shadow: inset 1.5px 1.5px 3px rgba(0, 0, 0, 0.5);
}
.btn-primary:hover,
.btn-primary:focus {
background-image: -webkit-linear-gradient(top, #37c0ff, #0097dd);
background-image: linear-gradient(to bottom, #37c0ff, #0097dd);
}
.btn-primary:active,
.btn-primary.active {
background-image: -webkit-linear-gradient(top, #006ea1, #00608d);
background-image: linear-gradient(to bottom, #000000, #ffffff);
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6) inset, 0 0 0 1px rgba(255, 255, 255, 0.07) inset;
}
.btn-block {
display: block;
width: 100%;
padding-left: 0;
padding-right: 0;
}
.alert {
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 4px 20px 4px 20px;
font-size: 13px;
line-height: 20px;
margin-bottom: 20px;
text-shadow: none;
position: relative;
background-color: #272e3b;
color: rgba(255, 255, 255, 0.7);
border: 1px solid #000;
box-shadow: 0 0 0 1px #363d49 inset, 0 5px 10px rgba(0, 0, 0, 0.75);
}
.alert-error {
color: #f00;
background-color: #360e10;
box-shadow: 0 0 0 1px #551e21 inset, 0 5px 10px rgba(0, 0, 0, 0.75);
}
.alert:empty{
display: none;
}
.alert-success {
color: #21ec0c;
background-color: #15360e;
box-shadow: 0 0 0 1px #2a551e inset, 0 5px 10px rgba(0, 0, 0, 0.75);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

36
register/index.php Normal file
View File

@ -0,0 +1,36 @@
<html>
<head>
<link rel="stylesheet" href="../css/register.css" type="text/css">
<link rel="stylesheet" href=" ../css/global.css" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="indexstyle.css">
<!-- bootstrap js -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</head>
<body>
<div class="body-content">
<div class="module">
<h1>Rejestracja nowego użytkownika</h1>
<form class="form" action="registration.php" method="post" enctype="multipart/form-data" autocomplete="off">
<div class="alert alert-error"></div>
<input type="text" placeholder="User Name" name="username" required />
<input type="email" placeholder="Email" name="email" required />
<input type="password" placeholder="Password" name="password" autocomplete="new-password" required />
<input type="password" placeholder="Confirm Password" name="confirmpassword" autocomplete="new-password" required />
<div class="avatar"><label>Select your avatar: </label><input type="file" name="avatar" accept="image/*" required /></div>
<input type="submit" value="Register" name="register" class="btn btn-block btn-primary" />
</form>
</div>
</div>
</body>
</html>

39
register/registration.php Normal file
View File

@ -0,0 +1,39 @@
<?php
include "../settings/db_connect.php";
$_SESSION['message'] = '';
if ($_SERVER['REQUEST_METHOD'] == "POST"){
if ($_POST['password'] == $_POST['confirmpassword']){
$username = $mysqli->real_escape_string($_POST['username']);
$email = $mysqli->real_escape_string($_POST['email']);
$password = md5($_POST['password']);
$avatar_path = $mysqli->real_escape_string('../images/avatars/'.$_FILES['avatar']['name']);
if (preg_match("!image!", $_FILES['avatar']['type'])){
if(copy($_FILES['avatar']['tmp_name'], $avatar_path)){
$_SESSION['username'] = $username;
$_SESSION['avatar'] = $avatar_path;
$sql = "INSERT INTO user (username,email,password,avatar)"
. "Values ('$username','$email','$password','$avatar_path')";
if($mysqli->query($sql) === true){
$_SESSION['message'] = "Rejestracja się powiodła!";
header("location:index.php");
}
else{
$_SESSION['message'] = "Nie udało się dodać użytkownika!";
}
}
else{
$_SESION['message'] = "Nie udało się dodać pliku!"; }
}
else{
$_SESSION['message'] = "Dostępne typy plików to JPG, PNG, GIF";
}
}
else{
$_SESSION['message'] = "Hasła nie są identyczne!";
}
}
?>

13
settings/db_connect.php Normal file
View File

@ -0,0 +1,13 @@
<?php
function load($zmienna)
{
if (!isset($_GET[$variable]) || $_GET[$variable]=="")
die( "Error! Variable not found: ".$variable ); // Variable not found
return $_GET[$variable];
}
$mysqli = new mysqli("localhost", "root", "", "bloggero");
if (mysqli_connect_errno()) die( "Error: ".mysqli_connect_error() );
mysqli_set_charset( $mysqli, 'utf8');
?>