質問編集履歴
2
インデントをつけました
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,33 +3,32 @@
|
|
3
3
|
ですが、いくらフォームを送信してもphpでpostが受信出来ません。
|
4
4
|
(postが空になる)
|
5
5
|
どこがいけないのでしょうか?
|
6
|
-
|
7
6
|
```php
|
8
7
|
|
9
8
|
<?php
|
10
|
-
ini_set(
|
9
|
+
ini_set('display_errors', 1);
|
11
10
|
error_reporting(E_ALL);
|
12
11
|
?>
|
13
12
|
<?php
|
14
13
|
require("size.php");
|
15
14
|
|
16
|
-
if(!isset($_SESSION['user'])){
|
15
|
+
if (!isset($_SESSION['user'])) {
|
17
|
-
if(isset($_POST['pass'])){
|
16
|
+
if (isset($_POST['pass'])) {
|
18
|
-
print_r($_POST);
|
17
|
+
print_r($_POST);
|
19
|
-
if(file_exists
|
18
|
+
if (file_exists('./pass/' . $_POST['user'] . '.txt')) {
|
20
|
-
$pass = readfile('./pass/'.$_POST['user'].'.txt');
|
19
|
+
$pass = readfile('./pass/' . $_POST['user'] . '.txt');
|
21
|
-
|
20
|
+
|
22
|
-
if($_POST['pass'] == $pass){
|
21
|
+
if ($_POST['pass'] == $pass) {
|
23
|
-
|
22
|
+
|
24
|
-
$_SESSION['user'] = $_POST['user'];
|
23
|
+
$_SESSION['user'] = $_POST['user'];
|
25
|
-
|
24
|
+
|
26
|
-
header("Location: ".$_SERVER['PHP_SELF']);
|
25
|
+
header("Location: " . $_SERVER['PHP_SELF']);
|
27
|
-
|
26
|
+
|
28
|
-
}else{
|
27
|
+
} else {
|
29
|
-
|
30
|
-
|
28
|
+
|
29
|
+
|
31
|
-
echo"password incorrect.";
|
30
|
+
echo "password incorrect.";
|
32
|
-
echo'<form action="index.php" method="post">
|
31
|
+
echo '<form action="index.php" method="post">
|
33
32
|
<p>
|
34
33
|
苗字をローマ字で:<input type="text" name="user" size="40">
|
35
34
|
</p>
|
@@ -38,19 +37,19 @@
|
|
38
37
|
</p>
|
39
38
|
<input type="submit" name="login" value="login">
|
40
39
|
</form>';
|
41
|
-
exit();
|
40
|
+
exit();
|
42
|
-
}
|
41
|
+
}
|
43
|
-
}else{
|
42
|
+
} else {
|
44
|
-
|
43
|
+
|
45
|
-
file_put_contents("./pass/".$_post['user'].".txt", $_post['pass']);
|
44
|
+
file_put_contents("./pass/" . $_post['user'] . ".txt", $_post['pass']);
|
46
|
-
|
45
|
+
|
47
|
-
header("Location: ".$_SERVER['PHP_SELF']);
|
46
|
+
header("Location: " . $_SERVER['PHP_SELF']);
|
48
|
-
|
47
|
+
|
49
|
-
}
|
48
|
+
}
|
50
|
-
}else{
|
49
|
+
} else {
|
51
|
-
|
50
|
+
|
52
|
-
echo"login";
|
51
|
+
echo "login";
|
53
|
-
echo'<form action="index.php" method="post">
|
52
|
+
echo '<form action="index.php" method="post">
|
54
53
|
<p>
|
55
54
|
苗字をローマ字で:<input type="text" name="user" size="40">
|
56
55
|
</p>
|
@@ -59,13 +58,13 @@
|
|
59
58
|
</p>
|
60
59
|
<input type="submit" name="login" value="login">
|
61
60
|
</form>';
|
62
|
-
exit();
|
61
|
+
exit();
|
62
|
+
|
63
|
-
|
63
|
+
}
|
64
|
+
} else {
|
65
|
+
echo "halloworld";
|
66
|
+
|
67
|
+
|
64
68
|
}
|
65
|
-
}else{
|
66
|
-
echo"halloworld";
|
67
69
|
|
68
|
-
|
69
|
-
}
|
70
|
-
|
71
70
|
```
|
1
訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
}
|
43
43
|
}else{
|
44
44
|
|
45
|
-
file_put_contents("./pass/".$
|
45
|
+
file_put_contents("./pass/".$_post['user'].".txt", $_post['pass']);
|
46
46
|
|
47
47
|
header("Location: ".$_SERVER['PHP_SELF']);
|
48
48
|
|