BVB Source Codes

Vehicle AdLogger v1.4.0 shu han edition Show functions.php Source code

Return Download Vehicle AdLogger v1.4.0 shu han edition: download functions.php Source code - Download Vehicle AdLogger v1.4.0 shu han edition Source code - Type:.php
  1. <?php
  2. /*#################################################################################
  3.         AdLogger
  4.         - An open-source tracking tool for preventing click fraud
  5.  
  6.         Copyright 2006 by Trevor Fitzgerald
  7.         http://www.adlogger.org
  8.  
  9.         This program is free software; you can redistribute it and/or
  10.         modify it under the terms of the GNU General Public License
  11.         as published by the Free Software Foundation; either version 2
  12.         of the License, or (at your option) any later version.
  13.  
  14.         This program is distributed in the hope that it will be useful,
  15.         but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.         GNU General Public License for more details.
  18.  
  19.         You should have received a copy of the GNU General Public License
  20.         along with this program; if not, write to the Free Software
  21.         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  22.  
  23.         If you find this script useful, please share it with others!
  24.  
  25.         Thank you!
  26. */#################################################################################
  27.  
  28. /*
  29. The micro_time function times how long it takes to load each page
  30. in the administration panel.  The value is shown in the footer of
  31. each page.  The micro_time function is called twice per page: once
  32. at the beginning, then again at the end.  At the end, it takes the
  33. difference of those two values and determines the amount of time
  34. between them.
  35. */
  36. function micro_time($start_time) {
  37.         list($usec, $sec) = explode(" ", microtime());
  38.         $micro_time = ((float)$usec + (float)$sec);
  39.  
  40.         if ($start_time == 0) {
  41.                 return $micro_time;
  42.         } else {
  43.                 $total_time = $micro_time - $start_time;
  44.                 return $total_time;
  45.         }
  46. }
  47.  
  48. /*
  49. The bodyHeader function is used to start the HTML output.  It also
  50. checks to see which page it's being used on to determine what
  51. stylesheets and scripts to include.
  52. */
  53. function bodyHeader($page, $version_num) { ?>
  54. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  55. <html>
  56.         <head>
  57.                         <meta http-equiv="content-type" content="text/html; charset=gb2312">
  58.                         <meta name="description" content="AdLogger Version <?php echo $version_num; ?>">
  59.                         <link rel="stylesheet" type="text/css" media="screen" href="<?php if ($page == 'install') echo "../admin/"; ?>styles/main_stylesheet.css">
  60.                         <link rel="stylesheet" type="text/css" media="screen" href="<?php if ($page == 'install') echo "../admin/"; ?>styles/form_styles.css">
  61.                 <?php if (($page == 'archive') || ($page == 'rankings')) { ?>
  62.                         <link href="./styles/popup_calendar.css" rel="stylesheet" media="screen" type="text/css">
  63.                 <?php }
  64.                 if ($page == 'install') { ?>
  65.                         <title>AdLogger 1.4.0 樂思蜀汉化版 安装程序</title>
  66.                 <?php } else { ?>
  67.                         <title>AdLogger 1.4.0 樂思蜀汉化版 管理中心</title>
  68.                 <?php }
  69.                 if ($page == 'settings') { ?>
  70.                         <script type="text/javascript" src="./scripts/confirm.js"></script>
  71.                         <script type="text/javascript" src="./scripts/settings.js"></script>
  72.                 <?php } elseif ($page == 'click_info') { ?>
  73.                         <script type="text/javascript" src="./scripts/confirm.js"></script>
  74.                 <?php } elseif ($page == 'archive') { ?>
  75.                         <script type="text/javascript" src="./scripts/archive.js"></script>
  76.                         <script type="text/javascript" src="./scripts/popup_calendar.js"></script>
  77.                 <?php } elseif ($page == 'install') { ?>
  78.                         <script type="text/javascript" src="./scripts/install.js"></script>
  79.                 <?php } elseif ($page == 'rankings') { ?>
  80.                         <script type="text/javascript" src="./scripts/rankings.js"></script>
  81.                         <script type="text/javascript" src="./scripts/popup_calendar.js"></script>
  82.                 <?php } ?>
  83.         </head>
  84. <?php }
  85.  
  86. /*
  87. The bodyNavigation function outputs the navigation bar for each of the admin pages.
  88. */
  89. function bodyNavigation($page) {
  90.         // If the page is the Login page, automatically focus the cursor to the username box
  91.         if ($page == 'login') {
  92.                 echo '<body onload="document.getElementById(\'loginbox\').focus();">';
  93.         } else {
  94.                 echo '<body>';
  95.         }
  96.         ?>
  97.                 <div id="header">
  98.                         <div class="superHeader">
  99.                                 <div class="right">
  100.                                         <?php if (($page != 'install') && ($page != 'login')) { ?>【<a href="./logout.php">退出管理</a>】<?php } ?>
  101.                                 </div>
  102.                         </div>
  103.                         <div class="midHeader">
  104.                                 <?php if ($page == 'install') { ?>
  105.                                 <h1 class="headerTitle">AdLogger 1.4.0 樂思蜀汉化版 安装程序</h1>
  106.                                 <?php } else { ?>
  107.                                 <h1 class="headerTitle">AdLogger 1.4.0 樂思蜀汉化版 管理中心</h1>
  108.                                 <?php } ?>
  109.                         </div>
  110.                         <div class="subHeader"><?php if ($page != 'install') { ?><span class="doNotDisplay">导航:</span> <a href="./">概览</a> | <a href="./all_clicks.php">所有点击</a> | <a href="./archive.php">历史数据</a> | <a href="./rankings.php">业绩查询</a> | <a href="./block_info.php">阻拦信息</a> | <a href="./code_gen.php">获取代码</a>| <a href="./manage.php">管理</a> | <a href="./support.php">帮助</a><?php if (file_exists("./data_gen.php")) { echo " | <a href=\"./data_gen.php\">Data Generator</a>"; } } ?></div>
  111.  
  112.                         <?php if ($page == 'code_gen') { ?><div class="subsubHeader"><span class="doNotDisplay">导航:</span> <a href="./code_gen.php?tracking">JavaScript跟踪代码</a> | <a href="./code_gen.php?wrapping">PHP封装代码</a> | <a href="./code_gen.php?cache_control">缓存控制代码</a> | </div>
  113.  
  114.                         <?php } elseif ($page == 'settings') { ?><div class="subsubHeader"><span class="doNotDisplay">导航:</span> <a href="./manage.php?settings">系统设置</a> | <a href="./manage.php?channels">频道设置</a> | <a href="./manage.php?logs">日志文件</a> | <a href="./manage.php?accounts">帐户管理</a> | <a href="./manage.php?info">程序信息</a> | </div>
  115.  
  116.                         <?php } ?>
  117.                 </div>
  118. <?php }
  119.  
  120. /*
  121. The bodyFooter function outputs the closing HTML code for each of the admin pages.
  122. */
  123. function bodyFooter($page, $start_time) { ?>
  124.                 <div id="footer">
  125.                         <div class="left">页面执行: <?php echo micro_time($start_time); ?> 秒.<br />AdLogger 1.4.0 樂思蜀汉化版 由<a href="http://www.seobbs.net/" title="SEO论坛 - 搜索引擎优化论坛">SEO论坛</a>站长<a href="http://blog.seobbs.net/" title="SEO博客 - 樂思蜀的SEO博客">樂思蜀</a>在官方原版基础上汉化, 版权归官方所有.</div>
  126.                         <div class="right">Copyright &copy; 2006 <a href="http://www.adlogger.org/index.php/Main_Page" title="AdLogger - Click Fraud Monitoring">AdLogger</a> and <a href="http://www.trevorfitzgerald.com/" title="Trevor Fitzgerald">Trevor Fitzgerald</a>. All rights reserved.<br />AdLogger is provided under the GNU General Public License.</div>
  127.                 </div>
  128.         </body>
  129. </html><?php }
  130.  
  131. // Function to determine an IP address
  132. function visitorIP() {
  133.         if (getenv("REMOTE_ADDR")) {
  134.                 $ip = getenv("REMOTE_ADDR");
  135.         } else {
  136.                 $ip = $_SERVER['REMOTE_ADDR'];
  137.         }
  138.  
  139.         $ip = mysql_real_escape_string(htmlentities($ip));
  140.         return $ip;
  141. }
  142.  
  143. /*
  144. Sometimes URLs are way too long and can screw up a table layout by running over.
  145. This solves that by automatically truncating the middle part of a long URL.
  146. Ex: http://www.abcdefghijklmnopqrstuvwxyz.com can become http://www.abc...xyz.com
  147. It also determines if a value exists for the given URL.
  148. If it's blank, it returns "Unknown".
  149. */
  150. function shortenURL($originalLink) {
  151.         if (strlen($originalLink) > 55) {
  152.                 $shortenlink = substr($originalLink, 0, 18) . '...' . substr($originalLink, -32);
  153.                 return '<a href = "http://' . $originalLink . '" title = "' . $originalLink . '" target="_blank">' . $shortenlink . '</a>';
  154.         } elseif (empty($originalLink)) {
  155.                 $shortenlink = "<em>Unknown</em>";
  156.                 return $shortenlink;
  157.         } else {
  158.                 return '<a href = "http://' . $originalLink . '" title = "' . $originalLink . '" target="_blank">' . $originalLink . '</a>';
  159.         }
  160. }
  161.  
  162. /*
  163. If a value is empty, have it say "N/A" rather than leaving it blank.
  164. */
  165. function unset_if_string_empty($originalString) {
  166.         if (!empty($originalString)) {
  167.                 return $originalString;
  168.         } else {
  169.                 return "<em>N/A</em>";
  170.         }
  171. }
  172.  
  173. /*
  174. Verify that a given file is able to be written to via the script.
  175. */
  176. function check_permissions($filename) {
  177.     $chmod = substr(sprintf('%o', fileperms($filename)), -4);
  178.     if ((!is_writable($filename)) || (substr($chmod,2) == "44")) {
  179.         return true;
  180.     }
  181. }
  182.  
  183. /*
  184. This is used on the Settings page.  If config_settings.php isn't writable,
  185. don't let the user edit any of the field values.
  186. */
  187. function disable_if_not_writable() {
  188.         if (check_permissions('../config_settings.php')) {
  189.                 echo 'disabled="disabled" ';
  190.         }
  191. }
  192.  
  193. /*
  194.  * Automatically select a certain item from the dropdown if
  195.  * it's supposed to be selected.
  196.  */
  197. function select_item_if_chosen($item, $chosen) {
  198.         if ($item == $chosen) {
  199.                 echo 'selected="selected"';
  200.         }
  201. }
  202.  
  203. /*
  204. Verify that a connection to the database has been made.
  205. If it hasn't, produce an error.
  206. */
  207. function check_db_connection($adlogger_db_connect, $adlogger_db_select) {
  208.         if (!$adlogger_db_connect) {
  209.                 echo "<div id=\"main-copy\">" .
  210.                                 "<h1>Error!</h1>" .
  211.                                 "<p>AdLogger can't seem to connect to the database. This could be caused by one of two things:</p>" .
  212.                                 "<ul>" .
  213.                                         "<li>The database server is down.</li>" .
  214.                                         "<li>The database credentials changed (username/password/priveleges)</li>" .
  215.                                 "</ul>" .
  216.                         "</div>";
  217.                 bodyFooter('error', $start_time);
  218.                 exit();
  219.         } elseif (!$adlogger_db_select) {
  220.                 echo "<div id=\"main-copy\">" .
  221.                                 "<h1>Error!</h1>" .
  222.                                 "<p>AdLogger can't seem to select the proper database. It can connect to the database server just fine, but can't access the AdLogger database.</p>" .
  223.                                 "<ul>" .
  224.                                         "<li>Does the database still exist?</li>" .
  225.                                 "</ul>" .
  226.                         "</div>";
  227.                 bodyFooter('error', $start_time);
  228.                 exit();
  229.         }
  230. }
  231.  
  232. /*
  233. Validate that a given IP address is actually valid.
  234. */
  235. function valid_ip($ip) {
  236.         $ip = explode(".", $ip);
  237.                 if (count($ip)!= 4) {
  238.                         return false;
  239.                 }
  240.                 foreach ($ip as $block) {
  241.                         if (!is_numeric($block) || $block > 255 || $block < 1) {
  242.                                 return false;
  243.                         }
  244.                 }
  245.         return true;
  246. }
  247.  
  248. /*
  249. Validate that an IP entered in the banned list is valid
  250. as either an IP address or IP range.
  251. */
  252. function valid_ip_range($ip) {
  253.         if (empty($ip)) {
  254.                 return true;
  255.         }
  256.         $ip_parts = explode(".", $ip);
  257.                 if (empty($ip_parts[0])) {
  258.                         return false;
  259.                 }
  260.                 if (count($ip_parts) > 4) {
  261.                         return false;
  262.                 }
  263.                 foreach ($ip_parts as $block) {
  264.                         if (!empty($block) && (!is_numeric($block) || $block > 255 || $block < 1)) {
  265.                                 return false;
  266.                         }
  267.                 }
  268.         return true;
  269. }
  270.  
  271. /*
  272. Validate an email address to the correct format.
  273. */
  274. function is_valid_email($email) {
  275.   if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
  276.     return false;
  277.   } else {
  278.         return true;
  279.   }
  280. }
  281.  
  282. /*
  283. Create a random string of characters of a given length.
  284. This is used on the Password Reset to create a new password for the administrator.
  285. Also, it's used during the installation to create a "login_hash".  That login hash is
  286. unique to each person's installation of AdLogger.  It's used as the value for "Remember Me"
  287. and the Session.
  288. */
  289. function createRandomString($characters) {
  290.         $chars = "abcdefghijkmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
  291.         srand((double)microtime()*1000000);
  292.         $i = 1;
  293.         $pass = '';
  294.         while ($i <= $characters) {
  295.                 $num = rand() % 56;
  296.                 $tmp = substr($chars, $num, 1);
  297.                 $pass = $pass . $tmp;
  298.                 $i++;
  299.         }
  300.         return $pass;
  301. }
  302.  
  303. /*
  304.  * In an effort to increase my search engine performance,
  305.  * the javascript code generator attaches a random keyword
  306.  * to the copyright notice and the URL inside it.
  307.  */
  308. function adlogger_keywords() {
  309.         $keywords = array("Click Fraud Protection", "Click Auditing", "Click Fraud Detection", "Click Fraud Tracking", "PPC Click Fraud", "Detect Click Fraud", "Click Fraud Monitoring", "Click Fraud", "AdSense Tracking", "AdSense Tracker", "Yahoo Publisher Network Tracker", "Yahoo Publisher Network Tracking", "Click Fraud Tracker", "Prevent Click Fraud");
  310.         $rand_keyword = array_rand($keywords);
  311.         echo $keywords[$rand_keyword];
  312. }
  313.  
  314. /*
  315.  * Convert bytes to something more useable.
  316.  * Used on the Settings page when displaying the database size.
  317.  */
  318. function convert_bytes($db_size_bytes = 0) {
  319.  
  320.         if ($db_size_bytes > 1073741824 ) {
  321.                 $db_size = round($db_size_bytes/1073741824,1) . ' GB';
  322.         } elseif ($db_size_bytes > 1048576 ) {
  323.                 $db_size = round($db_size_bytes/1048576,1) . ' MB';
  324.         } elseif ($db_size_bytes > 1024 ) {
  325.                 $db_size = round($db_size_bytes/1024,1) . ' KB';
  326.         } elseif ($db_size_bytes >= 0 ) {
  327.                 $db_size = $db_size_bytes . ' Bytes';
  328.         }
  329.  
  330.         return $db_size;
  331. }
  332.  
  333. /*
  334.  * Calcuate the time for a given timezone.
  335.  * Used on the Settings page in the timezone dropdown to
  336.  * make it easier to figure out your timezone.
  337.  */
  338. function time_change($dif) {
  339.         $time = date('g:i a, m/j/y', time()+(60*60*$dif));
  340.         echo $time;
  341. }
  342.  
  343. /*
  344.  * Convert the hour from the 24 hour scale to the 12 for the rankings page
  345.  */
  346. function convertHour($hour) {
  347.         return date('ga', mktime($hour, 0, 0, 10, 25, 1986));
  348. }
  349.  
  350. /*
  351.  * This converts the AdSense ad format into something we can use.
  352.  */
  353. function convertAdFormat($ad_format, $side) {
  354.         $dimensions = explode('x', $ad_format);
  355.         if ($side == 'width') {
  356.                 $ad_width = $dimensions[0];
  357.                 return $ad_width;
  358.         } elseif ($side == 'height') {
  359.                 $ad_height = explode('_', $dimensions[1]);
  360.                 $ad_height = $ad_height[0];
  361.                 return $ad_height;
  362.         }
  363. }
  364.  
  365. /*
  366.  * Tells what type of ad was clicked (ad or link unit)
  367.  */
  368. function translateAdFormat($ad_format) {
  369.         if (strstr($ad_format, '_as')) {
  370.                 return 'Ad Unit';
  371.         } elseif (strstr($ad_format, '_0ads_al_s')) {
  372.                 return 'Link Unit (5x)';
  373.         } elseif (strstr($ad_format, '_0ads_al')) {
  374.                 return 'Link Unit (4x)';
  375.         } else {
  376.                 return '<em>Unknown Format</em>';
  377.         }
  378. }
  379.  
  380. /*
  381.  * Determine if the script should try to draw the color.
  382.  * If it should, go ahead and draw it.
  383.  */
  384. function draw_color($hex, $gd_enabled) {
  385.         if ($gd_enabled && !empty($hex)) {
  386.                 return '<br /><img src="./draw_color.php?hex=' . $hex . '" alt="' . $hex . ' " border="0" />';
  387.         }
  388. }
  389.  
  390. // Convert seconds to minutes
  391. function seconds2minutes($seconds) {
  392.         $minutes = intval($seconds / 60);
  393.                 if ($minutes == 1) {
  394.                         $output = $minutes . " min ";
  395.                 } else {
  396.                         $output = $minutes . " mins ";
  397.                 }
  398.         $seconds = $seconds % 60;
  399.                 if ($seconds == 1) {
  400.                         $output .= $seconds . " sec ";
  401.                 } else {
  402.                         $output .= $seconds . " secs ";
  403.                 }
  404.         return $output;
  405. }
  406. ?>
downloadfunctions.php Source code - Download Vehicle AdLogger v1.4.0 shu han edition Source code
Related Source Codes/Software:
Flash voting system v1.2 - Modify the localization program abroad 2016-09-05
HpAdsNew v2.09 pr1 CMSware localization version - Can use it to build DoubleClick that third-party a... 2016-09-05
The Advanced Poll v2.08 multilingual version - Can set up multiple support voting procedures, can... 2016-09-05
Search (PHP edition v1.0 voting system - Search (PHP edition V1.0 voting system functions a... 2016-09-05
PHP character images online voting system v1.0.1 - The tripod with two handles peak network voting sy... 2016-09-04
Openads v2.0.11 multilingual version - A banner AD using PHP development management and t... 2016-09-05
Angel Upload Manager v1.0 - Ablog author works. Many friends asked me to, I wi... 2016-09-05
Good mood multi-user v1.1 news system - Function description: 2016-09-05
V2.0 prodigal news system - 1, article categories: unlimited categories, and i... 2016-09-05
PHPNovelС˵ϵͳv4.0.6 - PHPNovel is a set of using PHP + mysql database op... 2016-09-05
mockery - Mockery is a simple yet flexible PHP mock object f... 2017-03-31
redisson - Redisson - distributed Java objects and services (... 2017-03-31
flow.js - A JavaScript library providing multiple simultaneo... 2017-03-31
Google-Maps-for-Rails - Enables easy Google map + overlays creation in Rub... 2017-03-31
DCIntrospect - Small library of visual debugging tools for iOS. 2017-03-31
Mining-the-Social-Web-2nd-Edition - The official online compendium for Mining the Soci... 2017-03-31
TensorFlow-Book - Accompanying source code for Machine Learning with... 2017-03-31
js-interview-review - The JS interview review. As I'm reviewing several ... 2017-03-31
script.js - Asyncronous JavaScript loader and dependency manag... 2017-03-31
dex-method-counts - Command-line tool to count per-package methods in ... 2017-03-31

 Back to top