Fixing commit

This commit is contained in:
Patryk 2018-12-17 11:57:43 +01:00
commit bacba93d39
12 changed files with 600 additions and 383 deletions

View File

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

View File

@ -7,154 +7,160 @@ include "acc_settings.php";
?>
<html>
<head>
<meta charset="utf-8">
<title>Ustawienia Konta CMS - Bloggero</title>
<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">
<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="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/style2.css">
<meta charset="utf-8">
<link rel="Shortcut icon" href="../blog-post/img/name-label.png"/>
<!-- SEO FRIENDLY ZONE -->
<title>Ustawienia Konta CMS - Bloggero</title>
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- END OF SEO FRIENDLY ZONE -->
<!-- JS STYLE AND BS -->
<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://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="./css/style.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>
<body>
<div class="wrapper">
<?php include "sidebar.php"; ?>
<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>
<div class="container-fluid">
<div class="tabs">
<button 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, 'avatarrow')">Avatar</button>
<button class="tabbutton" onclick="openTab(event, 'aboutshortrow')">Krótko o mnie</button>
<button class="tabbutton" onclick="openTab(event, 'aboutmerow')">O mnie</button>
<button class="tabbutton" onclick="openTab(event, 'aboutblogrow')">Opis bloga</button>
<button class="tabbutton" onclick="openTab(event, 'socialrow')">Social media</button>
</div>
<div id="passwordrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Zmiana hasła</p>
<div class="inputbox">
<input type="password" class="form-control" id="password" name="password" required />
<label>Hasło</label>
</div>
<div class="inputbox">
<input type="password" class="form-control" id="newpassword" name="newpassword" required />
<label>Nowe Hasło</label>
</div>
<div class="inputbox">
<input type="password" class="form-control" id="confirmpassword" name="confirmpassword" required />
<label>Potwierdź Nowe Hasło</label>
</div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zmień Hasło" name="password_change" />
</form>
<div id="content" class="container-fluid">
<nav class="navbar navbar-default">
<div class="flex-row">
<div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span>
</button>
<?php include "menu.php" ?>
<div id="aboutdown"></div>
</div>
</div>
<div id="mailrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Zmiana adresu e-mail</p>
<div class="inputbox">
<input type="password" class="form-control" id="password" name="password" required />
<label>Hasło</label>
</div>
<div class="inputbox">
<input type="email" class="form-control" id="newemail" name="newemail" required />
<label>E-mail</label>
</div>
<div class="inputbox">
<input type="email" class="form-control" id="confirmemail" name="confirmemail" required />
<label>Potwierdź e-mail</label>
</div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zmień email" name="email_change" />
</form>
</div>
</nav>
<div class="flex-row">
<div class="info">
<span><?php echo $_SESSION['message']; ?></span>
</div>
<div id="avatarrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST" enctype="multipart/form-data">
<p>Zmiana avatara</p>
<label>Wybierz nowy avatar: </label>
<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"/>
</form>
</div>
</div>
<div id="aboutshortrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Krótko o mnie</p>
<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" />
</form>
</div>
</div>
<div id="aboutmerow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>O mnie</p>
<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" />
</form>
</div>
</div>
<div id="aboutblogrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Opis Bloga</p>
<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" />
</form>
</div>
</div>
<div id="socialrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Social Media</p>
<div class="inputbox">
<input type="text" class="form-control" id="FB" name="FB" required />
<label>Facebook</label>
</div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zatwierdź" name="face_change" />
</form>
<form class="form" action="" method="POST">
<div class="inputbox">
<input type="text" class="form-control" id="TW" name="TW" required />
<label>Twitter</label>
</div>
<span><?php echo $_SESSION['message']; ?></span>
<input type="submit" class="button" value="Zatwierdź" name="twit_change" />
</form>
<div class="flex-column">
<div class="tabs">
<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, 'avatarrow')">Avatar</button>
<button class="tabbutton" onclick="openTab(event, 'aboutshortrow')">Krótko o mnie</button>
<button class="tabbutton" onclick="openTab(event, 'aboutmerow')">O mnie</button>
<button class="tabbutton" onclick="openTab(event, 'aboutblogrow')">Opis bloga</button>
<button class="tabbutton" onclick="openTab(event, 'socialrow')">Social media</button>
</div>
</div>
</div>
<div id="passwordrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Zmiana hasła</p>
<div class="inputbox">
<input type="password" class="form-control" id="password" name="password" required />
<label>Hasło</label>
</div>
<div class="inputbox">
<input type="password" class="form-control" id="newpassword" name="newpassword" required />
<label>Nowe Hasło</label>
</div>
<div class="inputbox">
<input type="password" class="form-control" id="confirmpassword" name="confirmpassword" required />
<label>Potwierdź Nowe Hasło</label>
</div>
<input type="submit" class="button" value="Zmień Hasło" name="password_change" />
</form>
</div>
</div>
<div id="mailrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Zmiana adresu e-mail</p>
<div class="inputbox">
<input type="password" class="form-control" id="password" name="password" required />
<label>Hasło</label>
</div>
<div class="inputbox">
<input type="email" class="form-control" id="newemail" name="newemail" required />
<label>E-mail</label>
</div>
<div class="inputbox">
<input type="email" class="form-control" id="confirmemail" name="confirmemail" required />
<label>Potwierdź e-mail</label>
</div>
<input type="submit" class="button" value="Zmień email" name="email_change" />
</form>
</div>
</div>
<div id="avatarrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST" enctype="multipart/form-data">
<p>Zmiana avatara</p>
<label>Wybierz nowy avatar: </label>
<input class="avatarchange" type="file" name="avatar" accept="image/*" required />
<input type="submit" class="button" value="Zmień avatar" name="avatar_change"/>
</form>
</div>
</div>
<div id="aboutshortrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Krótko o mnie</p>
<textarea name="aboutshort" rows="10" cols="80"><?php echo $about_short; ?></textarea><br>
<input type="submit" class="button" value="Zatwierdź" name="aboutshort_change" />
</form>
</div>
</div>
<div id="aboutmerow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>O mnie</p>
<textarea name="aboutme" rows="10" cols="80"><?php echo $about_me; ?></textarea><br>
<input type="submit" class="button" value="Zatwierdź" name="aboutme_change" onClick="info()" />
</form>
</div>
</div>
<div id="aboutblogrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Opis Bloga</p>
<textarea name="aboutblog" maxlength="50" rows="10" cols="80"><?php echo $about_blog; ?></textarea><br>
<input type="submit" class="button" value="Zatwierdź" name="aboutblog_change" />
</form>
</div>
</div>
<div id="socialrow" class="flex-row tabcontent">
<div class="flex-column">
<form class="form" action="" method="POST">
<p>Social Media</p>
<div class="inputbox">
<input type="text" class="form-control" id="FB" name="FB" required />
<label>Facebook</label>
</div>
<input type="submit" class="button" value="Zatwierdź" name="face_change" />
</form>
<form class="form" action="" method="POST">
<div class="inputbox">
<input type="text" class="form-control" id="TW" name="TW" required />
<label>Twitter</label>
</div>
<input type="submit" class="button" value="Zatwierdź" name="twit_change" />
</form>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- Bootstrap Js CDN -->
@ -195,6 +201,7 @@ include "acc_settings.php";
document.getElementById(contentID).style.display = "block";
event.currentTarget.className += " active";
}
document.getElementById("open").click();
</script>
</body>
</html>

View File

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

View File

@ -1,7 +1,13 @@
.navbar {
.indexnavbar {
margin-bottom: 0;
border-radius: 0;
}
.navbar {
margin-left: 20px;
margin-bottom: 0;
border-radius: 0;
}
/* Add a gray background color and some padding to the footer */
footer {
@ -132,4 +138,8 @@ a[aria-expanded="true"]::before {
}
.addPostForm{
margin-left: 20px;
margin-top: 20px;
}
.addPostForm input {
margin-bottom: 20px;
}

View File

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

View File

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

View File

@ -1,19 +1,22 @@
<?php
if( !isset( $_SESSION ) ) session_start();
if(empty($_SESSION['user'])){
header('Location: ./login.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">
<head>
<meta charset="utf-8">
<!-- SEO FRIENDLY ZONE -->
<title>Panel CMS - Bloggero</title>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- END OF SEO FRIENDLY ZONE -->
<<<<<<< HEAD
<!-- 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">
@ -80,14 +83,96 @@ if ($sql = $mysqli->prepare("SELECT * FROM post WHERE blog_id IN (SELECT user_i
$sql->close();
}
else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $password" );
=======
<!-- 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="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">
<!-- END OF JS STYLE AND BS -->
$mysqli->close();
?>
</table>
<a href="add_post.php" style="margin-left:10px;" class="btn btn-success">Dodawanie nowego</a>
</div>
</div>
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<!-- 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 -->
>>>>>>> 4f6ead08b2af1624982230710450d3bc3d9daf92
</head>
<body>
<?php
include "../settings/db_connect.php";
$user=$_SESSION['user'];
$password=$_SESSION['password'];
// Getting informations about user's account
$blogdata = mysqli_query($mysqli, "SELECT * FROM user WHERE password='$password' AND username='$user'");
$inforow = mysqli_fetch_array($blogdata);
$user_blog_id = $inforow['user_id'];
$_SESSION['user_blog_id']=$user_blog_id;
?>
<div class="wrapper">
<?php include "sidebar.php"; ?>
<div id="content" class="container-fluid">
<nav class="navbar navbar-default">
<div class="flex-row">
<div class="navbar-header flex-column">
<button type="button" id="sidebarCollapse" class="btn btn-info navbar-btn">
<i class="glyphicon glyphicon-align-left"></i>
<span>Toggle Sidebar</span>
</button>
<?php //include "menu.php" ?>
<!-- <div id="aboutdown"></div> -->
</div>
</div>
</nav>
<div class="flex-row">
<div class="flex-column">
<table class="table table-striped" style="margin-left:10px;">
<thead>
<tr>
<th>ID Postu</th>
<th>Tytuł</th>
<th>Meta Description</th>
<th>Data dodania</th>
<th>Data modyfikacji</th>
</tr>
</thead>
<?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
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->bind_result($post_id,$trash,$title,$description,$main,$img,$date,$mod_date);
while ($sql->fetch())
{
echo "<tr>
<td>$post_id</td>
<td>$title</td>
<td>$description</td>
<td>$date</td>
<td>$mod_date</td>
<td><a href=\"edit.php?post_id=$post_id\" class=\"btn btn-info\">Edytuj</a></td>
<td><a href=\"delete_post.php?post_id=$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. $user $password" );
$mysqli->close();
?>
</table>
</div>
</div>
<a href="add_post.php" style="margin-left:10px;" 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 -->
@ -107,8 +192,8 @@ else die( "Błąd w zapytaniu SQL! Sprawdź kod SQL w PhpMyAdmin. $user $passwor
$('#dodajemy').click(function(){
$("#zawartosc").load('index.php');
});
});
});
</script>
</body>
</body>
</html>

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>
<ul class="list-unstyled components">
<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><a href="../index.php">Strona główna</a></li>
<li class="active"><a name="dodajemy" href="index.php">Posty</a></li>
<li><a href="account_settings.php">Ustawienia Konta</a></li>
</ul>
<div>
<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="logout.php">Wyloguj</a> </li>
<ul class="list-unstyled components">
<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>
</ul>
</nav>

View File

@ -94,6 +94,22 @@
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 {
width: 100%;
}

View File

@ -95,6 +95,22 @@
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 {
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://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>
<body>
<div id="particles-js"></div>
@ -57,6 +51,9 @@
<label>Wybierz swój avatar: </label>
<input type="file" name="avatar" accept="image/*" required />
</div>
<div class="form-group tologin">
<a href="../admin-zone/login.php">Mam już konto</a>
</div>
</div>
</div>
<div class="row registerFooter">
@ -74,7 +71,8 @@
<script>
particlesJS.load('particles-js', '../js/particles.json', function() {
console.log('callback - particles.js config loaded'); });
console.log('callback - particles.js config loaded');
});
</script>
</body>