PluginProbe ʕ •ᴥ•ʔ
PrettyLinks – Affiliate Links, Link Branding, Link Tracking, Marketing and Stripe Payments Plugin / 1.2.1
PrettyLinks – Affiliate Links, Link Branding, Link Tracking, Marketing and Stripe Payments Plugin v1.2.1
1.1.8 1.1.9 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.3 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.4 1.3.40 1.3.41 1.3.42 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.16 1.4.17 1.4.18 1.4.19 1.4.2 1.4.20 1.4.21 1.4.22 1.4.23 1.4.24 1.4.25 1.4.26 1.4.27 1.4.28 1.4.29 1.4.3 1.4.30 1.4.31 1.4.32 1.4.33 1.4.34 1.4.35 1.4.36 1.4.37 1.4.38 1.4.39 1.4.4 1.4.40 1.4.41 1.4.42 1.4.43 1.4.44 1.4.45 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.6 1.4.7 1.4.8 1.5.0 1.5.1 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.10 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.1 3.0.10 3.0.2 3.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.10 3.6.11 3.6.12 3.6.14 3.6.15 3.6.16 3.6.17 3.6.18 3.6.19 3.6.2 3.6.20 3.6.21 3.6.22 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7
pretty-link / prli.php
pretty-link Last commit date
classes 17 years ago images 17 years ago includes 17 years ago pretty-link.php 15 years ago prli-config.php 17 years ago prli-links.php 17 years ago prli-reports.php 17 years ago prli.php 17 years ago readme.txt 17 years ago screenshot-1.png 17 years ago screenshot-2.png 17 years ago screenshot-3.png 17 years ago screenshot-4.png 17 years ago
prli.php
74 lines
1 <?php
2 /* This file tracks clicks */
3
4 require_once(dirname(__FILE__) . '/../../../wp-config.php');
5
6 // reverse compatibility -- get rid of this within the next couple of releases
7 if( !isset($_GET['sprli']) and isset($_GET['s']) )
8 $_GET['sprli'] = $_GET['s'];
9
10 if( $_GET['sprli'] != null and $_GET['sprli'] != '' )
11 {
12 $slug = $_GET['sprli'];
13
14 $click_table = $wpdb->prefix . "prli_clicks";
15 $pretty_links_table = $wpdb->prefix . "prli_links";
16
17 $query = "SELECT * FROM $pretty_links_table WHERE slug='$slug' LIMIT 1";
18 $pretty_link = $wpdb->get_row($query);
19
20 $first_click = false;
21
22 $click_ip = $_SERVER['REMOTE_ADDR'];
23 $click_browser = $_SERVER['HTTP_USER_AGENT'];
24
25 //Set Cookie if it doesn't exist
26 $cookie_name = 'prli_click_' . $pretty_link->id;
27 $cookie_expire_time = time()+60*60*24*30; // Expire in 30 days
28
29 if($_COOKIE[$cookie_name] == null)
30 {
31 setcookie($cookie_name,$slug,$cookie_expire_time);
32 $first_click = true;
33 }
34
35 //Record Click in DB
36 $insert = "INSERT INTO $click_table (link_id,ip,browser,first_click,created_at) VALUES ($pretty_link->id,'$click_ip','$click_browser','$first_click',NOW())";
37
38 $results = $wpdb->query( $insert );
39
40 $param_string = '';
41
42 if(isset($pretty_link->forward_params) and $pretty_link->forward_params and isset($_GET) and count($_GET) > 1)
43 {
44 $first_param = true;
45 foreach($_GET as $key => $value)
46 {
47 // Ignore the 'sprli' parameter
48 if($key != 'sprli')
49 {
50 if($first_param)
51 {
52 $param_string = (preg_match("#\?#", $pretty_link->url)?"&":"?");
53 $first_param = false;
54 }
55 else
56 $param_string .= "&";
57
58 $param_string .= "$key=$value";
59 }
60 }
61 }
62
63 //Redirect to Product URL
64 if(isset($pretty_link->track_as_img) and $pretty_link->track_as_img)
65 {
66 $size = getimagesize($pretty_link->url);
67 header('Content-Type: '.$size['mime']);
68 echo file_get_contents($pretty_link->url.$param_string);
69 }
70 else
71 header("Location: $pretty_link->url".$param_string);
72 }
73 ?>
74