teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

最訂正します。

2020/12/23 05:05

投稿

lnavi.bex810vh
lnavi.bex810vh

スコア12

title CHANGED
File without changes
body CHANGED
@@ -6,157 +6,91 @@
6
6
  > Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\idol\update_profile_done.php on line 88
7
7
  ```
8
8
  <?php
9
+ session_cache_limiter('private_no_expire');
9
10
  require_once('login_tmp.php');
10
11
  require_once('../common/common.php');
11
12
  ?>
12
13
  <!DOCTYPE html>
13
14
  <html>
14
- <head><meta charset="UTF-8">
15
+ <head><meta charset=UTF-8>
16
+ <meta name="viewport" content="width=device-width,initial-scale=1">
15
- <title>プロフィール確認</title>
17
+ <title>プロフィール登録完了</title>
16
18
  </head>
17
19
  <body>
20
+ <h3>プロフィール登録完了</h3><br />
18
21
  <?php
19
22
 
20
- $err='';
21
23
  $post=sanitize($_POST);
22
24
 
23
- print '<h3>プロフィール確認</h3><br />';
25
+ $id=$_SESSION['id'];
24
- print '<form name="update_profile_check" method="post" action="update_profile_done.php"><br />';
25
26
 
26
- print '変更後のハンドルネーム:<br />';
27
- $idol_name=$post['idol_name'];
27
+ if($id=='')
28
- print $idol_name.'</br />';
28
+ {
29
- print '<input type="hidden" name="idol_name" value="'.$idol_name.'">';
30
29
 
31
- print '変更後の都道府県<br />';
30
+ print '無効なパラメータです。';
31
+ exit();
32
32
 
33
- $pref_arr=array(
34
- "0"=>"内緒"
35
- ,"1"=>"北海道"
36
- ,"2"=>"青森県"
37
- ,"3"=>"岩手県"
38
- ,"4"=>"宮城県"
39
- ,"5"=>"秋田県"
40
- ,"6"=>"山形県"
41
- ,"7"=>"福島県"
42
- ,"8"=>"茨城県"
43
- ,"9"=>"栃木県"
44
- ,"10"=>"群馬県"
45
- ,"11"=>"埼玉県"
46
- ,"12"=>"千葉県"
47
- ,"13"=>"東京都"
48
- ,"14"=>"神奈川県"
49
- ,"15"=>"新潟県"
50
- ,"16"=>"富山県"
51
- ,"17"=>"石川県"
52
- ,"18"=>"福井県"
53
- ,"19"=>"山梨県"
54
- ,"20"=>"長野県"
55
- ,"21"=>"岐阜県"
56
- ,"22"=>"静岡県"
57
- ,"23"=>"愛知県"
58
- ,"24"=>"三重県"
59
- ,"25"=>"滋賀県"
60
- ,"26"=>"京都府"
61
- ,"27"=>"大阪府"
62
- ,"28"=>"兵庫県"
63
- ,"29"=>"奈良県"
64
- ,"30"=>"和歌山県"
65
- ,"31"=>"鳥取県"
66
- ,"32"=>"島根県"
67
- ,"33"=>"岡山県"
68
- ,"34"=>"広島県"
69
- ,"35"=>"山口県"
70
- ,"36"=>"徳島県"
71
- ,"37"=>"香川県"
72
- ,"38"=>"愛媛県"
73
- ,"39"=>"高知県"
74
- ,"40"=>"福岡県"
75
- ,"41"=>"佐賀県"
76
- ,"42"=>"長崎県"
77
- ,"43"=>"熊本県"
78
- ,"44"=>"大分県"
79
- ,"45"=>"宮崎県"
80
- ,"46"=>"鹿児島県"
81
- ,"47"=>"沖縄県"
82
- );
83
-
84
-
85
- if (isset($post['pref_id'])) {
86
- if ($post['pref_id'] != "") {
87
-
88
- $pref_id=$post['pref_id'];
89
-
90
- }else{
91
- print '都道府県が入力されていません。';
92
- print '<input type="button" onclick="history.back()" value="戻る">';
93
- exit();
94
33
  }
95
34
 
96
- foreach($pref_arr as $key=>$val)
97
- {
98
- if ($pref_id==$key)
35
+ //データベース接続
99
- {
36
+ $dsn='mysql:host=localhost;dbname=idol;charset=utf8';
100
- print $val;
37
+ $user='root';
101
- }
38
+ $password='';
102
- }
103
- }
104
39
 
105
- print '<br />';
40
+ $dbh= new PDO($dsn,$user,$password);
106
- print '<input type="hidden" name="pref_id" value="'.$pref_id.'">';
41
+ $dbh->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
107
42
 
108
43
  if (isset($post['del_img00'])) {
109
44
  if ($post['del_img00'] != "") {
110
45
 
46
+ $sql1='SELECT * FROM mst_img WHERE mem_id=? AND img_flg=11';
47
+
111
- $del_img00=$post['del_img00'];
48
+ $stmh1=$dbh->prepare($sql1);
49
+ $stmh1 -> bindValue(1, $id, PDO::PARAM_INT);
112
- print $del_img00;
50
+ $stmh1->execute();
113
51
 
52
+ // $image=substr($image,4);
53
+ // print $image;
114
- }
54
+ {
115
- }
55
+ {
116
56
 
117
57
  if (isset($post['del_img02'])) {
118
58
  if ($post['del_img02'] != "") {
119
59
 
120
- $del_img02=$post['del_img02'];
60
+ $sql2='SELECT * FROM mst_img WHERE mem_id=? AND img_flg=21';
121
- print $del_img02;
122
61
 
62
+ $stmh2=$dbh->prepare($sql2);
63
+ $stmh2 -> bindValue(1, $id, PDO::PARAM_INT);
64
+ $stmh2->execute();
65
+
123
66
  }
124
67
  }
125
68
 
126
69
  if (isset($post['del_img04'])) {
127
70
  if ($post['del_img04'] != "") {
128
71
 
129
- $del_img04=$post['del_img04'];
72
+ $sql3='SELECT * FROM mst_img WHERE mem_id=? AND img_flg=31';
130
- print $del_img04;
131
73
 
74
+ $stmh3=$dbh->prepare($sql3);
75
+ $stmh3 -> bindValue(1, $id, PDO::PARAM_INT);
76
+ $stmh3->execute();
77
+
132
78
  }
133
79
  }
134
80
 
135
81
  if (isset($post['del_img06'])) {
136
82
  if ($post['del_img06'] != "") {
137
83
 
138
- $del_img06=$post['del_img06'];
84
+ $sql4='SELECT * FROM mst_img WHERE mem_id=? AND img_flg=41';
139
- print $del_img06;
140
85
 
86
+ $stmh4=$dbh->prepare($sql4);
87
+ $stmh4 -> bindValue(1, $id, PDO::PARAM_INT);
88
+ $stmh4->execute();
89
+
141
- }
90
+ }
142
91
  }
143
-
144
- $appeal=$post['appeal'];
145
- print '<textarea name="appeal" rows="8" cols="20">';
146
- print $appeal;
147
- print '</textarea>';
148
-
149
-
150
-
151
- print '<input type="submit" value="登録">';
152
- print '<br /><br />';
153
-
154
- if($err=='1')
155
- {
156
- print '<input type="button" onclick="history.back()" value="修正する">';
157
- }
158
- print '</form>';
159
92
  ?>
93
+ <a href="update_profile.php">プロフィール編集</a>
160
94
  </body>
161
95
  </html>
162
96
  ```

1

張り付けたソースが異なっていたため。

2020/12/23 05:05

投稿

lnavi.bex810vh
lnavi.bex810vh

スコア12

title CHANGED
File without changes
body CHANGED
@@ -86,7 +86,7 @@
86
86
  if ($post['pref_id'] != "") {
87
87
 
88
88
  $pref_id=$post['pref_id'];
89
-
89
+
90
90
  }else{
91
91
  print '都道府県が入力されていません。';
92
92
  print '<input type="button" onclick="history.back()" value="戻る">';