戻る      MyAuth.php       login.php      

《PHP言語 /MyAuth.php》

<?php
require_once("Auth/Auth.php");
function myLogin(){
include_once("login.php");
}

$params=array(
"dsn" => "sqlite://localhost/schedule.sqlite",
"table" => "schedule_usr",
"usernamecol" => "uid",
"passwordcol" => "passwd");

$auth=new Auth("DB",$params,"myLogin",TRUE);
$auth->start();
if($auth->getUsername()==""){exit(1);}
?>


《PHP言語 /login.php》

<html>
<head>
<title>ログインページ</title>
</head>
<body>
<h1 align="center">ログインページ</h1>
<hr />
<form method="POST" action="<?php print($_SERVER["PHP_SELF"]) ;?>">
<table border="0" align="center">
<tr>
<th align="right">ユーザID:</th>
<td>
<input type="text" name="username" size="20" maxlength="30"
value="" style="ime-mode:disabled" />
</td>
</tr><tr>
<th align="right">パスワード:</th>
<td><input type="password" name="password" size="20" maxlength="30" /></td>
</tr><tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="ログイン" />
</td>
</tr>
</table>
</form>
</body>
</html>

《PHP言語 /.htaccess》

<IfModule mod_php5.c>
php_value auto_prepend_file "MyAuth.php"
</IfModule>