Commit 1d44e697 authored by Corentin Bettiol's avatar Corentin Bettiol 💻
Browse files

admin part

parent 12500846
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ l3m_projects
	name
	name
	link
	link
	content
	content
	shortContent


l3m_blog
l3m_blog
	id
	id
+4 −2
Original line number Original line Diff line number Diff line
@@ -7,6 +7,7 @@
  bottom: 0;
  bottom: 0;
  left: 0;
  left: 0;
  opacity: 0.4;
  opacity: 0.4;
  z-index: -1;
}
}
#videoFond > video {
#videoFond > video {
  width: 100%;
  width: 100%;
@@ -37,6 +38,7 @@
  }
  }
}
}


header, #menu{
#header, article, #footer{
  z-index: 2;
  background-color: rgba(240,240,240,0.4) !important;
  opacity: 0.9 !important;
}
}
 No newline at end of file
+50 −3
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ CSS
	border-bottom: 5px solid #ccc;
	border-bottom: 5px solid #ccc;
}
}


article p, #pageTitle, article h3, article ul, article form{
article p, #pageTitle, article h3, article ul, article form, #listAdmin{
	max-width: 1500px;
	max-width: 1500px;
	margin: 30px auto;
	margin: 30px auto;
}
}
@@ -66,13 +66,13 @@ h2{
h3 a{
h3 a{
	text-decoration: none;
	text-decoration: none;
	text-shadow: 0 0 1px #69f;
	text-shadow: 0 0 1px #69f;
	transition: padding-left 0.3s, text-shadow 0.3s;
	transition: padding-left 0.3s, text-shadow 0.3s, color 0.3s;
}
}


h3 a:hover{
h3 a:hover{
	padding-left: 5px;
	padding-left: 5px;
	text-shadow: -5px 0 4px #BBf;
	text-shadow: -5px 0 4px #BBf;
	transition: padding-left 0.3s, text-shadow 0.3s;
	transition: padding-left 0.3s, text-shadow 0.3s, color 0.3s;
}
}


#listMenu{
#listMenu{
@@ -173,6 +173,53 @@ input[type="submit"]:hover{
	transition: background-color 0.3s;
	transition: background-color 0.3s;
}
}


#listAdmin{
	display: flex;
	flex-wrap: wrap;
}

#listAdmin article{
	flex: 45%;
}

#listAdmin h3{
	margin: auto;
	text-align: center;
}

#listAdmin article:first-child{
	border-right: 5px solid #ccc;
}

.listAdmin{
	display: flex;
	align-items: center;
	justify-content: space-evenly;
}

.listAdmin b{
	display: inline-block;
	width: 50%;
	border-right: 1px solid #ccc;
}

.listAdmin span{
	padding: 3px;
}

.editLink{
	background-color: #d9d9d9;
	padding: 7px 7px 10px 7px;
	border-bottom: 0px solid #ccc;
	transition: background-color 0.3s, color 0.3s, border 0.05s, padding 0.05s;
}

.editLink:hover{
	background-color: #f0f0f0;
	padding: 7px;
	border-bottom: 3px solid #ccc;
	transition: background-color 0.3s, color 0.3s, border 0.0.5s, padding 0.05s;
}


/*
/*
====
====
+9 −9
Original line number Original line Diff line number Diff line
@@ -2,6 +2,7 @@


require_once("site/model/config.php");
require_once("site/model/config.php");
require_once("site/model/Base.php");
require_once("site/model/Base.php");
require_once("site/model/AdminManager.php");
require_once("site/model/BlogManager.php");
require_once("site/model/BlogManager.php");
require_once("site/model/ProjectsManager.php");
require_once("site/model/ProjectsManager.php");


@@ -96,21 +97,20 @@ function loginAdminPage($pageName){




function writeAdminPage($pageName){
function writeAdminPage($pageName){
	if(verifyAdminConnect())
	$admin = new AdminManager();
		require("site/view/private/admin.php");
	if($admin->verifyAdminConnect()){
	else{
		require("site/view/private/loginFormView.php");
	}
		
		
}
		$blogposts = $admin->getBlogPosts();
		$projects = $admin->getProjects();


function verifyAdminConnect(){
		require("site/view/private/admin.php");
	return isset($_SESSION['user']) && $_SESSION['user'] == user && isset($_SESSION['pass']) && password_verify($_SESSION['pass'], pass);
	}
	else
		require("site/view/private/loginFormView.php");
}
}


function decoAdminPage(){
function decoAdminPage(){
	$_SESSION = array();
	$_SESSION = array();
	
	header("Location:/");
	header("Location:/");
}
}


+23 −0
Original line number Original line Diff line number Diff line
<?php
class AdminManager extends Base
{
	public function getBlogPosts()
	{
		$db = $this->dbConnect();
		$req = $db->query('SELECT * FROM l3m_blog ORDER BY id DESC');
		return $req;
	}

	public function getProjects()
	{
		$db = $this->dbConnect();
		$req = $db->query('SELECT * FROM l3m_projects ORDER BY id DESC');
		return $req;
	}


	public function verifyAdminConnect(){
		return isset($_SESSION['user']) && $_SESSION['user'] == user && isset($_SESSION['pass']) && password_verify($_SESSION['pass'], pass);
	}

}
 No newline at end of file
Loading