コード例 #1
0
ファイル: user.php プロジェクト: avbdr/tinymvc-php
 public static function login($email, $password)
 {
     $user = user::where('email', $email)->where('password', sha1(TinyMvc::app()->config['salt'] . $password))->getOne();
     if (!$user) {
         return false;
     }
     $user->lastlogindate = date("Y-m-d H:i:s");
     $user->lastloginip = $_SERVER['REMOTE_ADDR'];
     $user->save();
     return $user;
 }
コード例 #2
0
ファイル: index.php プロジェクト: avbdr/tinymvc-php
<?php

require_once "libs/TinyMvc.php";
error_reporting(E_ALL | E_STRICT);
$config = array('defaultController' => 'root', 'defaultAction' => 'index', 'db' => array('host' => 'localhost', 'username' => 'root', 'password' => '', 'db' => 'testdb', 'prefix' => 't_'), 'routes' => array('^/signup.*' => "users/edit/"), 'salt' => 'test');
function action_root_index($arg = null, $arg2 = null)
{
    $c = new Controller();
    return new View("index");
}
function action_root_test()
{
    echo "<pre>";
    print_r($_POST);
    echo "</pre>";
}
TinyMvc::run($config);
コード例 #3
0
ファイル: crudController.php プロジェクト: avbdr/tinymvc-php
 public function rm($id)
 {
     if (!$id) {
         return;
     }
     $this->can(TinyMvc::App()->controller . '/rm', $id);
     $model = new $this->modelName();
     $model = $model::byId($id);
     $model->delete();
     $this->flash("Changes were saved", "success");
     $this->redirect($this->successUrl);
 }