示例#1
0
文件: User.php 项目: engel/yase
 static function login($sLogin, $sPassword)
 {
     $res = mysql_query("SELECT login from user where login='******' and password='******'");
     $row = mysql_fetch_row($res);
     $sLoggedIn = $row[0];
     if (isset($sLoggedIn)) {
         $_SESSION['login'] = $sLoggedIn;
         $_SESSION['user_id'] = YASE_User::getId($_REQUEST['username']);
         $_SESSION['account_id'] = YASE_User::getFirstAccountId();
         $_SESSION['account_domain'] = YASE_Account::getDomain($_SESSION['account_id']);
         return true;
     } else {
         return false;
     }
 }
示例#2
0
文件: test2.php 项目: engel/yase
<?php

require_once 'classes/YASE/Framework.php';
$id = YASE_User::getId("pedant.dk");
$_SESSION['user_id'] = $id;
$aid = YASE_User::getFirstAccountId($id);
print_r(YASE_Account::getDomain($aid) . "\r\n");
示例#3
0
文件: Template.php 项目: engel/yase
    public static function leftbar()
    {
        ?>
<div id="leftbar">
  <div id="innerleftbar">

<?php 
        if (isset($_SESSION['user_id'])) {
            ?>

  <form action="<?php 
            echo Template::$root;
            ?>
/admin/account.php" onchange="this.submit()" method="post" >
  <select id="accountSelect" name="account_id" style="width:100px">
<?php 
            foreach (YASE_User::getAccounts($_SESSION['user_id']) as $a) {
                if (trim($a->sDomain) == trim($_SESSION["account_domain"])) {
                    print "<option value=\"" . $a->iId . "\" selected>" . trim($a->sDomain);
                } else {
                    print "<option value=\"" . $a->iId . "\">" . trim($a->sDomain);
                }
            }
            ?>
  </select>
  </form>
 <br><br>
   <ul>
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/index.php">front page </a></li> 
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/account.php">account </a></li> 
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/crawler.php">crawl filter</a></li>
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/indexer.php">index filter</a></li>
<!--
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/body.php">body filter </a></li>
-->
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/search.php">search test</a></li>
<!--
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/admin.php">admin</a></li>
-->
    <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/logout.php">logout</a></li> 
  </ul>
  <br><br>
<?php 
        } else {
            ?>
  <ul>
   <li><a href="<?php 
            echo Template::$root;
            ?>
/admin/login.php">login</a></li>
  </ul>
  <?php 
        }
        ?>
  </div> 
</div>

<?php 
    }
示例#4
0
文件: login.php 项目: engel/yase
<?php

require_once "../classes/YASE/Framework.php";
require_once "../classes/Template.php";
require_once "app/views/login.php";
//perform login and redirect to index page
if (YASE_User::login($_REQUEST['username'], $_REQUEST['password'])) {
    header('Location: index.php');
} else {
    if (isset($_REQUEST['username'])) {
        $message = "login failed";
    }
}
//the page to show if the login fails
Template::head();
Template::leftbar();
loginForm();
?>
 <p>
 <?php 
print $message;
?>
 </p>
 <?php 
Template::bottom();