forked from alamia442/vinaget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd.php
71 lines (64 loc) · 2.19 KB
/
add.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
<?php
error_reporting(E_ALL);
define('vinaget', 'yes');
include "class.php";
function check_account($host, $account)
{
global $obj;
if (empty($obj->acc[$host]['accounts'])) {
return false;
}
foreach ($obj->acc[$host]['accounts'] as $value) {
if ($account == $value) {
return true;
}
}
return false;
}
if (!empty($_POST["accounts"])) {
$obj = new stream_get();
$type = $_POST['type'];
$_POST["accounts"] = str_replace(" ", "", $_POST["accounts"]);
$account = trim($_POST['accounts']);
$donate = false;
if (check_account($type, $account)) {
die("false duplicate");
}
require_once 'hosts/' . $obj->list_host[$type]['file'];
$download = new $obj->list_host[$type]['class']($obj, $type);
if ($download->lib->acc[$download->site]['proxy'] != "") {
$download->lib->proxy = $download->lib->acc[$download->site]['proxy'];
}
if (method_exists($download, "CheckAcc")) {
if (strpos($account, ":")) {
list($user, $pass) = explode(':', $account);
$cook = $download->Login($user, $pass);
$cookie = $cook[1];
} else {
$cookie = $account;
}
$status = $download->CheckAcc($cookie);
if ($status[0]) {
echo "true";
$update = true;
if (empty($obj->acc[$type])) {
$obj->acc[$type]['max_size'] = $obj->max_size_default;
$obj->acc[$type]['proxy'] = "";
$obj->acc[$type]['direct'] = false;
}
$obj->acc[$type]['accounts'][] = $account;
$download->save($cookie);
} else {
echo "false {$status[1]}";
$update = false;
}
} else {
echo "false plugin fail";
$update = false;
}
################################## save account #############################################################################
if ($update == true && is_array($obj->acc) && count($obj->acc) > 0) {
$obj->save_json($obj->fileaccount, $obj->acc);
}
################################## save account #############################################################################
}