svnno****@sourc*****
svnno****@sourc*****
2011年 5月 4日 (水) 23:10:12 JST
Revision: 28 http://sourceforge.jp/projects/smartupload/svn/view?view=rev&revision=28 Author: hryksbt Date: 2011-05-04 23:10:11 +0900 (Wed, 04 May 2011) Log Message: ----------- Added Paths: ----------- trunk/SmartUpload/login.php Removed Paths: ------------- trunk/SmartUpload/main.php -------------- next part -------------- Added: trunk/SmartUpload/login.php =================================================================== --- trunk/SmartUpload/login.php (rev 0) +++ trunk/SmartUpload/login.php 2011-05-04 14:10:11 UTC (rev 28) @@ -0,0 +1,77 @@ +<?php + session_start(); +/* + * SmartUpload/main.php + * @author Hiroyuki Shibata + * 2011/05/4 + * Rev 1.0 + * + */ +?> + +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> +<title>SmartUpload</title> +</head> +<body> + +<?php + require_once("include/database.php"); + + $userid = $_REQUEST['id']; + $password = $_REQUEST['pass']; + + function login_form() { +?> + <!-- ログインフォーム --> + <form name="login_form" action="login.php" method="post"> + ID(アカウント) :<input type="text" name="id"> + パスワード :<input type="password" name="pass"> + <input type="submit" value="ログイン" /> + <input type="hidden" name="cmd" value="login"/> + </form> +<?php + } + + if( $_REQUEST['cmd'] == "login" ) { + + // ユーザ名&パスワードチェック + $stmt = $db->prepare("SELECT * FROM user_info WHERE userid= ? AND password= ? "); + $stmt->execute(array($userid, $password)); + + if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { + + // ログイン成功時 + $_SESSION["id"] = $_REQUEST["id"]; + print ($row["fullname"]."さん"); +?> + <!-- ログアウトボタン --> + <form name="logout_form" action="login.php" method="post"> + <input type="submit" value="ログアウト"> + <input type="hidden" name="cmd" value="logout"/> + </form> +<?php + } else { + + // ログイン失敗時 + print ("ログインに失敗しました"); + login_form(); + + } + + } else if( $_REQUEST['cmd'] == "logout" ) { + + print ("ログアウトしました"); + session_destroy(); + login_form(); + + } else { + + // 未ログインの場合 + login_form(); + + } +?> +</body> +</html> \ No newline at end of file Deleted: trunk/SmartUpload/main.php =================================================================== --- trunk/SmartUpload/main.php 2011-05-03 17:37:16 UTC (rev 27) +++ trunk/SmartUpload/main.php 2011-05-04 14:10:11 UTC (rev 28) @@ -1,87 +0,0 @@ -<?php - session_start(); -/* - * SmartUpload/main.php - * @author Hiroyuki Shibata - * 2011/05/4 - * Rev 1.0 - * - */ -?> - -<html> -<head> -<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> -<title>SmartUpload</title> -</head> -<body> -<?php - - require_once("include/database.php"); - - $userid = $_REQUEST['id']; - $password = $_REQUEST['pass']; - - function login_form() { -?> - <!-- ログインフォーム --> - <form name="login_form" action="main.php" method="post"> - ID(アカウント) :<input type="text" name="id"> - パスワード :<input type="password" name="pass"> - <input type="submit" value="ログイン" /> - <input type="hidden" name="cmd" value="login"/> - </form> -<?php - } - - // ログインチェック - - if( $_REQUEST['cmd'] == "login" ) { - - // ユーザ名&パスワードチェック - - $stmt = $db->prepare( - "SELECT * FROM user_info WHERE userid= ? AND password= ? " - ); - - $stmt->execute(array($userid, $password)); - - while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { - - // ログイン成功時 - if($row['userid'] == $_REQUEST['id']) { - - $_SESSION["id"] = $_REQUEST["id"]; - - print ($row["fullname"]."さん"); - -?> - <!-- ログアウトボタン --> - <form name="logout_form" action="main.php" method="post"> - <input type="submit" value="ログアウト"> - <input type="hidden" name="cmd" value="logout"/> -<?php - session_destroy(); -?> - </form> -<?php - } else { - - // ログイン失敗時 - print ("ログインに失敗しました"); - login_form(); - - } - - } - - // 未ログインの場合 - - } else { - - login_form(); - - } -?> -</body> -</html> \ No newline at end of file