コード例 #1
0
ファイル: LoginAction.php プロジェクト: reekoheek/php-fw
	function doLogin() {
		$this->save("login");
		if (empty($this->messages)) {
			$select = new Select("users");
			$select->add(Exp::eq("username", $this->login["username"]));
			$user = DB::unique($select);
			if (empty($user)) {
				$this->addMsgMessage("error.fieldNotFound", "login.username");
				Msg::save($this->messages);
				Apu::redirect("login");
			}
			if ($user["password"] != $this->login["password"]) {
				$this->addMsgMessage("error.fieldNotFound", "login.password");
				Msg::save($this->messages);
				Apu::redirect("login");
			}	
			$date = new Date();
			Session::save(LOGIN_SCOPE, $user, "user");
			Session::save(LOGIN_SCOPE, $date, "last_access");
			$this->remove();
			Apu::redirect("frame");
		} else {
			Msg::save($this->messages);
			Apu::redirect("login");
		}
	}
コード例 #2
0
ファイル: Update.php プロジェクト: reekoheek/php-fw
	function sql() {
		$this->expressions = array();
		$this->add(Exp::eq("id", $this->value["__ID__"]));
		$sql = sprintf("update %s set %s %s", 
			$this->tableString(), 
			$this->valueString(), 
			$this->whereString());
		return $sql;
	}
コード例 #3
0
ファイル: Delete.php プロジェクト: reekoheek/php-fw
	function sql() {
		$this->expressions = array();
		$this->add(Exp::eq("id", $this->value["__ID__"]));
		$this->maxResults = 1;
		$sql = sprintf("delete from %s %s %s", 
			$this->tableString(),
			$this->whereString(), 
			$this->limitString());
		return $sql;
	}
コード例 #4
0
ファイル: BaseDao.php プロジェクト: reekoheek/php-fw
	function byId($id, $table) {
		$select = new Select($table);
		$select->add(Exp::eq("id", $id));
		return DB::unique($select);
	}