質問編集履歴

1

依頼があったため

2018/04/05 23:09

投稿

monumonu
monumonu

スコア32

test CHANGED
File without changes
test CHANGED
@@ -3,3 +3,77 @@
3
3
 
4
4
 
5
5
  どうしたらセッションIDを書き換えずに遷移できますでしょうか?
6
+
7
+
8
+
9
+ ```
10
+
11
+ <?php
12
+
13
+
14
+
15
+ App::uses('AppController', 'Controller');
16
+
17
+ App::uses('HttpSocket', 'Network/Http');
18
+
19
+
20
+
21
+ class HogeController extends AppController {
22
+
23
+
24
+
25
+ public $components = [
26
+
27
+ 'Cookie',
28
+
29
+ 'Session',
30
+
31
+ 'Security'
32
+
33
+ ];
34
+
35
+
36
+
37
+ public function beforeFilter() {
38
+
39
+ parent::beforeFilter();
40
+
41
+
42
+
43
+ $this->response->disableCache();
44
+
45
+ $this->Security->validatePost = false;
46
+
47
+ $this->Security->csrfCheck = false;
48
+
49
+ }
50
+
51
+
52
+
53
+ public function testlogin($id) {
54
+
55
+ ...
56
+
57
+
58
+
59
+ $HttpSocket = new HttpSocket();
60
+
61
+ $response = $HttpSocket->post('https://xxxxx.co.jp/hoge/fuga', ['hoge' => 'fuga']); // 同一ドメインのアクションに対してPOST
62
+
63
+
64
+
65
+ $this->log($response->body, 'debug');
66
+
67
+ $this->log($response->code, 'debug');
68
+
69
+ $this->log($this->Session->id(), 'debug'); // このIDと、POSTした先のIDが異なってしまう
70
+
71
+
72
+
73
+ $this->redirect('https://xxxxx.co.jp/hoge/piyo'); // リダイレクト
74
+
75
+ }
76
+
77
+ }
78
+
79
+ ```