質問編集履歴

1

コードの全体を掲載しました。

2020/05/12 13:49

投稿

ikuiku
ikuiku

スコア1

test CHANGED
File without changes
test CHANGED
@@ -28,15 +28,33 @@
28
28
 
29
29
  ```PHP
30
30
 
31
+ <?php
32
+
33
+
34
+
35
+   $path="/";
36
+
37
+   $dmain=“xxxx”;
38
+
39
+   $_cp = session_get_cookie_params();
40
+
41
+   session_name (‘hoge’);
42
+
43
+   session_id(‘apple’);
44
+
45
+ session_set_cookie_params(86400, $_cp[$path] . '; SameSite=None', $_cp[$domain], true, true);
46
+
47
+ session_start();
48
+
49
+
50
+
31
- if(isset($_SESSION['clicked'])) {
51
+ if(isset($_SESSION['clicked'])) { //2回目以降
32
52
 
33
53
 
34
54
 
35
55
  $num=$_SESSION['clicked'];
36
56
 
37
-
38
-
39
- $url="http://〇〇/index.php?clicked={$num}";
57
+ $url="http://××/index.php?clicked={$num}";
40
58
 
41
59
  header("Location: " . $url);
42
60
 
@@ -44,15 +62,31 @@
44
62
 
45
63
 
46
64
 
47
- }else{
48
65
 
49
66
 
50
67
 
68
+
51
- その他処理
69
+ }else{ //初回訪問
52
70
 
53
71
 
54
72
 
73
+ $clicked_num="0001”
74
+
75
+ $_SESSION['clicked']=$clicked_num;
76
+
77
+ $num=$_SESSION['clicked'];
78
+
79
+ $url="http://○○/index.php??clicked={$num}";
80
+
81
+ header("Location: " . $url);
82
+
83
+ exit();
84
+
85
+
86
+
55
- }
87
+   } ?>
88
+
89
+
56
90
 
57
91
  ```
58
92