Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
lock page plugin v2

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
Aliresalat
Smarty Rookie


Joined: 09 Feb 2014
Posts: 23
Location: Iran

PostPosted: Fri Jul 25, 2014 3:56 am    Post subject: lock page plugin v2 Reply with quote

A plug-in application for blocking a page of your site
I remember like it, especially admin
-----------------------------------------------
File name : modifier.lock.php

Code:


<?php

/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * modifier.lock v2
 * File name: modifier.lock.php
 * Name:     lock page
 * Date:     2014.07.25
 *
 * Examples:
 
   <center>
<div class="inputfield">
This page has been blocked {$image.username}
</div>
{$user|lock}
   </center>

 *
 * @author : Ali Resalat (300) <info.Aliresalat@Gmail.com>
 * @web site : www.Aliresalat.ir
 * @Yahoo ID : Mitooo.Mitooo
 */

function smarty_modifier_lock($Fild='')
{

class aliresalatProtector{
var $password = 'your password';
function showLoginForm(){
   
echo "
<html lang='fa' dir='rtl'>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
<style type='text/css'>
.inputfield {border-style:solid;font-family:byekan,b yekan;font-size:18px;text-align:right;-moz-transition:all 0.5s;-webkit-transition:all 0.5s;transition:all 0.5s;}
.inputfield:hover {-moz-box-shadow: 0px 0px 13px #f4ff19;-webkit-box-shadow: 0px 0px 13px #f4ff19;box-shadow: 0px 0px 13px #f4ff19;-moz-transition: all 0.5s;-webkit-transition: all 0.5s ;transition: all 0.5s;}
.inputfield:focus {background-color:#e8e9ed;border-color:#3b5ad4;-moz-box-shadow: 0px 0px 28px #4772ff;-webkit-box-shadow: 0px 0px 28px #4772ff;box-shadow: 0px 0px 28px #4772ff;-moz-transition: all 0.5s;-webkit-transition: all 0.5s ;transition: all 0.5s;}element {box-shadow: 0px 0px 3px 0px rgb(204, 0, 0);}
.sharing img:hover{
-webkit-transform:scale(1.2);
-moz-transform:scale(1.2);
-o-transform:scale(1.2);
box-shadow:0px 0px 3px gray;
-webkit-box-shadow:0px 0px 30px gray;
-moz-box-shadow:0px 0px 30px gray;
opacity: 1;
}
</style>
</html>";   
    }

function login(){
      $loggedin = isset($_SESSION['loggedin']) ? $_SESSION['loggedin'] : false;
        if ( (!isset($_POST['submitBtn'])) && (!($loggedin))){
            $_SESSION['loggedin'] = false;
            $this->showLoginForm();
            exit();
        } else if (isset($_POST['submitBtn'])) {
            $pass = isset($_POST['passwd']) ? $_POST['passwd'] : '';
     
            if ($pass != $this->password) {
               $_SESSION['loggedin'] = false;
               $this->showLoginForm();
               exit();     
            } else {
               $_SESSION['loggedin'] = true;
            }
        }

    }
}

// Auto create
$protector = new aliresalatProtector();
$protector->login();

}

/* vim: set expandtab: */

?>




Examples 1 : {$user|lock}

Output : ------------------------


Examples 2 :

{if $user.lockimages}

<center>
<div class="inputfield">
This page has been blocked {$image.username}
</div>
</center>

{$user|lock}
{/if}


Output : This page has been blocked admin or User name of your website


Why not Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP