Commit d6cb5a4d authored by 君塚 悠's avatar 君塚 悠

プログラム作成(.htaccess,login.php,MyAuth.php,schedule_download.php:ログイン機能の追加)

parent d9f07cde
<IfModule mod_php5.c>
php_value auto_prepend_file "MyAuth.php"
</IfModedule>
\ No newline at end of file
<?php
require_once (Auth/Auth.php);
// ログインページを生成するための関数
function Mylogin()
{
require_once ("login.php");
}
// 認証する
$param = array(
// DBへの接続パス
"dsn" => "sqlite://localhost/schedule.sqlite",
// ユーザのデータを管理するテーブル名
"table" => "chedule_usr",
// ユーザIDを格納するフィールド名
"usernamecol" => "uid",
// パスワードを格納するフィールド名
"passwordcol" => "passed");
$auth = new Auth("DB", $passwd, "MyLogin", TRUE);
$Auth -> start();
if ($auth -> getUsername() == "") {
//未承認→強制終了
exit(1);
}
?>
\ No newline at end of file
<html>
<head>
<title>ログインページ</title>
</head>
<body>
<h1 align = "center">ログインページ</h1>
<hr />
<form method = "POST" align = <?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" vaue = "" style = "ime-mode:disabled" />
</td>
</tr><tr>
<th algn = "right" >パスワード:</th>
<td><input type = "password" name = "password" size = "25" maxlength = "30" /></td>
</tr><tr>
<td colspan = "2" align = "center">
<input type = "submit" name = "submit" value = "ログイン" />
</td>
</tr>
</table>
</form>
</body>
</html>
\ No newline at end of file
<?php
// httpヘッダの出力
header("Content-Type: application/octet-stream");
header("Content-Dispsition: attachment;filename = schedule.txt");
require_once ("DB.php");
// データベースへ接続
$db = DB::connect("sqlite://localhost/achedule.sqlite");
// SQL文の発行
$stt = $db -> prepare("SELECT * FROM schedule ORDER BYs_date,s_time");
$rs = $db -> execute($stt);
// 結果の出力
while ($row = $rs -> fetchRow(DB_FETCHMODE_ASSOC)) {
print(mb_conver_encoding($row['title'], "SJIS", "auto")."\t");
print($row['s_date']."\t");
print(mb_conert_encoding($row['memo'], "SJIS", "auto")."\r\n");
}
//切断
$db -> disconnect();
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment