コード例 #1
0
ファイル: Auth.php プロジェクト: jaydson/theWebMind
 private function action()
 {
     if ($db = new SQLiteDatabase(_MINDSRC_ . '/mind3rd/SQLite/mind')) {
         $result = $db->query("SELECT * FROM user where login='******' AND pwd='" . sha1($this->pwd) . "' AND status= 'A'");
         $row = false;
         while ($result->valid()) {
             $row = $result->current();
             $_SESSION['auth'] = JSON_encode($row);
             $_SESSION['login'] = $row['login'];
             break;
         }
         if (!$row) {
             Mind::write('auth_fail', true);
             return false;
         }
     } else {
         die('Database not found!');
     }
     return $this;
 }
コード例 #2
0
ファイル: http.php プロジェクト: jaydson/theWebMind
<?php

/**
 * This is the server file which will receive the requisition
 * All the HTTP requests are goning to reach this file, so,
 * it will treat the POST data before routing the requisition
 * With this, you can send by post, the program variable, saying
 * the program you want to execute, and the parameters you want
 * to pass
 */
if (!isset($_REQ)) {
    Mind::write("http_invalid_requisition");
    exit;
}
if (!isset($_REQ['data'])) {
    $_REQ['data'] = array();
}
foreach ($_POST as $k => $value) {
    $_REQ['data'][$k] = preg_replace("/['\"\\\\.\\/]/", '', $value);
}
if (isset($app)) {
    if (!isset($_REQ['data']) || !isset($_REQ['data']['program'])) {
        Mind::write('programRequired');
        return false;
    }
    $program = $app->findCommand($_REQ['data']['program']);
    $program = $program->getFileName();
    $program = new $program();
    $program->HTTPExecute();
}
コード例 #3
0
ファイル: Quit.php プロジェクト: jaydson/theWebMind
 private function action()
 {
     session_destroy();
     Mind::write('bye');
     return $this;
 }