Exemple #1
0
 public function hasCurrentUserReviewed($product_id)
 {
     if (Auth::user() !== false) {
         return (bool) $this->sql("SELECT id FROM reviews WHERE product_id = ? AND user_id = ?", [$product_id, Auth::user()->id])->getAffectedRows();
     }
     return false;
 }
Exemple #2
0
 public function run()
 {
     $db = new SimpleDB();
     $list = $db->sql("SELECT * FROM ban_ip")->fetchAllAssoc();
     foreach ($list as $ip) {
         if ($_SERVER['REMOTE_ADDR'] == $ip['ip']) {
             throw new \Exception("Currently your IP is blocked by admin");
         }
     }
     CSRF::getInstance()->generate();
     Auth::doAuth();
     $this->_frontController = FrontController::getInstance();
     if ($this->router instanceof \SSFrame\Routers\iRouter) {
         $this->_frontController->setRouter($this->router);
     } else {
         $this->_frontController->setRouter(new Route());
     }
     $this->_frontController->parseRouter();
     CSRF::getInstance()->check();
 }
Exemple #3
0
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li>
                    <a href="<?php 
echo asset('/products');
?>
">Products</a>
                </li>
                <li>
                    <a href="<?php 
echo asset('/cart');
?>
">Cart</a>
                </li>
                <?php 
if (Auth::user() == false) {
    ?>
                    <li>
                        <a href="<?php 
    echo asset('/login');
    ?>
">Login</a>
                    </li>
                    <li>
                        <a href="<?php 
    echo asset('/register');
    ?>
">Register</a>
                    </li>
                <?php 
} else {
        <div class="modal-content">
            Are you sure you want to delete the category?

            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <a href="#" id="delete_button" class="btn btn-danger">Delete</a>
        </div>

    </div>
</div>
<?php 
}
?>
 

<?php 
if (Auth::user()->role < 3 && Auth::user()) {
    ?>
<script type="text/javascript">
    $('#cat_edit').on('show.bs.modal', function (event) {
        var button = $(event.relatedTarget);
        var id = button.data('id');
        var title = button.data('title');
        var description = button.data('description');

        var modal = $(this);
        modal.find('#input-title').val(title);
        modal.find('#input-description').val(description);
        modal.find('form').attr('action', '<?php 
    echo asset('/category');
    ?>
/' + id);
Exemple #5
0
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">My Shop Admin</a>
        </div>
        <!-- Top Menu Items -->
        <ul class="nav navbar-right top-nav">
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <?php 
echo Auth::user()->email;
?>
 <b class="caret"></b></a>
                <ul class="dropdown-menu">
                    <li>
                        <a href="/"><i class="fa fa-arrow-circle-o-left"></i> Back</a>
                    </li>
                </ul>
            </li>
        </ul>
        <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav side-nav">
                <li>
                    <a href="<?php 
echo asset('/admin/users');
Exemple #6
0
 public function create($email, $password, $names)
 {
     $password = Hash::make($password);
     $last_id = $this->sql("INSERT INTO users (email, password, names) VALUES (?, ?, ?)", [$email, $password, $names])->getLastInsertId();
     Auth::byId($last_id);
 }
echo Form::csrf();
?>
    <div class="form-group">
        <?php 
echo Form::label('names', 'Names');
?>
        <?php 
echo Form::text('names', $input['names'] ?: Auth::user()->names, ['class' => 'form-control']);
?>
    </div>
    <div class="form-group">
        <?php 
echo Form::label('email', 'Email');
?>
        <?php 
echo Form::email('email', $input['email'] ?: Auth::user()->email, ['class' => 'form-control']);
?>
    </div>
    <div class="form-group">
        <?php 
echo Form::label('mobile', 'Mobile');
?>
        <?php 
echo Form::text('mobile', $input['mobile'] ?: null, ['class' => 'form-control']);
?>
    </div>
    <div class="form-group">
        <?php 
echo Form::label('address', 'Address');
?>
        <?php 
Exemple #8
0
 public function checkout($names, $email, $mobile, $address)
 {
     return $this->sql("INSERT INTO checkouts (user_id, email, `names`, mobile, address) VALUES (?,?,?,?,?)", [Auth::user()->id, $email, $names, $mobile, $address])->getLastInsertId();
 }