| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
1,129 バイト追加 、 2021年3月14日 (日) 04:26
piroto@puli-sub1:~/workspaces/sample2$ php oil console
Fuel 1.8.2 - PHP 8.0.2 (cli) (Feb 5 2021 21:42:11) [Linux]
>>> Auth::create_user('testsample','password','test@typea.info');
1
</pre>
 
=====コントローラー=====
<pre>
public function action_login() {
$postparam = Input::post();
$name = $postparam['username'];
$pass = $postparam['password'];
 
Log::info("${name}/${pass}");
$user = Auth::validate_user($name, $pass);
Log::info(print_r($user, true));
 
$loginresult = (Auth::login($name, $pass)?'Success':'Fail');
$content = "User '${name}' login ${loginresult}.";
$data = array(
'title' => 'Auth Sample.',
'content' => $content,
);
$view = View::forge('sample/auth', $data);
return Response::forge($view);
}
</pre>
=====View=====
<pre>
<!DOCTYPE html>
<html>
<head>
</head>
<bodY>
<h1><?php echo $title; ?></h1>
<form action="login" method="POST">
<p>
ID:<input type="text" name="username" value="<?php echo $username??''; ?>"/>
PASSWORD:<input type="password" name="password"/>
</p>
<input type="submit">Login</input>
</form>
<textarea style="width:800px;height:400px">
<?php echo $content; ?>
</textarea>
</body>
</html>
</pre>

案内メニュー