質問編集履歴
3
Wordpressのfunction.phpの中で、PHPファイルを呼び出す記述をしていますので、それを、掲載します。
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,6 +146,32 @@
|
|
146
146
|
|
147
147
|
|
148
148
|
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
WordPressのfunction.phpの中に、これを記述しています。
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
//ショートコードを使ったphpファイルの呼び出し方法
|
158
|
+
|
159
|
+
function my_php_Include($params = array()) {
|
160
|
+
|
161
|
+
extract(shortcode_atts(array('file' => 'default'), $params));
|
162
|
+
|
163
|
+
ob_start();
|
164
|
+
|
165
|
+
include(STYLESHEETPATH . "/template-parts/$file.php");
|
166
|
+
|
167
|
+
return ob_get_clean();
|
168
|
+
|
169
|
+
}
|
170
|
+
|
171
|
+
add_shortcode('myphp', 'my_php_Include');
|
172
|
+
|
173
|
+
|
174
|
+
|
149
175
|
```
|
150
176
|
|
151
177
|
|
2
ソースコードがややこしかったので、シンプルにしました。このコードで実行しても結果は期待はずれです。WordPress固定ページでは、ショートコードで、PHPファイルを読み出しています。では、
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,75 +76,7 @@
|
|
76
76
|
|
77
77
|
<meta charset="UTF-8">
|
78
78
|
|
79
|
-
<title>
|
79
|
+
<title>結果</title>
|
80
|
-
|
81
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<!-- Global site tag (gtag.js) - Google Analytics -->
|
90
|
-
|
91
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-130664081-1"></script>
|
92
|
-
|
93
|
-
<script>
|
94
|
-
|
95
|
-
window.dataLayer = window.dataLayer || [];
|
96
|
-
|
97
|
-
function gtag(){dataLayer.push(arguments);}
|
98
|
-
|
99
|
-
gtag('js', new Date());
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
gtag('config', 'UA-1○○○-1');
|
104
|
-
|
105
|
-
</script>
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<script>
|
110
|
-
|
111
|
-
window.addEventListener('message', function(e) {
|
112
|
-
|
113
|
-
var iframe = $("#parentframe");
|
114
|
-
|
115
|
-
var eventName = e.data[0];
|
116
|
-
|
117
|
-
var data = e.data[1];
|
118
|
-
|
119
|
-
switch(eventName) {
|
120
|
-
|
121
|
-
case 'setHeight':
|
122
|
-
|
123
|
-
iframe.height(data);
|
124
|
-
|
125
|
-
break;
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
}, false);
|
130
|
-
|
131
|
-
</script>
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
136
|
-
|
137
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
138
|
-
|
139
|
-
<link href="https://fonts.googleapis.com/css2?family=MonteCarlo&family=Shippori+Mincho+B1&display=swap" rel="stylesheet">
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
<style type="text/css">
|
144
|
-
|
145
|
-
ここは割愛
|
146
|
-
|
147
|
-
</style>
|
148
80
|
|
149
81
|
|
150
82
|
|
@@ -152,131 +84,23 @@
|
|
152
84
|
|
153
85
|
<?php
|
154
86
|
|
87
|
+
|
88
|
+
|
155
|
-
$shoppass
|
89
|
+
$shoppass="2014";
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
$server = "○○○○";
|
94
|
+
|
95
|
+
$userName = "○○○○";
|
96
|
+
|
97
|
+
$password = "○○○○";
|
98
|
+
|
99
|
+
$dbName = "○○○○";
|
156
100
|
|
157
101
|
|
158
102
|
|
159
|
-
//入力チェック
|
160
|
-
|
161
|
-
$errormsg = array();
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
//shoppass
|
166
|
-
|
167
|
-
if ($shoppass == null) {
|
168
|
-
|
169
|
-
$errormsg[] = "パスワードを入力してください。";
|
170
|
-
|
171
|
-
}
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
if ($shoppass != null){
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
$server = "○○○○";
|
180
|
-
|
181
|
-
$userName = "○○○○";
|
182
|
-
|
183
|
-
$password = "○○○○";
|
184
|
-
|
185
|
-
$dbName = "○○○○";
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
103
|
+
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
190
|
-
|
191
|
-
if ($mysqli->connect_error){
|
192
|
-
|
193
|
-
echo $mysqli->connect_error;
|
194
|
-
|
195
|
-
exit();
|
196
|
-
|
197
|
-
}else{
|
198
|
-
|
199
|
-
$mysqli->set_charset("utf-8");
|
200
|
-
|
201
|
-
}
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
$sql = "SELECT * FROM woma2 where pass = '" . $shoppass . "'";
|
206
|
-
|
207
|
-
$result = $mysqli -> query($sql);
|
208
|
-
|
209
|
-
//クエリー失敗
|
210
|
-
|
211
|
-
if(!$result) {
|
212
|
-
|
213
|
-
echo $mysqli->error;
|
214
|
-
|
215
|
-
exit();
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
//レコード
|
220
|
-
|
221
|
-
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
|
222
|
-
|
223
|
-
$chusen_atari =$row["chusen_atari"];
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
if($row==0){
|
228
|
-
|
229
|
-
$errormsg[] = "パスワードが間違っています。<br><br>入力間違いの中で、<br>1(数字のいち)<br>l(小文字のエル)<br>i(小文字のアイ)<br><br>にご注意ください。";
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
?>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
<?php if (count($errormsg) > 0): ?>
|
244
|
-
|
245
|
-
<div id="errmsg">
|
246
|
-
|
247
|
-
ERROR<br />
|
248
|
-
|
249
|
-
<?php foreach ($errormsg as $msg): ?>
|
250
|
-
|
251
|
-
<?=$msg?><br />
|
252
|
-
|
253
|
-
<?php endforeach; ?>
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
<?php else: ?>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
<?php
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
$server = "○○○○";
|
270
|
-
|
271
|
-
$userName = "○○○○";
|
272
|
-
|
273
|
-
$password = "○○○○";
|
274
|
-
|
275
|
-
$dbName = "○○○○";
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
280
104
|
|
281
105
|
if ($mysqli->connect_error){
|
282
106
|
|
@@ -298,57 +122,9 @@
|
|
298
122
|
|
299
123
|
|
300
124
|
|
125
|
+
$sql = "update woma2 set use_times = use_times+1 where pass = '" . $shoppass . "'";
|
301
126
|
|
302
|
-
|
303
|
-
$sql = "update woma2 set date_use_pass = '" . $now . "' where pass = '" . $shoppass . "'";
|
304
|
-
|
305
|
-
|
127
|
+
$result = $mysqli -> query($sql);
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
//クエリー失敗
|
310
|
-
|
311
|
-
if(!$result) {
|
312
|
-
|
313
|
-
echo $mysqli->error;
|
314
|
-
|
315
|
-
exit();}
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
$server = "○○○○";
|
322
|
-
|
323
|
-
$userName = "○○○○";
|
324
|
-
|
325
|
-
$password = "○○○○";
|
326
|
-
|
327
|
-
$dbName = "○○○○";
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
332
|
-
|
333
|
-
if ($mysqli->connect_error){
|
334
|
-
|
335
|
-
echo $mysqli->connect_error;
|
336
|
-
|
337
|
-
exit();
|
338
|
-
|
339
|
-
}else{
|
340
|
-
|
341
|
-
$mysqli->set_charset("utf-8");
|
342
|
-
|
343
|
-
}
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
/////■■■■■■■■■■■■■■■ここです■■■■■■■■■■■■■■■
|
348
|
-
|
349
|
-
$sql = "update woma2 set use_times = use_times+1 where pass = '" . $shoppass . "'";
|
350
|
-
|
351
|
-
$result = $mysqli -> query($sql);
|
352
128
|
|
353
129
|
//クエリー失敗
|
354
130
|
|
@@ -362,185 +138,11 @@
|
|
362
138
|
|
363
139
|
|
364
140
|
|
365
|
-
|
366
|
-
|
367
|
-
$num_rows=0;
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
// 接続処理
|
374
|
-
|
375
|
-
$con = mysqli_connect('○○', '○○', '○○', '○○');
|
376
|
-
|
377
|
-
if(!$con) {
|
378
|
-
|
379
|
-
die('接続に失敗しました');
|
380
|
-
|
381
|
-
}
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
// 文字コード
|
386
|
-
|
387
|
-
mysqli_set_charset($con, 'utf8');
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
// SQLの発行と出力
|
392
|
-
|
393
|
-
$sql = "SELECT * FROM woma2 where use_times > 0";
|
394
|
-
|
395
|
-
$res = mysqli_query($con, $sql);
|
396
|
-
|
397
|
-
$num_rows = mysqli_num_rows($res);
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
echo $num_rows;
|
402
|
-
|
403
|
-
// 接続断
|
404
|
-
|
405
|
-
mysqli_close($con);
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
//100人にひとり当たる
|
412
|
-
|
413
|
-
//1目は当たる
|
414
|
-
|
415
|
-
//7人目は当たる
|
416
|
-
|
417
|
-
if(($num_rows %100 == 0)or($num_rows ==1)or($num_rows ==7)){
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
$server = "○○○○";
|
422
|
-
|
423
|
-
$userName = "○○○○";
|
424
|
-
|
425
|
-
$password = "○○○○";
|
426
|
-
|
427
|
-
$dbName = "○○○○";
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
432
|
-
|
433
|
-
if ($mysqli->connect_error){
|
434
|
-
|
435
|
-
echo $mysqli->connect_error;
|
436
|
-
|
437
|
-
exit();
|
438
|
-
|
439
|
-
}else{
|
440
|
-
|
441
|
-
$mysqli->set_charset("utf-8");
|
442
|
-
|
443
|
-
}
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
//この条件のときにchusen_atariを1にする
|
448
|
-
|
449
|
-
$sql = "update woma2 set chusen_atari=1 where pass = '" . $shoppass . "'";
|
450
|
-
|
451
|
-
$result = $mysqli -> query($sql);
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
//クエリー失敗
|
458
|
-
|
459
|
-
if(!$result) {
|
460
|
-
|
461
|
-
echo $mysqli->error;
|
462
|
-
|
463
|
-
exit();}
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
}
|
468
|
-
|
469
|
-
|
470
|
-
|
471
141
|
?>
|
472
142
|
|
473
143
|
|
474
144
|
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
<!--クーポン当たり-->
|
480
|
-
|
481
|
-
<?php
|
482
|
-
|
483
|
-
if($chusen_atari !=1){echo "<!--";}
|
484
|
-
|
485
|
-
?>
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
<div class="p-result">
|
490
|
-
|
491
|
-
あたりの場合の文書
|
492
|
-
|
493
|
-
</div>
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
<?php
|
500
|
-
|
501
|
-
if($chusen_atari!=1){echo "-->";}
|
502
|
-
|
503
|
-
?>
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
<!--はずれ-->
|
512
|
-
|
513
|
-
<?php
|
514
|
-
|
515
|
-
if($chusen_atari ==1){echo "<!--";}
|
516
|
-
|
517
|
-
?>
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
<div class="p-result">
|
522
|
-
|
523
|
-
はずれの場合の文書
|
524
|
-
|
525
|
-
</div>
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
<?php
|
530
|
-
|
531
|
-
if(($chusen_atari ==1)&&($num_rows ==3)){echo "-->";}
|
532
|
-
|
533
|
-
?>
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
<?php endif; ?>
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
145
|
+
</html>
|
544
146
|
|
545
147
|
|
546
148
|
|
1
ソースコードについて、割愛したものの掲載から、できる限り全部掲載しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,55 +68,479 @@
|
|
68
68
|
|
69
69
|
```
|
70
70
|
|
71
|
+
<!DOCTYPE html>
|
72
|
+
|
73
|
+
<html lang="ja">
|
74
|
+
|
75
|
+
<head>
|
76
|
+
|
77
|
+
<meta charset="UTF-8">
|
78
|
+
|
79
|
+
<title>抽選結果</title>
|
80
|
+
|
81
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
90
|
+
|
91
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-130664081-1"></script>
|
92
|
+
|
93
|
+
<script>
|
94
|
+
|
95
|
+
window.dataLayer = window.dataLayer || [];
|
96
|
+
|
97
|
+
function gtag(){dataLayer.push(arguments);}
|
98
|
+
|
99
|
+
gtag('js', new Date());
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
gtag('config', 'UA-1○○○-1');
|
104
|
+
|
105
|
+
</script>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<script>
|
110
|
+
|
111
|
+
window.addEventListener('message', function(e) {
|
112
|
+
|
113
|
+
var iframe = $("#parentframe");
|
114
|
+
|
115
|
+
var eventName = e.data[0];
|
116
|
+
|
117
|
+
var data = e.data[1];
|
118
|
+
|
119
|
+
switch(eventName) {
|
120
|
+
|
121
|
+
case 'setHeight':
|
122
|
+
|
123
|
+
iframe.height(data);
|
124
|
+
|
125
|
+
break;
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
}, false);
|
130
|
+
|
131
|
+
</script>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
136
|
+
|
137
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
138
|
+
|
139
|
+
<link href="https://fonts.googleapis.com/css2?family=MonteCarlo&family=Shippori+Mincho+B1&display=swap" rel="stylesheet">
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<style type="text/css">
|
144
|
+
|
145
|
+
ここは割愛
|
146
|
+
|
147
|
+
</style>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
71
153
|
<?php
|
72
154
|
|
155
|
+
$shoppass = $_POST['prm1'];
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
//入力チェック
|
160
|
+
|
161
|
+
$errormsg = array();
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
//shoppass
|
166
|
+
|
167
|
+
if ($shoppass == null) {
|
168
|
+
|
169
|
+
$errormsg[] = "パスワードを入力してください。";
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
if ($shoppass != null){
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
$server = "○○○○";
|
180
|
+
|
181
|
+
$userName = "○○○○";
|
182
|
+
|
183
|
+
$password = "○○○○";
|
184
|
+
|
185
|
+
$dbName = "○○○○";
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
190
|
+
|
191
|
+
if ($mysqli->connect_error){
|
192
|
+
|
193
|
+
echo $mysqli->connect_error;
|
194
|
+
|
195
|
+
exit();
|
196
|
+
|
197
|
+
}else{
|
198
|
+
|
199
|
+
$mysqli->set_charset("utf-8");
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
$sql = "SELECT * FROM woma2 where pass = '" . $shoppass . "'";
|
206
|
+
|
207
|
+
$result = $mysqli -> query($sql);
|
208
|
+
|
209
|
+
//クエリー失敗
|
210
|
+
|
211
|
+
if(!$result) {
|
212
|
+
|
213
|
+
echo $mysqli->error;
|
214
|
+
|
215
|
+
exit();
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
//レコード
|
220
|
+
|
221
|
+
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
|
222
|
+
|
223
|
+
$chusen_atari =$row["chusen_atari"];
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
if($row==0){
|
228
|
+
|
229
|
+
$errormsg[] = "パスワードが間違っています。<br><br>入力間違いの中で、<br>1(数字のいち)<br>l(小文字のエル)<br>i(小文字のアイ)<br><br>にご注意ください。";
|
230
|
+
|
231
|
+
}
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
?>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<?php if (count($errormsg) > 0): ?>
|
244
|
+
|
245
|
+
<div id="errmsg">
|
246
|
+
|
247
|
+
ERROR<br />
|
248
|
+
|
249
|
+
<?php foreach ($errormsg as $msg): ?>
|
250
|
+
|
251
|
+
<?=$msg?><br />
|
252
|
+
|
253
|
+
<?php endforeach; ?>
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
73
257
|
|
74
258
|
|
259
|
+
<?php else: ?>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
<?php
|
266
|
+
|
267
|
+
|
268
|
+
|
75
|
-
$server = "
|
269
|
+
$server = "○○○○";
|
76
270
|
|
77
271
|
$userName = "○○○○";
|
78
272
|
|
79
273
|
$password = "○○○○";
|
80
274
|
|
81
|
-
$dbName = "
|
275
|
+
$dbName = "○○○○";
|
82
|
-
|
83
|
-
|
84
|
-
|
276
|
+
|
277
|
+
|
278
|
+
|
85
|
-
|
279
|
+
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
86
|
-
|
280
|
+
|
87
|
-
|
281
|
+
if ($mysqli->connect_error){
|
88
|
-
|
282
|
+
|
89
|
-
|
283
|
+
echo $mysqli->connect_error;
|
90
|
-
|
284
|
+
|
91
|
-
|
285
|
+
exit();
|
92
|
-
|
286
|
+
|
93
|
-
|
287
|
+
}else{
|
94
|
-
|
288
|
+
|
95
|
-
|
289
|
+
$mysqli->set_charset("utf-8");
|
96
|
-
|
290
|
+
|
97
|
-
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
|
98
|
-
|
295
|
+
$now = date('Y/m/d H:i:s');
|
296
|
+
|
99
|
-
|
297
|
+
echo $now;
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
100
|
-
|
303
|
+
$sql = "update woma2 set date_use_pass = '" . $now . "' where pass = '" . $shoppass . "'";
|
304
|
+
|
305
|
+
$result = $mysqli -> query($sql);
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
//クエリー失敗
|
310
|
+
|
311
|
+
if(!$result) {
|
312
|
+
|
313
|
+
echo $mysqli->error;
|
314
|
+
|
315
|
+
exit();}
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
$server = "○○○○";
|
322
|
+
|
323
|
+
$userName = "○○○○";
|
324
|
+
|
325
|
+
$password = "○○○○";
|
326
|
+
|
327
|
+
$dbName = "○○○○";
|
328
|
+
|
329
|
+
|
330
|
+
|
101
|
-
|
331
|
+
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
332
|
+
|
102
|
-
|
333
|
+
if ($mysqli->connect_error){
|
334
|
+
|
103
|
-
|
335
|
+
echo $mysqli->connect_error;
|
336
|
+
|
337
|
+
exit();
|
338
|
+
|
339
|
+
}else{
|
340
|
+
|
341
|
+
$mysqli->set_charset("utf-8");
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
/////■■■■■■■■■■■■■■■ここです■■■■■■■■■■■■■■■
|
348
|
+
|
349
|
+
$sql = "update woma2 set use_times = use_times+1 where pass = '" . $shoppass . "'";
|
104
350
|
|
105
351
|
$result = $mysqli -> query($sql);
|
106
352
|
|
353
|
+
//クエリー失敗
|
354
|
+
|
355
|
+
if(!$result) {
|
356
|
+
|
357
|
+
echo $mysqli->error;
|
358
|
+
|
359
|
+
exit();}
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
$num_rows=0;
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
// 接続処理
|
374
|
+
|
375
|
+
$con = mysqli_connect('○○', '○○', '○○', '○○');
|
376
|
+
|
377
|
+
if(!$con) {
|
378
|
+
|
379
|
+
die('接続に失敗しました');
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
// 文字コード
|
386
|
+
|
387
|
+
mysqli_set_charset($con, 'utf8');
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
// SQLの発行と出力
|
392
|
+
|
393
|
+
$sql = "SELECT * FROM woma2 where use_times > 0";
|
394
|
+
|
395
|
+
$res = mysqli_query($con, $sql);
|
396
|
+
|
397
|
+
$num_rows = mysqli_num_rows($res);
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
echo $num_rows;
|
402
|
+
|
403
|
+
// 接続断
|
404
|
+
|
405
|
+
mysqli_close($con);
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
//100人にひとり当たる
|
412
|
+
|
413
|
+
//1目は当たる
|
414
|
+
|
415
|
+
//7人目は当たる
|
416
|
+
|
417
|
+
if(($num_rows %100 == 0)or($num_rows ==1)or($num_rows ==7)){
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
$server = "○○○○";
|
422
|
+
|
423
|
+
$userName = "○○○○";
|
424
|
+
|
425
|
+
$password = "○○○○";
|
426
|
+
|
427
|
+
$dbName = "○○○○";
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
$mysqli = new mysqli($server, $userName, $password,$dbName);
|
432
|
+
|
433
|
+
if ($mysqli->connect_error){
|
434
|
+
|
435
|
+
echo $mysqli->connect_error;
|
436
|
+
|
437
|
+
exit();
|
438
|
+
|
439
|
+
}else{
|
440
|
+
|
441
|
+
$mysqli->set_charset("utf-8");
|
442
|
+
|
443
|
+
}
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
//この条件のときにchusen_atariを1にする
|
448
|
+
|
449
|
+
$sql = "update woma2 set chusen_atari=1 where pass = '" . $shoppass . "'";
|
450
|
+
|
451
|
+
$result = $mysqli -> query($sql);
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
//クエリー失敗
|
458
|
+
|
459
|
+
if(!$result) {
|
460
|
+
|
461
|
+
echo $mysqli->error;
|
462
|
+
|
463
|
+
exit();}
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
}
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
?>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
<!--クーポン当たり-->
|
480
|
+
|
481
|
+
<?php
|
482
|
+
|
483
|
+
if($chusen_atari !=1){echo "<!--";}
|
484
|
+
|
485
|
+
?>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
<div class="p-result">
|
490
|
+
|
491
|
+
あたりの場合の文書
|
492
|
+
|
493
|
+
</div>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
<?php
|
500
|
+
|
501
|
+
if($chusen_atari!=1){echo "-->";}
|
502
|
+
|
503
|
+
?>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
<!--はずれ-->
|
512
|
+
|
513
|
+
<?php
|
514
|
+
|
515
|
+
if($chusen_atari ==1){echo "<!--";}
|
516
|
+
|
517
|
+
?>
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
<div class="p-result">
|
522
|
+
|
523
|
+
はずれの場合の文書
|
524
|
+
|
525
|
+
</div>
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<?php
|
530
|
+
|
531
|
+
if(($chusen_atari ==1)&&($num_rows ==3)){echo "-->";}
|
532
|
+
|
533
|
+
?>
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
|
539
|
+
<?php endif; ?>
|
540
|
+
|
107
541
|
|
108
542
|
|
109
|
-
|
543
|
+
</html>
|
110
|
-
|
111
|
-
if(!$result) {
|
112
|
-
|
113
|
-
echo $mysqli->error;
|
114
|
-
|
115
|
-
exit();}
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
?>
|
120
544
|
|
121
545
|
|
122
546
|
|