]> git.mxchange.org Git - mailer.git/blob - inc/modules/member/what-reflinks.php
3234e51624cefcb03bfcedd5f79f22741474687c
[mailer.git] / inc / modules / member / what-reflinks.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 10/19/2003 *
4  * ===============                              Last change: 09/10/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : what-reflinks.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Referral links                                   *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Referral-Links                                   *
12  * -------------------------------------------------------------------- *
13  *                                                                      *
14  * -------------------------------------------------------------------- *
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
16  * For more information visit: http://www.mxchange.org                  *
17  *                                                                      *
18  * This program is free software; you can redistribute it and/or modify *
19  * it under the terms of the GNU General Public License as published by *
20  * the Free Software Foundation; either version 2 of the License, or    *
21  * (at your option) any later version.                                  *
22  *                                                                      *
23  * This program is distributed in the hope that it will be useful,      *
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
26  * GNU General Public License for more details.                         *
27  *                                                                      *
28  * You should have received a copy of the GNU General Public License    *
29  * along with this program; if not, write to the Free Software          *
30  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
31  * MA  02110-1301  USA                                                  *
32  ************************************************************************/
33
34 // Some security stuff...
35 if (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } elseif (!IS_MEMBER()) {
39         LOAD_URL("modules.php?module=index");
40 }
41
42 // Add description as navigation point
43 ADD_DESCR("member", basename(__FILE__));
44
45 // Load current referral clicks
46 $result = SQL_QUERY_ESC("SELECT ref_clicks FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
47  array($GLOBALS['userid']), __FILE__, __LINE__);
48
49 list($c) = SQL_FETCHROW($result);
50 SQL_FREERESULT($result);
51
52 OUTPUT_HTML("<FONT class=\"tiny\">".YOUR_PERSONAL_REFLINK.":<br />
53 <STRONG><A href=\"".URL."/ref.php?refid=".$GLOBALS['userid']."\" target=\"_blank\">".URL."/ref.php?ref=".$GLOBALS['userid']."</A></STRONG><br />
54 <br />");
55
56 if (EXT_IS_ACTIVE("nickname"))
57 {
58         // Add nickname link when nickname is entered
59         $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
60
61         if (!empty($nick))
62         {
63                 // Display nickname link
64                 OUTPUT_HTML(NICKNAME_YOUR_REFLINK.":<br />
65 <STRONG><A href=\"".URL."/ref.php?ref=".$nick."\" target=\"_blank\">".URL."/ref.php?ref=".$nick."</A></STRONG><br />
66 <br />");
67         }
68          else
69         {
70                 // Display link to nickname form
71                 OUTPUT_HTML("<STRONG class=\"guest_note\">".NO_NICKNAME_SET."</STRONG><br />
72 <A class=\"tiny\" href=\"".URL."/modules.php?module=login&amp;what=nickname\">".PLEASE_CLICK_NICKNAME_FORM."</A>");
73         }
74 }
75
76 // Clicks on your reflink
77 OUTPUT_HTML(YOUR_REFCLICKS.": <STRONG>".$c."</STRONG> ".CLICKS."</FONT><br /><br />");
78 $whereStatement = " WHERE visible='Y'";
79 if (IS_ADMIN()) $whereStatement = "";
80 $result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM "._MYSQL_PREFIX."_refbanner", __FILE__, __LINE__);
81
82 if (SQL_NUMROWS($result) > 0)
83 {
84         // List available ref banners
85         $SW = 2; $OUT = "";
86         while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result))
87         {
88                 $test = str_replace(URL, PATH, $url); $size = 0;
89                 if ($test == $url)
90                 {
91                         // Download banner (I hope you keep the banner on same server???)
92                         $fp = @file($url); $file = "";
93                         if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0))
94                         {
95                                 // Loads only found banner, when there is a 404 error this foreach() command
96                                 // will cause an "Invalid argument supplied for foreach()" error
97                                 foreach ($fp as $f)
98                                 {
99                                         $file .= $f;
100                                 }
101                         }
102                         $size = strlen($file);
103                 } elseif (FILE_READABLE($test)) {
104                         $size = filesize($test);
105                 }
106                 if ($size > 0) $alt .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." ".KBYTES.")";
107
108                 // Load banner data
109                 $content = array(
110                         'sw'  => $SW,
111                         'url' => $url,
112                         'alt' => $alt,
113                         'cnt' => $count,
114                         'cks' => $clks,
115                         'uid' => $GLOBALS['userid'],
116                         'id'  => $id,
117                 );
118
119                 // Add row
120                 $OUT .= LOAD_TEMPLATE("member_reflinks_row", true, $content);
121
122                 // Switchcolors
123                 $SW = 3 - $SW;
124         }
125
126         define('__REFLINKS_ROWS', $OUT);
127
128         // Load final template
129         LOAD_TEMPLATE("member_reflinks_table", false, $GLOBALS['userid']);
130 }
131
132 // Free result
133 SQL_FREERESULT($result);
134
135 //
136 ?>