2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 10/19/2003 *
\r
4 * =============== Last change: 09/10/2004 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : what-reflinks.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Referral links *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Referral-Links *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // Some security stuff...
\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))
\r
37 $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
\r
40 elseif (!IS_LOGGED_IN())
\r
42 LOAD_URL(URL."/modules.php?module=index");
\r
45 // Add description as navigation point
\r
46 ADD_DESCR("member", basename(__FILE__));
\r
48 OPEN_TABLE("90%", "member_table member_content_align", "");
\r
50 // Load current referral clicks
\r
51 $result = SQL_QUERY_ESC("SELECT ref_clicks FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
\r
52 array($GLOBALS['userid']), __FILE__, __LINE__);
\r
54 list($c) = SQL_FETCHROW($result);
\r
55 SQL_FREERESULT($result);
\r
57 OUTPUT_HTML ("<FONT class=\"tiny\">".YOUR_PERSONAL_REFLINK.":<BR>
\r
58 <STRONG><A href=\"".URL."/ref.php?ref=".$GLOBALS['userid']."\" target=\"_blank\">".URL."/ref.php?ref=".$GLOBALS['userid']."</A></STRONG><BR>
\r
61 if (EXT_IS_ACTIVE("nickname"))
\r
63 // Add nickname link when nickname is entered
\r
64 $nick = NICKNAME_GET_NICK($GLOBALS['userid']);
\r
68 // Display nickname link
\r
69 OUTPUT_HTML (NICKNAME_YOUR_REFLINK.":<BR>
\r
70 <STRONG><A href=\"".URL."/ref.php?ref=".$nick."\" target=\"_blank\">".URL."/ref.php?ref=".$nick."</A></STRONG><BR>
\r
75 // Display link to nickname form
\r
76 OUTPUT_HTML ("<STRONG class=\"guest_note\">".NO_NICKNAME_SET."</STRONG><BR>
\r
77 <A class=\"tiny\" href=\"".URL."/modules.php?module=login&what=nickname\">".PLEASE_CLICK_NICKNAME_FORM."</A>");
\r
81 // Clicks on your reflink
\r
82 OUTPUT_HTML (YOUR_REFCLICKS.": <STRONG>".$c."</STRONG> ".CLICKS."</FONT><BR><BR>");
\r
83 $WHERE = " WHERE visible='Y'";
\r
84 if (IS_ADMIN()) $WHERE = "";
\r
85 $result = SQL_QUERY("SELECT id, url, alternate, counter, clicks FROM "._MYSQL_PREFIX."_refbanner", __FILE__, __LINE__);
\r
87 if (SQL_NUMROWS($result) > 0)
\r
89 // List available ref banners
\r
91 while (list($id, $url, $alt, $count, $clks) = SQL_FETCHROW($result))
\r
93 $test = str_replace(URL, PATH, $url); $size = 0;
\r
96 // Download banner (I hope you keep the banner on same server???)
\r
97 $fp = @file($url); $file = "";
\r
98 if ((!empty($fp)) && (is_array($fp)) && (count($fp) > 0))
\r
100 // Loads only found banner, when there is a 404 error this foreach() command
\r
101 // will cause an "Invalid argument supplied for foreach()" error
\r
102 foreach ($fp as $f)
\r
107 $size = strlen($file);
\r
109 elseif (file_exists($test))
\r
111 $size = filesize($test);
\r
113 if ($size > 0) $alt .= " (".TRANSLATE_COMMA(round($size/102.4)/10)." ".KBYTES.")";
\r
115 // Load banner data
\r
122 'uid' => $GLOBALS['userid'],
\r
127 $OUT .= LOAD_TEMPLATE("member_reflinks_row", true, $content);
\r
133 define('__REFLINKS_ROWS', $OUT);
\r
135 // Load final template
\r
136 LOAD_TEMPLATE("member_reflinks_table", false, $GLOBALS['userid']);
\r
140 SQL_FREERESULT($result);
\r