som changes in responsive - admin zone, new massage layout - account settings

This commit is contained in:
Szymon 2018-12-17 01:02:03 +01:00
parent 31155fb925
commit 4f6ead08b2
13 changed files with 595 additions and 461 deletions

View File

@ -1,20 +1,20 @@
<?php <?php
if( !isset( $_SESSION ) ) session_start(); if( !isset( $_SESSION ) ) session_start();
$_SESSION['message']=''; $_SESSION['message']='';
if(empty($_SESSION['user'])){ if(empty($_SESSION['user'])){
header('Location: login.php'); header('Location: login.php');
} }
include "../settings/db_connect.php"; include "../settings/db_connect.php";
$user=$_SESSION['user']; $user=$_SESSION['user'];
$password=$_SESSION['password']; $password=$_SESSION['password'];
$data = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'"); $data = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'");
$row = mysqli_fetch_array($data); $row = mysqli_fetch_array($data);
$about_short = $row['about_short']; $about_short = $row['about_short'];
$about_me = $row['about_me']; $about_me = $row['about_me'];
$about_blog = $row['about_blog']; $about_blog = $row['about_blog'];
if(isset($_POST['password_change'])){ if(isset($_POST['password_change'])){
if(!empty($_POST['password']) && !empty($_POST['newpassword']) && !empty($_POST['confirmpassword'])) { if(!empty($_POST['password']) && !empty($_POST['newpassword']) && !empty($_POST['confirmpassword'])) {
if($password != md5($_POST['newpassword'])) { if($password != md5($_POST['newpassword'])) {
if($_POST['newpassword'] == $_POST['confirmpassword']) { if($_POST['newpassword'] == $_POST['confirmpassword']) {
@ -25,31 +25,31 @@ if(isset($_POST['password_change'])){
$_SESSION['user']=$user; $_SESSION['user']=$user;
$_SESSION['password']=$newpassword; $_SESSION['password']=$newpassword;
$_SESSION['loggedIn']=1; $_SESSION['loggedIn']=1;
$_SESSION['message'] = "Hasło zostało zmienione!<br>"; $_SESSION['message'] = "Hasło: Hasło zostało zmienione!";
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Hasło: Coś poszło nie tak, spróbuj ponownie później.";
} }
mysqli_close($mysqli); mysqli_close($mysqli);
} }
else { else {
$_SESSION['message'] = "Błędne hasło!<br>"; $_SESSION['message'] = "Hasło: Błędne hasło!";
} }
} }
else{ else{
$_SESSION['message'] = "Potwierdź hasło ponownie<br>"; $_SESSION['message'] = "Hasło: Potwierdź hasło ponownie";
} }
} }
else{ else{
$_SESSION['message'] = "Nowe hasło nie może być takie samo jak obecne<br>"; $_SESSION['message'] = "Hasło: Nowe hasło nie może być takie samo jak obecne";
} }
} }
else{ else{
$_SESSION['message'] = "Należy wypełnić wszystkie wmagane pola<br>"; $_SESSION['message'] = "Hasło: Należy wypełnić wszystkie wmagane pola";
}
} }
}
if(isset($_POST['email_change'])){ if(isset($_POST['email_change'])){
$email=$row['email']; $email=$row['email'];
if(!empty($_POST['password']) && !empty($_POST['newemail']) && !empty($_POST['confirmemail'])) { if(!empty($_POST['password']) && !empty($_POST['newemail']) && !empty($_POST['confirmemail'])) {
if($email != md5($_POST['newemail'])) { if($email != md5($_POST['newemail'])) {
@ -58,31 +58,31 @@ if(isset($_POST['email_change'])){
$newemail=$_POST['newemail']; $newemail=$_POST['newemail'];
$sql = "UPDATE user SET email='$newemail' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET email='$newemail' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "email został zmieniony!"; $_SESSION['message'] = "E-mail: email został zmieniony!";
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "E-mail: Coś poszło nie tak, spróbuj ponownie później.";
} }
mysqli_close($mysqli); mysqli_close($mysqli);
} }
else { else {
$_SESSION['message'] = "Błędne hasło!<br>"; $_SESSION['message'] = "E-mail: Błędne hasło!";
} }
} }
else{ else{
$_SESSION['message'] = "Potwierdź email ponownie<br>"; $_SESSION['message'] = "E-mail: Potwierdź email ponownie";
} }
} }
else{ else{
$_SESSION['message'] = "Nowy email nie może być taki sam jak obecny<br>"; $_SESSION['message'] = "E-mail: Nowy email nie może być taki sam jak obecny";
} }
} }
else{ else{
$_SESSION['message'] = "Należy wypełnić wszystkie wmagane pola<br>"; $_SESSION['message'] = "E-mail: Należy wypełnić wszystkie wmagane pola";
}
} }
}
if(isset($_POST['avatar_change'])){ if(isset($_POST['avatar_change'])){
$currentavatar = $row['avatar']; $currentavatar = $row['avatar'];
$avatar_path = $mysqli->real_escape_string('../images/avatars/'.$_FILES['avatar']['name']); $avatar_path = $mysqli->real_escape_string('../images/avatars/'.$_FILES['avatar']['name']);
if (preg_match("!image!", $_FILES['avatar']['type'])){ if (preg_match("!image!", $_FILES['avatar']['type'])){
@ -92,110 +92,110 @@ if(isset($_POST['avatar_change'])){
if($currentavatar != $avatar_path){ if($currentavatar != $avatar_path){
unlink($currentavatar); unlink($currentavatar);
} }
$_SESSION['message'] = "avatar został zmieniony!<br>"; $_SESSION['message'] = "Avatar: avatar został zmieniony!";
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Avatar: Coś poszło nie tak, spróbuj ponownie później.";
} }
mysqli_close($mysqli); mysqli_close($mysqli);
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Avatar: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Plik musi byc graficzny<br>"; $_SESSION['message'] = "Avatar: Plik musi byc graficzny";
}
} }
}
if(isset($_POST['aboutshort_change'])){ if(isset($_POST['aboutshort_change'])){
$newabout_short = $_POST['aboutshort']; $newabout_short = $_POST['aboutshort'];
if($about_short != $newabout_short){ if($about_short != $newabout_short){
$sql = "UPDATE user SET about_short='$newabout_short' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET about_short='$newabout_short' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "Zmiany zostały zatwierdzone!"; $_SESSION['message'] = "Krótko o mnie: Zmiany zostały zatwierdzone!";
$about_short = $row['about_short']; $about_short = $row['about_short'];
header('Location: account_settings.php'); header('Location: account_settings.php');
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Krótko o mnie: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Brak zmian<br>"; $_SESSION['message'] = "Krótko o mnie: Brak zmian";
}
} }
}
if(isset($_POST['aboutme_change'])){ if(isset($_POST['aboutme_change'])){
$newabout_me = $_POST['aboutme']; $newabout_me = $_POST['aboutme'];
if($about_me != $newabout_me){ if($about_me != $newabout_me){
$sql = "UPDATE user SET about_me='$newabout_me' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET about_me='$newabout_me' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "Zmiany zostały zatwierdzone!"; $_SESSION['message'] = "O mnie: Zmiany zostały zatwierdzone!";
$about_me = $row['about_me']; $about_me = $row['about_me'];
header('Location: account_settings.php'); header('Location: account_settings.php');
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "O mnie: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Brak zmian<br>"; $_SESSION['message'] = "O mnie: Brak zmian";
}
} }
}
if(isset($_POST['aboutblog_change'])){ if(isset($_POST['aboutblog_change'])){
$newabout_blog = $_POST['aboutblog']; $newabout_blog = $_POST['aboutblog'];
if($about_blog != $newabout_blog){ if($about_blog != $newabout_blog){
$sql = "UPDATE user SET about_blog='$newabout_blog' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET about_blog='$newabout_blog' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "Zmiany zostały zatwierdzone!"; $_SESSION['message'] = "Opis bloga: Zmiany zostały zatwierdzone!";
$about_blog = $row['about_blog']; $about_blog = $row['about_blog'];
header('Location: account_settings.php'); header('Location: account_settings.php');
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Opis bloga: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Brak zmian<br>"; $_SESSION['message'] = "Opis bloga: Brak zmian";
}
} }
}
if(isset($_POST['face_change'])){ if(isset($_POST['face_change'])){
if(!empty($_POST['FB'])) { if(!empty($_POST['FB'])) {
$face = $row['FB']; $face = $row['FB'];
$newface = $_POST['FB']; $newface = $_POST['FB'];
if($face != $newface) { if($face != $newface) {
$sql = "UPDATE user SET FB='$newface' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET FB='$newface' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "Zmiany zostały zatwierdzone!"; $_SESSION['message'] = "Social media: Zmiany zostały zatwierdzone!";
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Social media: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Brak zmian<br>"; $_SESSION['message'] = "Social media: Brak zmian";
} }
} }
} }
if(isset($_POST['twit_change'])){ if(isset($_POST['twit_change'])){
if(!empty($_POST['TW'])) { if(!empty($_POST['TW'])) {
$twit = $row['FB']; $twit = $row['FB'];
$newtwit = $_POST['TW']; $newtwit = $_POST['TW'];
if($twit != $newtwit) { if($twit != $newtwit) {
$sql = "UPDATE user SET TW='$newtwit' WHERE password='$password' AND username='$user'"; $sql = "UPDATE user SET TW='$newtwit' WHERE password='$password' AND username='$user'";
if($mysqli->query($sql) === true){ if($mysqli->query($sql) === true){
$_SESSION['message'] = "Zmiany zostały zatwierdzone!<br>"; $_SESSION['message'] = "Social media: Zmiany zostały zatwierdzone!";
} }
else{ else{
$_SESSION['message'] = "Coś poszło nie tak, spróbuj ponownie później.<br>"; $_SESSION['message'] = "Social media: Coś poszło nie tak, spróbuj ponownie później.";
} }
} }
else{ else{
$_SESSION['message'] = "Brak zmian<br>"; $_SESSION['message'] = "Social media: Brak zmian";
}
} }
} }
}
?> ?>

View File

@ -8,39 +8,51 @@ include "acc_settings.php";
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<!-- SEO FRIENDLY ZONE -->
<title>Ustawienia Konta CMS - Bloggero</title> <title>Ustawienia Konta CMS - Bloggero</title>
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- END OF SEO FRIENDLY ZONE -->
<!-- JS STYLE AND BS --> <!-- JS STYLE AND BS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <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> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<link rel="stylesheet" href="./css/style.css"> <link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="./css/style2.css"> <link rel="stylesheet" href="./css/style2.css">
<!-- BOOTSTRAP SCRIPT LOADER -->
<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>
<!-- END OF BOOTSTRAP SCRIPT LOADER -->
</head> </head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<?php include "sidebar.php"; ?> <?php include "sidebar.php"; ?>
<div id="content"> <div id="content" class="container-fluid">
<nav class="navbar navbar-default"> <nav class="navbar navbar-default">
<div class="container-fluid"> <div class="flex-row">
<div class="navbar-header"> <div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn"> <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i> <i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span> <span>Toggle Sidebar</span>
</button> </button>
<?php include "menu.php" ?>
<div id="aboutdown"></div>
</div> </div>
</div> </div>
</nav> </nav>
<div class="container-fluid"> <div class="flex-row">
<div class="info">
<span><?php echo $_SESSION['message']; ?></span>
</div>
<div class="flex-column">
<div class="tabs"> <div class="tabs">
<button class="tabbutton" onclick="openTab(event, 'passwordrow')">Hasło</button> <button id="open" class="tabbutton" onclick="openTab(event, 'passwordrow')">Hasło</button>
<button class="tabbutton" onclick="openTab(event, 'mailrow')">E-mail</button> <button class="tabbutton" onclick="openTab(event, 'mailrow')">E-mail</button>
<button class="tabbutton" onclick="openTab(event, 'avatarrow')">Avatar</button> <button class="tabbutton" onclick="openTab(event, 'avatarrow')">Avatar</button>
<button class="tabbutton" onclick="openTab(event, 'aboutshortrow')">Krótko o mnie</button> <button class="tabbutton" onclick="openTab(event, 'aboutshortrow')">Krótko o mnie</button>
@ -48,6 +60,8 @@ include "acc_settings.php";
<button class="tabbutton" onclick="openTab(event, 'aboutblogrow')">Opis bloga</button> <button class="tabbutton" onclick="openTab(event, 'aboutblogrow')">Opis bloga</button>
<button class="tabbutton" onclick="openTab(event, 'socialrow')">Social media</button> <button class="tabbutton" onclick="openTab(event, 'socialrow')">Social media</button>
</div> </div>
</div>
</div>
<div id="passwordrow" class="flex-row tabcontent"> <div id="passwordrow" class="flex-row tabcontent">
<div class="flex-column"> <div class="flex-column">
<form class="form" action="" method="POST"> <form class="form" action="" method="POST">
@ -64,7 +78,6 @@ include "acc_settings.php";
<input type="password" class="form-control" id="confirmpassword" name="confirmpassword" required /> <input type="password" class="form-control" id="confirmpassword" name="confirmpassword" required />
<label>Potwierdź Nowe Hasło</label> <label>Potwierdź Nowe Hasło</label>
</div> </div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zmień Hasło" name="password_change" /> <input type="submit" class="button" value="Zmień Hasło" name="password_change" />
</form> </form>
</div> </div>
@ -85,7 +98,6 @@ include "acc_settings.php";
<input type="email" class="form-control" id="confirmemail" name="confirmemail" required /> <input type="email" class="form-control" id="confirmemail" name="confirmemail" required />
<label>Potwierdź e-mail</label> <label>Potwierdź e-mail</label>
</div> </div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zmień email" name="email_change" /> <input type="submit" class="button" value="Zmień email" name="email_change" />
</form> </form>
</div> </div>
@ -96,7 +108,6 @@ include "acc_settings.php";
<p>Zmiana avatara</p> <p>Zmiana avatara</p>
<label>Wybierz nowy avatar: </label> <label>Wybierz nowy avatar: </label>
<input class="avatarchange" type="file" name="avatar" accept="image/*" required /> <input class="avatarchange" type="file" name="avatar" accept="image/*" required />
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zmień avatar" name="avatar_change"/> <input type="submit" class="button" value="Zmień avatar" name="avatar_change"/>
</form> </form>
</div> </div>
@ -106,7 +117,7 @@ include "acc_settings.php";
<form class="form" action="" method="POST"> <form class="form" action="" method="POST">
<p>Krótko o mnie</p> <p>Krótko o mnie</p>
<textarea name="aboutshort" rows="10" cols="80"><?php echo $about_short; ?></textarea><br> <textarea name="aboutshort" rows="10" cols="80"><?php echo $about_short; ?></textarea><br>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zatwierdź" name="aboutshort_change" /> <input type="submit" class="button" value="Zatwierdź" name="aboutshort_change" />
</form> </form>
</div> </div>
@ -116,8 +127,7 @@ include "acc_settings.php";
<form class="form" action="" method="POST"> <form class="form" action="" method="POST">
<p>O mnie</p> <p>O mnie</p>
<textarea name="aboutme" rows="10" cols="80"><?php echo $about_me; ?></textarea><br> <textarea name="aboutme" rows="10" cols="80"><?php echo $about_me; ?></textarea><br>
<span><?php echo $_SESSION['message']; ?></span> <input type="submit" class="button" value="Zatwierdź" name="aboutme_change" onClick="info()" />
<input type="submit" class="button" value="Zatwierdź" name="aboutme_change" />
</form> </form>
</div> </div>
</div> </div>
@ -126,7 +136,6 @@ include "acc_settings.php";
<form class="form" action="" method="POST"> <form class="form" action="" method="POST">
<p>Opis Bloga</p> <p>Opis Bloga</p>
<textarea name="aboutblog" maxlength="50" rows="10" cols="80"><?php echo $about_blog; ?></textarea><br> <textarea name="aboutblog" maxlength="50" rows="10" cols="80"><?php echo $about_blog; ?></textarea><br>
<span><?php echo $_SESSION['message']; ?></span><br>
<input type="submit" class="button" value="Zatwierdź" name="aboutblog_change" /> <input type="submit" class="button" value="Zatwierdź" name="aboutblog_change" />
</form> </form>
</div> </div>
@ -139,7 +148,6 @@ include "acc_settings.php";
<input type="text" class="form-control" id="FB" name="FB" required /> <input type="text" class="form-control" id="FB" name="FB" required />
<label>Facebook</label> <label>Facebook</label>
</div> </div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zatwierdź" name="face_change" /> <input type="submit" class="button" value="Zatwierdź" name="face_change" />
</form> </form>
<form class="form" action="" method="POST"> <form class="form" action="" method="POST">
@ -147,14 +155,12 @@ include "acc_settings.php";
<input type="text" class="form-control" id="TW" name="TW" required /> <input type="text" class="form-control" id="TW" name="TW" required />
<label>Twitter</label> <label>Twitter</label>
</div> </div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zatwierdź" name="twit_change" /> <input type="submit" class="button" value="Zatwierdź" name="twit_change" />
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- Bootstrap Js CDN --> <!-- Bootstrap Js CDN -->
@ -195,6 +201,7 @@ include "acc_settings.php";
document.getElementById(contentID).style.display = "block"; document.getElementById(contentID).style.display = "block";
event.currentTarget.className += " active"; event.currentTarget.className += " active";
} }
document.getElementById("open").click();
</script> </script>
</body> </body>
</html> </html>

View File

@ -10,6 +10,7 @@ else{
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<!-- SEO FRIENDLY ZONE --> <!-- SEO FRIENDLY ZONE -->
<title>Panel CMS</title> <title>Panel CMS</title>
@ -26,33 +27,44 @@ else{
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<!-- END OF CSS LOADER --> <!-- END OF CSS LOADER -->
</head>
<!-- BOOTSTRAP SCRIPT LOADER -->
<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>
<!-- END OF BOOTSTRAP SCRIPT LOADER -->
</head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<?php include "sidebar.php"; ?> <?php include "sidebar.php"; ?>
<div id="content"> <div id="content" class="container-fluid">
<nav class="navbar navbar-default"> <nav class="navbar navbar-default">
<div class="container-fluid"> <div class="flex-row">
<div class="navbar-header"> <div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn"> <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i> <i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span> <span>Toggle Sidebar</span>
</button> </button>
<?php include "menu.php" ?>
<div id="aboutdown"></div>
</div> </div>
</div> </div>
</nav> </nav>
<form method="post" action="insert.php"> <div class="flex-row">
<div class="flex-column">
<form class="form" method="post" action="insert.php">
<div class="addPostForm"> <div class="addPostForm">
<input type="text" name="title" size="120"> <p>Tytuł</p>
<input type="text" class="form-control" name="title" size="120">
<p>Meta opis</p> <p>Meta opis</p>
<input name="meta_desc" size="120"> <input type="text" class="form-control" name="meta_desc" size="120">
<p>Treść posta</p> <p>Treść posta</p>
<textarea name="post_text" id="editor1" rows="10" cols="80"></textarea> <textarea name="post_text" id="editor1" rows="10" cols="80"></textarea>
<input type="submit" class="btn btn-success" value="Dodaj post"> <input type="submit" class="btn btn-success" value="Dodaj post">
</div> </div>
</form> </form>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -1,4 +1,10 @@
.indexnavbar {
margin-bottom: 0;
border-radius: 0;
}
.navbar { .navbar {
margin-left: 20px;
margin-bottom: 0; margin-bottom: 0;
border-radius: 0; border-radius: 0;
} }
@ -132,4 +138,8 @@ a[aria-expanded="true"]::before {
} }
.addPostForm{ .addPostForm{
margin-left: 20px; margin-left: 20px;
margin-top: 20px;
}
.addPostForm input {
margin-bottom: 20px;
} }

View File

@ -25,6 +25,7 @@ a, a:hover, a:focus {
.navbar { .navbar {
padding: 15px 10px; padding: 15px 10px;
margin-left: 10px;
background: #fff; background: #fff;
border: none; border: none;
border-radius: 0; border-radius: 0;
@ -155,6 +156,23 @@ a.article, a.article:hover {
width: 100%; width: 100%;
} }
/* ---------------------------------------------------
ALTERNATIVE MENU STYLE
----------------------------------------------------- */
#menuwrap {
position: relative;
left: 0;
top: 0;
}
#aboutdown{
position: relative;
top: 30px;
}
.dropdown {
display: none;
}
/* --------------------------------------------------- /* ---------------------------------------------------
MEDIAQUERIES MEDIAQUERIES
@ -172,12 +190,17 @@ a.article, a.article:hover {
#content.active { #content.active {
width: calc(100% - 250px); width: calc(100% - 250px);
} }
#sidebarCollapse {
display: none;
}
#sidebarCollapse span { #sidebarCollapse span {
display: none; display: none;
} }
.dropdown {
display: block;
}
} }
/* --------------------------------------------------- /* ---------------------------------------------------
ACCOUNT SETTINGS ACCOUNT SETTINGS
----------------------------------------------------- */ ----------------------------------------------------- */
@ -186,6 +209,13 @@ a.article, a.article:hover {
background-color: #e8ebef; background-color: #e8ebef;
} }
.info {
text-align: center;
margin: 20px 20px;
font-size: 110%;
color: orangered;
}
.tabs button { .tabs button {
background-color: inherit; background-color: inherit;
float: left; float: left;
@ -255,7 +285,7 @@ a.article, a.article:hover {
transition: .5s; transition: .5s;
} }
.inputbox .form-control, .form-control:focus{ .inputbox .form-control,.inputbox .form-control:focus{
-webkit-box-shadow: none; -webkit-box-shadow: none;
box-shadow: none; box-shadow: none;
border-bottom: solid lightblue; border-bottom: solid lightblue;

View File

@ -10,6 +10,7 @@ else{
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<!-- SEO FRIENDLY ZONE --> <!-- SEO FRIENDLY ZONE -->
<title>Panel CMS</title> <title>Panel CMS</title>
@ -26,22 +27,32 @@ else{
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/style.css">
<!-- END OF CSS LOADER --> <!-- END OF CSS LOADER -->
<!-- BOOTSTRAP SCRIPT LOADER -->
<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>
<!-- END OF BOOTSTRAP SCRIPT LOADER -->
</head> </head>
<body> <body>
<div class="wrapper"> <div class="wrapper">
<?php include "sidebar.php"; ?> <?php include "sidebar.php"; ?>
<div id="content"> <div id="content" class="container-fluid">
<nav class="navbar navbar-default"> <nav class="navbar navbar-default">
<div class="container-fluid"> <div class="flex-row">
<div class="navbar-header"> <div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn"> <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i> <i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span> <span>Toggle Sidebar</span>
</button> </button>
<?php include "menu.php" ?>
<div id="aboutdown"></div>
</div> </div>
</div> </div>
</nav> </nav>
<form method="post" action="update_post.php"> <div class="flex-row">
<div class="flex-column">
<form class="form" method="post" action="update_post.php">
<div class="addPostForm"> <div class="addPostForm">
<?php <?php
include "../settings/db_connect.php"; include "../settings/db_connect.php";
@ -55,9 +66,9 @@ else{
if (!$sql->fetch()) die("Blad!!! Brak rekordu do edycji w bazie!!! Liczba rekodow:".$sql->num_rows); if (!$sql->fetch()) die("Blad!!! Brak rekordu do edycji w bazie!!! Liczba rekodow:".$sql->num_rows);
?> ?>
<p>Tytuł posta:</p> <p>Tytuł posta:</p>
<input type="text" name="title" size="120" value='<?php echo $title;?>'> <input type="text" class="form-control" name="title" size="120" value='<?php echo $title;?>'>
<p>Meta opis</p> <p>Meta opis</p>
<input name="meta_desc" size="120" value='<?php echo $meta_desc; ?>'> <input type="text" class="form-control" name="meta_desc" size="120" value='<?php echo $meta_desc; ?>'>
<p>Treść posta</p> <p>Treść posta</p>
<textarea name="post_text" id="editor1" rows="10" cols="80"><?php echo $text; ?></textarea> <textarea name="post_text" id="editor1" rows="10" cols="80"><?php echo $text; ?></textarea>
<input type="submit" class="btn btn-success" value="Edytuj Post"> <input type="submit" class="btn btn-success" value="Edytuj Post">
@ -67,8 +78,9 @@ else{
$mysqli->close(); $mysqli->close();
?> ?>
</div> </div>
</form> </form>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -1,18 +1,20 @@
<?php <?php
if( !isset( $_SESSION ) ) session_start(); if( !isset( $_SESSION ) ) session_start();
if(empty($_SESSION['user'])){ if(empty($_SESSION['user'])){
header('Location: ./login.php'); header('Location: ./login.php');
} }
?> ?>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Panel CMS</title>
<!-- SEO FRIENDLY ZONE -->
<title>Panel CMS - Bloggero</title>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="robots" content="noindex,nofollow" /> <meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- END OF SEO FRIENDLY ZONE -->
<!-- JS STYLE AND BS --> <!-- JS STYLE AND BS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
@ -20,34 +22,47 @@ if(empty($_SESSION['user'])){
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <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> <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="../css/style2.css">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css">
<!-- END OF JS STYLE AND BS -->
<!-- BOOTSTRAP SCRIPT LOADER -->
<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>
<!-- END OF BOOTSTRAP SCRIPT LOADER -->
</head> </head>
<body> <body>
<?php <?php
include "../settings/db_connect.php"; include "../settings/db_connect.php";
$user=$_SESSION['user']; $user=$_SESSION['user'];
$password=$_SESSION['password']; $password=$_SESSION['password'];
// Getting informations about user's account // Getting informations about user's account
$blogdata = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'"); $blogdata = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'");
$inforow = mysqli_fetch_array($blogdata); $inforow = mysqli_fetch_array($blogdata);
$user_blog_id = $inforow['user_id']; $user_blog_id = $inforow['user_id'];
$_SESSION['user_blog_id']=$user_blog_id; $_SESSION['user_blog_id']=$user_blog_id;
?> ?>
<div class="wrapper"> <div class="wrapper">
<?php include "sidebar.php"; ?> <?php include "sidebar.php"; ?>
<div id="content"> <div id="content" class="container-fluid">
<nav class="navbar navbar-default"> <nav class="navbar navbar-default">
<div class="container-fluid"> <div class="flex-row">
<div class="navbar-header"> <div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn"> <button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i> <i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span> <span>Toggle Sidebar</span>
</button> </button>
<?php //include "menu.php" ?>
<!-- <div id="aboutdown"></div> -->
</div> </div>
</div> </div>
</nav> </nav>
<div class="flex-row">
<div class="flex-column">
<table class="table table-striped" style="margin-left:10px;"> <table class="table table-striped" style="margin-left:10px;">
<thead>
<tr> <tr>
<th>ID Postu</th> <th>ID Postu</th>
<th>Tytuł</th> <th>Tytuł</th>
@ -55,12 +70,13 @@ $_SESSION['user_blog_id']=$user_blog_id;
<th>Data dodania</th> <th>Data dodania</th>
<th>Data modyfikacji</th> <th>Data modyfikacji</th>
</tr> </tr>
<?php </thead>
$trash = ''; <?php
$trash = '';
//SELECT * FROM post JOIN user ON post.blog_id=user.user_id WHERE user.username='$user' AND user.password='$password' ORDER BY data_dodania //SELECT * FROM post JOIN user ON post.blog_id=user.user_id WHERE user.username='$user' AND user.password='$password' ORDER BY data_dodania
if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_id FROM user WHERE username='$user' AND password='$password') ORDER BY data_dodania")) if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_id FROM user WHERE username='$user' AND password='$password') ORDER BY data_dodania"))
{ {
$sql->execute(); $sql->execute();
$sql->bind_result($post_id,$trash,$title,$description,$main,$img,$date,$mod_date); $sql->bind_result($post_id,$trash,$title,$description,$main,$img,$date,$mod_date);
while ($sql->fetch()) while ($sql->fetch())
@ -77,14 +93,16 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_i
} }
$sql->close(); $sql->close();
} }
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $password" ); else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $password" );
$mysqli->close(); $mysqli->close();
?> ?>
</table> </table>
</div>
</div>
<a href="add_post.php" style="margin-left:10px;" class="btn btn-success">Dodawanie nowego</a> <a href="add_post.php" style="margin-left:10px;" class="btn btn-success">Dodawanie nowego</a>
</div> </div>
</div> </div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- Bootstrap Js CDN --> <!-- Bootstrap Js CDN -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

15
admin-zone/menu.php Normal file
View File

@ -0,0 +1,15 @@
<div class="dropdown">
<div id="menuwrap">
<button class="btn btn-info navbar-btn dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Menu
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
<li><a href="index.php">Posty</a></li>
<li><a href="account_settings.php">Ustawienia Konta</a></li>
<li class="divider"></li>
<li><a href="../index.html">Strona główna</a></li>
<li><a href="../blog-post/blog.php?user_id=<?php echo $_SESSION['user_blog_id']; ?>">Przejdź do Bloga</a></li>
<li><a href="logout.php">Wyloguj</a> </li>
</div>
</div>
</div>

View File

@ -6,14 +6,14 @@
</div> </div>
<ul class="list-unstyled components"> <ul class="list-unstyled components">
<li><a href="index.php">Strona główna</a></li> <li><a href="../index.php">Strona główna</a></li>
<li class="active"><a target="zawartosc" name="dodajemy" href="index.php">Posty</a></li> <li class="active"><a name="dodajemy" href="index.php">Posty</a></li>
<li><a href="account_settings.php">Ustawienia Konta</a></li> <li><a href="account_settings.php">Ustawienia Konta</a></li>
</ul> </ul>
<div> <div>
<ul class="list-unstyled components"> <ul class="list-unstyled components">
<li><a href="../blog-post/blog.php?user_id=<?php echo $_SESSION['user_blog_id']; ?>" style="color:red;">Przejdź do Bloga</a></li> <li><a href="../blog-post/blog.php?user_id=<?php echo $_SESSION['user_blog_id']; ?>">Przejdź do Bloga</a></li>
<li><a href="logout.php">Wyloguj</a> </li> <li><a href="logout.php">Wyloguj</a> </li>
</ul> </ul>
</nav> </nav>

View File

@ -15,7 +15,7 @@ $mod_date=date("Y-m-d H:i:s");
$sql = $mysqli->prepare("UPDATE post SET tytul=?,opis=?,tekst=?,data_modyfikacji=? WHERE post_id=?;"); $sql = $mysqli->prepare("UPDATE post SET tytul=?,opis=?,tekst=?,data_modyfikacji=? WHERE post_id=?;");
if ($sql) if ($sql)
{ {
$sql->bind_param("isssi",$title,$meta_desc,$text,$mod_date,$post_id); $sql->bind_param("ssssi",$title,$meta_desc,$text,$mod_date,$post_id);
$sql->execute(); $sql->execute();
$sql->close(); $sql->close();
} }

View File

@ -94,6 +94,22 @@
font-size: 12px; font-size: 12px;
} }
.elementsOnLoginMain .toregister {
text-align: right;
}
.elementsOnLoginMain .toregister a:link {
color: black;
background-color: transparent;
text-decoration: none;
}
.elementsOnLoginMain .toregister a:visited {
color: black;
background-color: transparent;
text-decoration: none;
}
.loginFooter { .loginFooter {
width: 100%; width: 100%;
} }

View File

@ -95,6 +95,22 @@
font-size: 12px; font-size: 12px;
} }
.elementsOnRegisterMain .tologin {
text-align: right;
}
.elementsOnRegisterMain .tologin a:link {
color: black;
background-color: transparent;
text-decoration: none;
}
.elementsOnRegisterMain .tologin a:visited {
color: black;
background-color: transparent;
text-decoration: none;
}
.registerFooter { .registerFooter {
width: 100%; width: 100%;
} }

View File

@ -16,12 +16,6 @@
<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://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> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<style type="text/css">
* {margin: 0; padding: 0;}
.wrapper {width: 100%; height: 700px; background: red;}
/* ---- reset ---- */ body{ margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom; } /* ---- particles.js container ---- */ #particles-js{ position:absolute; width: 100%; height: 100%; background-color: #b61924; background-image: url(""); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; } /* ---- stats.js ---- */ .count-particles{ background: #000022; position: absolute; top: 48px; left: 0; width: 80px; color: #13E8E9; font-size: .8em; text-align: left; text-indent: 4px; line-height: 14px; padding-bottom: 2px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; } .js-count-particles{ font-size: 1.1em; } #stats, .count-particles{ -webkit-user-select: none; margin-top: 5px; margin-left: 5px; } #stats{ border-radius: 3px 3px 0 0; overflow: hidden; } .count-particles{ border-radius: 0 0 3px 3px; }
</style>
</head> </head>
<body> <body>
<div id="particles-js"></div> <div id="particles-js"></div>
@ -57,6 +51,9 @@
<label>Wybierz swój avatar: </label> <label>Wybierz swój avatar: </label>
<input type="file" name="avatar" accept="image/*" required /> <input type="file" name="avatar" accept="image/*" required />
</div> </div>
<div class="form-group tologin">
<a href="../admin-zone/login.php">Mam już konto</a>
</div>
</div> </div>
</div> </div>
<div class="row registerFooter"> <div class="row registerFooter">
@ -74,7 +71,8 @@
<script> <script>
particlesJS.load('particles-js', '../js/particles.json', function() { particlesJS.load('particles-js', '../js/particles.json', function() {
console.log('callback - particles.js config loaded'); }); console.log('callback - particles.js config loaded');
});
</script> </script>
</body> </body>