-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
151 lines (104 loc) · 4.81 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Signin</title>
<!-- Bootstrap core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="signin.css" rel="stylesheet">
<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="js/ie-emulation-modes-warning.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<?php
if(!isset($_GET['utma'])){
echo '
<form class="form-signin" role="form" >
<h2 class="form-signin-heading">Авторизируйтесь</h2>
<input class="form-control" placeholder="UTMA" type="text" name="utma" value="" required autofocus>
<input class="form-control" type="text" placeholder="UTMB" name="utmb" value="" required>
<input class="form-control" type="text" placeholder="UTMC" name="utmc" value="" required>
<input class="form-control" type="text" placeholder="UTMZ" name="utmz" value="" required>
<input class="form-control" type="text" placeholder="XSRF" name="xsrf" value="" required>
<input class="form-control" type="text" placeholder="lang" name="lang" value="ru_RU">
<input class="form-control" type="text" placeholder="Token" name="token" value="" required>
<input class="form-control" type="text" placeholder="USER-AGENT" name="user_agent" value="" required>
<button class="btn btn-lg btn-primary btn-block" type="submit">Готово</button>
</form>
';
}else{
$utma = $_GET['utma'];
$utmb = $_GET['utmb'];
$utmc = $_GET['utmc'];
$cook = md5('l1al'.$utmc.$utma.$utmb);
$handle = fopen("users/$cook.txt", "w+");
$text = '# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
.gameminer.ru FALSE / FALSE 1724595000 lang ru_RU
.gameminer.ru FALSE / FALSE 1724595000 _xsrf '.$_GET['xsrf'].'
.gameminer.ru FALSE / FALSE 1724595000 _utma '.$_GET['utma'].'
.gameminer.ru FALSE / FALSE 1724595000 _utmb '.$_GET['utmb'].'
.gameminer.ru FALSE / FALSE 1724595000 _utmc '.$_GET['utmc'].'
.gameminer.ru FALSE / FALSE 1724595000 _utmz '.$_GET['utmz'].'
.gameminer.ru FALSE / FALSE 1724595000 token '.$_GET['token'].'
';
fwrite($handle, $text);
if(!empty($_GET['user_agent'])){
$user_agent = $_GET['user_agent'];
}else{
$user_agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36';
}
$howIs = testAuth($cook,$user_agent);
//print_r($howIs);
if($howIs){
session_start();
$_SESSION['xsrf'] = $_GET['xsrf'];
$_SESSION['cook'] = $cook;
$_SESSION['agent'] = $_GET['user_agent'];
echo 'Успешная авторизация,сохраните ссылку на эту страницу. <a href="main.php">Продолжить</a> ';
}else{
echo 'Ошибка,<a href="index.php"> попробуйте ещё раз</a>';
}
//print_r($handle);
}
function testAuth($cook,$user_agent){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://gameminer.ru');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, $user_agent);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_COOKIEFILE, $_SERVER['DOCUMENT_ROOT']."/maining/users/$cook.txt");
curl_setopt($curl, CURLOPT_COOKIEJAR, $_SERVER['DOCUMENT_ROOT']."/maining/users/$cook.txt");
$html = curl_exec($curl);
//print_r($html);
curl_close($curl);
//echo $html;
if(preg_match('/Выйти/i', $html)){
return 1;
}else{
return 0;
}
}
?>
</div>
<!-- /container -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>