Issue #15
En arrivant: 1- si logged -> page admin directement 2- si pas logged -> page publique directement ajout d'un lien Admin en footer
This commit is contained in:
parent
ec715b7611
commit
5bf4b34a01
4 changed files with 16 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @author bronco@warriordudimanche.com / www.warriordudimanche.net
|
* @author bronco@warriordudimanche.com / www.warriordudimanche.net
|
||||||
* @copyright open source and free to adapt (keep me aware !)
|
* @copyright open source and free to adapt (keep me aware !)
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
$auto_restrict['encryption_key']='abcdef';// clé pour le cryptage de la chaine de vérification
|
$auto_restrict['encryption_key']='abcdef';// clé pour le cryptage de la chaine de vérification
|
||||||
$auto_restrict['session_expiration_delay']=120;//minutes
|
$auto_restrict['session_expiration_delay']=120;//minutes
|
||||||
//$auto_restrict['login']='bronco'; // caractères alphanum + _ et .
|
//$auto_restrict['login']='bronco'; // caractères alphanum + _ et .
|
||||||
$auto_restrict['redirect_error']='index.php';// si précisé, pas de message d'erreur
|
$auto_restrict['redirect_error']='index.php?public';// si précisé, pas de message d'erreur
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
|
@ -52,6 +52,7 @@
|
||||||
if (isset($_POST['login'])&&isset($_POST['pass'])){
|
if (isset($_POST['login'])&&isset($_POST['pass'])){
|
||||||
log_user($_POST['login'],$_POST['pass']);
|
log_user($_POST['login'],$_POST['pass']);
|
||||||
if (isset($_POST['cookie'])){setcookie($auto_restrict['cookie_name'],sha1($_SERVER['HTTP_USER_AGENT']),time()+31104000);}//un an
|
if (isset($_POST['cookie'])){setcookie($auto_restrict['cookie_name'],sha1($_SERVER['HTTP_USER_AGENT']),time()+31104000);}//un an
|
||||||
|
header('location: index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
@ -59,13 +60,14 @@
|
||||||
// et la duree d'inactivité de la session
|
// et la duree d'inactivité de la session
|
||||||
// si probleme,on include un form de login.
|
// si probleme,on include un form de login.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
if (!is_ok()){session_destroy();include('login_form.php');exit();}
|
if (!is_ok()){session_destroy();header('location: index.php?public');exit();}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// demande de deco via la variable get 'deconnexion'
|
// demande de deco via la variable get 'deconnexion'
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
if (isset($_GET['deconnexion'])){log_user($_POST['login'],$_POST['pass']);}
|
if (isset($_GET['deconnexion'])){log_user($_POST['login'],$_POST['pass']);}
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
//header('location: index.php?public');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,14 @@ aside iframe{height:100%;border:none;}
|
||||||
aside ul{padding:0;}
|
aside ul{padding:0;}
|
||||||
aside li{margin:5px;list-style:none;vertical-align:middle;border-radius:3px;}
|
aside li{margin:5px;list-style:none;vertical-align:middle;border-radius:3px;}
|
||||||
aside li .tag{font-size:10px;display:inline-block;padding:2px;border-radius:3px;}
|
aside li .tag{font-size:10px;display:inline-block;padding:2px;border-radius:3px;}
|
||||||
nav .tag_public, aside .public li .tag{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(100,255,100,0.4);color:green;}
|
nav .tag_public{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(100,255,100,0.4);color:green;text-shadow:0 1px 1px darkgreen;}
|
||||||
nav .tag_public:hover, aside .public li .tag:hover{background:green;}
|
aside .public li .tag{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(100,255,100,0.4);color:green;}
|
||||||
nav .tag_private, aside .private li .tag{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(255,100,100,0.4);color:pink;text-shadow:0 1px 1px darkred;}
|
nav .tag_public:hover{background:green;}
|
||||||
nav .tag_private:hover, aside .private li .tag:hover{background:red;}
|
aside .public li .tag:hover{background:rgba(0,255,0,0.4);}
|
||||||
|
nav .tag_private{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(255,100,100,0.4);color:pink;text-shadow:0 1px 1px darkred;}
|
||||||
|
aside .private li .tag{display:inline-block;border-radius:3px;padding:2px;margin:1px;background:rgba(255,100,100,0.4);color:darkred;}
|
||||||
|
aside .private li .tag:hover{background:rgba(255,0,0,0.5);}
|
||||||
|
nav .tag_private:hover{background:red;}
|
||||||
.tag_cloud{padding:2px;}
|
.tag_cloud{padding:2px;}
|
||||||
nav .tag_public{color:lightgreen;}
|
nav .tag_public{color:lightgreen;}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,6 @@ function deltags($tags,$path,$id=false,$status=false){
|
||||||
if (is_string($tags)){$tags=explode(' ',$tags);}
|
if (is_string($tags)){$tags=explode(' ',$tags);}
|
||||||
if (!$status){$status=statuspath($path);}
|
if (!$status){$status=statuspath($path);}
|
||||||
if (!$id){$id=idfrompath($path);}
|
if (!$id){$id=idfrompath($path);}
|
||||||
|
|
||||||
foreach($tags as $tag){
|
foreach($tags as $tag){
|
||||||
if (isset($GLOBAL['tag_array'][$status][$id])){
|
if (isset($GLOBAL['tag_array'][$status][$id])){
|
||||||
$GLOBAL['tag_array'][$status][$id]=trim(str_replace(' '.$tag.' ','',' '.$GLOBAL['tag_array'][$status][$id].' '));
|
$GLOBAL['tag_array'][$status][$id]=trim(str_replace(' '.$tag.' ','',' '.$GLOBAL['tag_array'][$status][$id].' '));
|
||||||
|
@ -92,7 +91,6 @@ function settags($tags,$path,$id=false,$status=false){
|
||||||
$GLOBAL['tag_array'][$status][$id]=trim($tags);
|
$GLOBAL['tag_array'][$status][$id]=trim($tags);
|
||||||
store($GLOBAL['data_folder'].'/tags.txt',$GLOBAL['tag_array']);
|
store($GLOBAL['data_folder'].'/tags.txt',$GLOBAL['tag_array']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function link2favicon($dir){
|
function link2favicon($dir){
|
||||||
if (!is_dir($dir)){return '<link rel="shortcut icon" type="/image/png" href="design/favicon2.png">';}
|
if (!is_dir($dir)){return '<link rel="shortcut icon" type="/image/png" href="design/favicon2.png">';}
|
||||||
$favs=glob($dir.'/*favicon*');
|
$favs=glob($dir.'/*favicon*');
|
||||||
|
@ -174,7 +172,6 @@ function tagcloud(){
|
||||||
$tags=explode(' ',trim($tag));
|
$tags=explode(' ',trim($tag));
|
||||||
foreach ($tags as $t){
|
foreach ($tags as $t){
|
||||||
if (!isset($array['public'][$t]['nb'])){$array['public'][$t]['nb']=1;}else{$array['public'][$t]['nb']++;}
|
if (!isset($array['public'][$t]['nb'])){$array['public'][$t]['nb']=1;}else{$array['public'][$t]['nb']++;}
|
||||||
//if (!isset($array[$t]['status'])){$array[$t]['status']='public';}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="form_content">
|
<div class="form_content">
|
||||||
<form action='' method='post' name='' >
|
<form action='auto_restrict.php' method='post' name='' >
|
||||||
<p class="logo"> </p>
|
<p class="logo"> </p>
|
||||||
<?php if(file_exists('pass.php')){echo '<h1>Identifiez-vous</h1>';}else{echo '<h1>Creez votre passe</h1>';} ?>
|
<?php if(file_exists('pass.php')){echo '<h1>Identifiez-vous</h1>';}else{echo '<h1>Creez votre passe</h1>';} ?>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -38,5 +38,5 @@
|
||||||
<hr/>
|
<hr/>
|
||||||
<input type='submit' value='Connexion'/>
|
<input type='submit' value='Connexion'/>
|
||||||
</form>
|
</form>
|
||||||
<a class="public" href="<?php echo $_SERVER['PHP_SELF'].'?public';?>" alt="link to public">> Page publique <</a>
|
<a class="public" href="index.php?public" alt="link to public">> Page publique <</a>
|
||||||
</div>
|
</div>
|
Reference in a new issue