質問編集履歴
2
最新版のソースです
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,71 +21,69 @@
|
|
21
21
|
|
22
22
|
以下、ソースです。
|
23
23
|
|
24
|
-
index.html
|
24
|
+
index.html (17/3/1 追記 ver1.1)
|
25
25
|
--------------------------------------------------------------------
|
26
26
|
```ここに言語を入力
|
27
|
-
<?php
|
27
|
+
<?php
|
28
|
-
require('dbconnect.php');
|
28
|
+
require('dbconnect.php');
|
29
29
|
|
30
|
-
session_start();
|
30
|
+
session_start();
|
31
31
|
|
32
|
-
if(isset($_POST){
|
32
|
+
if(isset($_POST)){
|
33
|
-
|
33
|
+
if(!empty($_POST)){ //ログインの処理
|
34
|
-
//ログインの処理
|
35
|
-
|
34
|
+
if($_POST['mail'] != '' && $_POST['pass'] != ''){
|
36
|
-
|
35
|
+
$sql = sprintf('SELECT * FROM users WHERE mail="%s" AND pass="%s"',
|
37
|
-
|
36
|
+
mysqli_real_escape_string($db, $_POST['mail']),
|
38
|
-
|
37
|
+
mysqli_real_escape_string($db, sha1($_POST['pass']))
|
39
|
-
|
38
|
+
);
|
40
|
-
|
39
|
+
$record = mysqli_query($db, $sql) or die(mysqli_error($db));
|
41
|
-
|
40
|
+
$result = mysqli_fetch_assoc($record);
|
42
|
-
|
41
|
+
if(!empty($result)){ //ログイン成功
|
43
|
-
|
42
|
+
header('Location: main.php');
|
44
|
-
|
43
|
+
exit();
|
45
|
-
|
44
|
+
}else{
|
46
|
-
|
45
|
+
$error['login'] = 'failed';
|
47
|
-
|
46
|
+
}
|
48
|
-
|
47
|
+
}else{
|
49
|
-
|
48
|
+
$error['login'] = 'blank';
|
50
|
-
|
49
|
+
}
|
51
|
-
|
50
|
+
}
|
52
|
-
}
|
51
|
+
}
|
52
|
+
ini_set('display_errors', 1);
|
53
|
+
error_reporting(E_ALL);
|
53
54
|
|
54
|
-
?>
|
55
|
+
?>
|
55
56
|
|
56
|
-
<!DOCTYPE html>
|
57
|
+
<!DOCTYPE html>
|
57
|
-
<html>
|
58
|
+
<html>
|
58
|
-
|
59
|
+
<head>
|
59
|
-
|
60
|
+
<title>Login</title>
|
60
|
-
|
61
|
+
</head>
|
61
|
-
<body>
|
62
|
-
|
62
|
+
<body bgcolor="#FAFC7B">
|
63
|
-
|
63
|
+
<h2>Login</h2>
|
64
|
-
|
64
|
+
<img src="nekos.jpg">
|
65
|
-
|
65
|
+
<form action="" method="post">
|
66
|
-
|
66
|
+
<dl>
|
67
|
-
|
67
|
+
<dt>メールアドレス</dt>
|
68
|
-
<dd>
|
69
|
-
|
68
|
+
<dd><input type="text" name="mail" size="35" maxlength="255"> </dd>
|
70
|
-
</dd>
|
71
|
-
|
69
|
+
<dt>パスワード</dt>
|
72
|
-
<dd>
|
73
|
-
|
70
|
+
<dd><input type="password" name="pass" size="35" maxlength="255"></dd>
|
74
|
-
</dd>
|
75
|
-
|
71
|
+
</dl>
|
76
|
-
|
72
|
+
<input type="submit" value="ログイン">
|
73
|
+
<?php var_dump($error['login']); ?>
|
74
|
+
|
77
|
-
|
75
|
+
<?php if(!empty($error['login']) && $error['login'] == 'blank'): ?>
|
78
|
-
|
76
|
+
<p><font color="red">* メールアドレスまたはパスワードをご記入ください</font></p>
|
79
|
-
|
77
|
+
<?php endif; ?>
|
80
|
-
|
78
|
+
<?php if(!empty($error['login']) && $error['login'] == 'failed'): ?>
|
81
|
-
|
79
|
+
<p><font color="red">* ログインに失敗しました。正しくご記入ください。</font></p>
|
82
|
-
|
80
|
+
<?php endif; ?>
|
83
|
-
|
81
|
+
</form>
|
84
|
-
<HR>
|
82
|
+
<HR>
|
85
|
-
|
83
|
+
<a href="join/register.php">新規登録</a>
|
86
|
-
|
84
|
+
<a href="lookingforpass.php">パスワード照会</a>
|
87
|
-
|
85
|
+
<a href="contact.html">お問い合わせ</a>
|
88
|
-
|
86
|
+
</body>
|
89
|
-
</html>
|
87
|
+
</html>
|
90
88
|
```
|
91
89
|
--------------------------------------------------------------------
|
1
codeブロックに記載しました。失礼しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
index.html
|
25
25
|
--------------------------------------------------------------------
|
26
|
+
```ここに言語を入力
|
26
27
|
<?php
|
27
28
|
require('dbconnect.php');
|
28
29
|
|
@@ -48,7 +49,7 @@
|
|
48
49
|
$error['login'] = 'blank';
|
49
50
|
}
|
50
51
|
}
|
51
|
-
}
|
52
|
+
}
|
52
53
|
|
53
54
|
?>
|
54
55
|
|
@@ -86,4 +87,5 @@
|
|
86
87
|
<a href="contact.html">お問い合わせ</a>
|
87
88
|
</body>
|
88
89
|
</html>
|
90
|
+
```
|
89
91
|
--------------------------------------------------------------------
|