/
r.php
60 lines (51 loc) · 1.41 KB
/
r.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
<?php
/* Template Name: Redirect Utility */
// added by Ben Kaplan - 10/28/11 - prints out dev or www depending upon environment
$subdomain = print_subdomain();
$url .= pods_url_variable(1);
$i = 1;
while ($i < 20) {
$i++;
$dir = pods_url_variable($i);
if ($dir) {
$url .= '/' . $dir;
}
}
if (!$url) {
header("Location: http://{$subdomain}.occasionsonline.com/");
exit;
}
if (substr($url, 0, 4) != "http") {
$url = 'http://' . $url;
}
$len = strlen($url);
$action = '';
$target = '';
$sql = "SELECT * FROM wp_pod_tbl_vendor_profiles WHERE
web_url LIKE '$url%'
OR blog_url LIKE '$url%'
OR facebook_url LIKE '$url%'
OR linkedin_url LIKE '$url%'
OR twitter_url LIKE '$url%'
OR ad_url LIKE '$url%'
";
$result = pod_query($sql);
$row = mysql_fetch_assoc($result);
if ($row) {
$id = $row['id'];
if ($url == substr($row['web_url'], 0, $len)) {$action = 'click_web';}
elseif ($url == substr($row['blog_url'], 0, $len)) {$action = 'click_blog';}
elseif ($url == substr($row['facebook_url'], 0, $len)) {$action = 'click_facebook';}
elseif ($url == substr($row['linkedin_url'], 0, $len)) {$action = 'click_linkedin';}
elseif ($url == substr($row['twitter_url'], 0, $len)) {$action = 'click_twitter';}
elseif ($url == substr($row['ad_url'], 0, $len)) {$action = 'click_ad';}
}
if (!$action) {
$id = 0;
$action = 'click_url';
$target = $url;
}
ao_log($id, $action, $target);
header("Location: " . $url);
exit;
?>