forked from dvygolov/YellowCloaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurl.php
37 lines (34 loc) · 1.09 KB
/
url.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
<?php
require_once 'settings.php';
require_once 'cookies.php';
//заменяем все макросы на реальные значения из куки
function replace_all_macros($url)
{
global $fbpixel_subname;
$px = get_fbpixel();
$landing = get_cookie('landing');
$prelanding = get_cookie('prelanding');
$subid = get_subid();
$tmp_url = str_replace('{px}', $px, $url);
$tmp_url = str_replace('{landing}', $landing, $tmp_url);
$tmp_url = str_replace('{prelanding}', $prelanding, $tmp_url);
$tmp_url = str_replace('{subid}', $subid, $tmp_url);
return $tmp_url;
}
function add_subs_to_link($url)
{
global $sub_ids;
$preset=['subid','prelanding','landing'];
foreach ($sub_ids as $sub) {
$key = $sub["name"];
$value = $sub["rewrite"];
$delimiter= (strpos($url, '?')===false?"?":"&");
if (in_array($key,$preset)&& isset($_COOKIE[$key])) {
$url.= $delimiter.$value.'='.$_COOKIE[$key];
} elseif (!empty($_GET[$key])) {
$url.= $delimiter.$value.'='.$_GET[$key];
}
}
return $url;
}
?>