BVB Source Codes

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

Return Download Vehicle AdLogger v1.4.0 shu han edition: download manage_action.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. // Include the configuration files.
  29. require ("../config_database.php");
  30. require ("../config_settings.php");
  31. require ("../config_admin.php");
  32.  
  33. // Make sure the person is logged in.
  34. require ("./loginverify.php");
  35.  
  36. /*
  37.  * Include the functions.
  38. */
  39. require ("./functions.php");
  40.  
  41. $ref = $_GET['ref'];
  42. $go = $_GET['go'];
  43.  
  44. $start_time = micro_time(0);
  45.  
  46. /*
  47.  * Add a channel
  48.  */
  49. if ($go == 'addchannel') {
  50.  
  51.         $chan_name = mysql_real_escape_string(trim($_POST['chan_name']));
  52.         $chan_desc = mysql_real_escape_string(trim($_POST['chan_desc']));
  53.  
  54.         if (strlen($chan_name) > 50) {
  55.                         bodyHeader('error', $version_num);
  56.                         bodyNavigation('error');
  57.                         echo '<div id="main-copy">' .
  58.                                         '<h1>Error!</h1>' .
  59.                                         '<p>The channel name you specified exceeds the maximum allowed characters of 50.</p>' .
  60.                                         '<p>Please go back and try again.</p>' .
  61.                                 '</div>';
  62.                         bodyFooter('error', $start_time);
  63.                         exit();
  64.         }
  65.         if (strlen($chan_desc) > 250) {
  66.                         bodyHeader('error', $version_num);
  67.                         bodyNavigation('error');
  68.                         echo '<div id="main-copy">' .
  69.                                         '<h1>Error!</h1>' .
  70.                                         '<p>The channel name you specified exceeds the maximum allowed characters of 250.</p>' .
  71.                                         '<p>Please go back and try again.</p>' .
  72.                                 '</div>';
  73.                         bodyFooter('error', $start_time);
  74.                         exit();
  75.         }
  76.  
  77.         if (empty($chan_name)) {
  78.                         bodyHeader('error', $version_num);
  79.                         bodyNavigation('error');
  80.                         echo '<div id="main-copy">' .
  81.                                         '<h1>Error!</h1>' .
  82.                                         '<p>You must enter a channel name.</p>' .
  83.                                         '<p>Please go back and try again.</p>' .
  84.                                 '</div>';
  85.                         bodyFooter('error', $start_time);
  86.                         exit();
  87.         }
  88.  
  89.         mysql_query("INSERT INTO " . $db_table_prefix . "channels
  90.                 SET
  91.                 chan_name='$chan_name',
  92.                 chan_desc='$chan_desc'
  93.         ")
  94.         or die(mysql_error());
  95.         $_SESSION['changesuccess'] = "The channel, " . stripslashes(trim($_POST['chan_name'])) . ", has been added successfully.";
  96.  
  97. /*
  98.  * Delete a channel
  99.  */
  100. } elseif ($go == 'dropchannel') {
  101.  
  102.         $channel_id = mysql_real_escape_string($_GET['id']);
  103.  
  104.         if (empty($channel_id)) {
  105.                
  106.                 bodyHeader('error', $version_num);
  107.                 bodyNavigation('error');
  108.                 echo '<div id="main-copy">' .
  109.                                 '<h1>Error!</h1>' .
  110.                                 '<p>No channel id was specified for deletion.</p>' .
  111.                                 '<p>Please go back and try again.</p>' .
  112.                         '</div>';
  113.                 bodyFooter('error', $start_time);
  114.                 exit();
  115.         }
  116.  
  117.         mysql_query("DELETE FROM " . $db_table_prefix . "channels WHERE id = '$channel_id'")
  118.         or die(mysql_error());
  119.         $_SESSION['changesuccess'] = "Your channel has been deleted successfully.";
  120.  
  121. /*
  122.  * Change the admin username and password
  123.  */
  124. } elseif ($go == 'userpass') {
  125.  
  126.         $user = mysql_real_escape_string($_POST['user']);
  127.         $password1 = mysql_real_escape_string($_POST['password1']);
  128.         $password2 = mysql_real_escape_string($_POST['password2']);
  129.  
  130.         if ((empty($user)) || (empty($password1)) || (empty($password2))) {
  131.                        
  132.                         bodyHeader('error', $version_num);
  133.                         bodyNavigation('error');
  134.                         echo '<div id="main-copy">' .
  135.                                         '<h1>Error!</h1>' .
  136.                                         '<p>Please fill out all fields.</p>' .
  137.                                         '<ul>' .
  138.                                                 '<li>Username</li>' .
  139.                                                 '<li>Password</li>' .
  140.                                                 '<li>Password Confirmation</li>' .
  141.                                         '</ul>' .
  142.                                         '<p>Please go back and try again.</p>' .
  143.                                 '</div>';
  144.                         bodyFooter('error', $start_time);
  145.                         exit();
  146.         }
  147.  
  148.         if (!empty($user) && !empty($password1) && !empty($password2)) {
  149.                 if ($password1 != $password2) {
  150.                        
  151.                         bodyHeader('error', $version_num);
  152.                         bodyNavigation('error');
  153.                         echo '<div id="main-copy">' .
  154.                                         '<h1>Error!</h1>' .
  155.                                         '<p>Your password and password confirmation do not match.</p>' .
  156.                                         '<p>Please go back and try again.</p>' .
  157.                                 '</div>';
  158.                         bodyFooter('error', $start_time);
  159.                         exit();
  160.                 }
  161.  
  162.                 // Verify that the password is at least 6 characters long.
  163.                 if (strlen($password1) < 6) {
  164.                        
  165.                         bodyHeader('error', $version_num);
  166.                         bodyNavigation('error');
  167.                         echo '<div id="main-copy">' .
  168.                                         '<h1>Error!</h1>' .
  169.                                         '<p>Your password should be at least 6 characters in length.</p>' .
  170.                                         '<p>Please go back and try again.</p>' .
  171.                                 '</div>';
  172.                         bodyFooter('error', $start_time);
  173.                         exit();
  174.                 }
  175.  
  176.                 $password_hash = sha1($password1);
  177.                 mysql_query("UPDATE " . $db_table_prefix . "users SET
  178.                 username = '$user',
  179.                 password = '$password_hash'
  180.                 ")
  181.                 or die(mysql_error());
  182.                 $_SESSION['changesuccess'] = "Your username/password has been changed successfully.";
  183.         } else {
  184.                
  185.                 bodyHeader('error', $version_num);
  186.                 bodyNavigation('error');
  187.                 echo '<div id="main-copy">' .
  188.                                 '<h1>Error!</h1>' .
  189.                                 '<p>Unable to change username or password. Please enter all fields.</p>' .
  190.                                 '<p>Please go back and try again.</p>' .
  191.                         '</div>';
  192.                 bodyFooter('error', $start_time);
  193.                 exit();
  194.         }
  195.  
  196. /*
  197.  * Change any of the configuration settings.
  198.  */
  199. } elseif ($go == 'changesettings') {
  200.  
  201. $email = $_POST['email'];
  202. $email_confirm = $_POST['email_confirm'];
  203. $emailnotice = $_POST['emailnotice'];
  204. $emailalert = $_POST['emailalert'];
  205. $emailalert_num = $_POST['emailalert_num'];
  206. $clickmax = $_POST['clickmax'];
  207. $clickmaxtime = $_POST['clickmaxtime'];
  208. $gmtdifference = $_POST['timezone'];
  209. $ip_db_check = $_POST['ip_db_check'];
  210. $version_num = $_POST['version_num'];
  211. $disable_all_ads = $_POST['disable_all_ads'];
  212.  
  213. /*
  214.  * Go through each of the posted banned ips
  215.  * and turn them into an valid array.
  216.  */
  217. $bannedips = trim($_POST['bannedips']);
  218. $bannedips = preg_split('/[\\s]+/', $bannedips);
  219. $bannedstring = '';
  220. foreach($bannedips as $i => $ip) {
  221.         if ($i != 0) {
  222.                 $bannedstring .= ",\n";
  223.         }
  224.         /*
  225.          * Make sure that each of the IP validates
  226.          * as either an IP address or range.
  227.          */
  228.         if (!valid_ip_range($ip)) {
  229.                 bodyHeader('error', $version_num);
  230.                 bodyNavigation('error');
  231.                 echo '<div id="main-copy">' .
  232.                                 '<h1>Error!</h1>' .
  233.                                 '<p><span class="loginMessage">' . $ip . '</span> is not a valid IP address/range.</p>' .
  234.                                 '<p>Please verify that the following conditions are met.</p>' .
  235.                                 '<ul>' .
  236.                                         '<li>Only one IP address per line.</li>' .
  237.                                         '<li>IP can\'t start with a dot. (Ex: .157)</li>' .
  238.                                         '<li>No more than 4 parts to an IP. (Ex: 24.56.208.13.42 is NOT a valid IP).</li>' .
  239.                                         '<li>No part of an IP can be above \'255\'.</li>' .
  240.                                         '<li>No part of an IP can be below \'1\'.</li>' .
  241.                                         '<li>The only allowed characters are numbers (0-9) and periods (.).</li>' .
  242.                                 '</ul>' .
  243.                                 '<p>Please check the format and try again.</p>' .
  244.                         '</div>';
  245.                 bodyFooter('error', $start_time);
  246.                 exit();
  247.         } else {
  248.                 $bannedstring .= "\"$ip\"";
  249.         }
  250. }
  251.  
  252. /*
  253.  * Make sure that the user entered an email address.
  254.  */
  255. if (empty($email)) {
  256.         bodyHeader('error', $version_num);
  257.         bodyNavigation('error');
  258.         echo '<div id="main-copy">' .
  259.                         '<h1>Error!</h1>' .
  260.                         '<p>Please enter an email address.</p>' .
  261.                         '<p>Please go back and try again.</p>' .
  262.                 '</div>';
  263.         bodyFooter('error', $start_time);
  264.         exit();
  265. }
  266.  
  267. /*
  268.  * Make sure that the two email addresses match.
  269.  */
  270. if ($email != $email_confirm) {
  271.         bodyHeader('error', $version_num);
  272.         bodyNavigation('error');
  273.         echo '<div id="main-copy">' .
  274.                         '<h1>Error!</h1>' .
  275.                         '<p>The email address and confirmation email address must match.</p>' .
  276.                         '<p>Please go back and try again.</p>' .
  277.                 '</div>';
  278.         bodyFooter('error', $start_time);
  279.         exit();
  280. }
  281.  
  282. /*
  283.  * Make sure that the email address is valid.
  284.  */
  285. if (!is_valid_email("$email")) {
  286.         bodyHeader('error', $version_num);
  287.         bodyNavigation('error');
  288.         echo '<div id="main-copy">' .
  289.                         '<h1>Error!</h1>' .
  290.                         '<p>The email address you entered is not a valid format.</p>' .
  291.                         '<p>Please go back and try again.</p>' .
  292.                 '</div>';
  293.         bodyFooter('error', $start_time);
  294.         exit();
  295. }
  296.  
  297. // Make sure that clickmax, clickmaxtime, and emailalert_num are numerical
  298. if ((!empty($clickmax) && !is_numeric($clickmax)) || (!empty($clickmaxtime) && !is_numeric($clickmaxtime)) || (!empty($emailalert_num) && !is_numeric($emailalert_num))) {
  299.         bodyHeader('error', $version_num);
  300.         bodyNavigation('error');
  301.         echo '<div id="main-copy">' .
  302.                         '<h1>Error!</h1>' .
  303.                         '<p>There is an invalid entry for one or more of the settings. The maximum click values and email alert number must be numeric.</p>' .
  304.                         '<p>Please go back and try again.</p>' .
  305.                 '</div>';
  306.         bodyFooter('error', $start_time);
  307.         exit();
  308. }
  309.  
  310. if (!isset($gmt_dif) || empty($gmt_dif)){
  311.         $gmt_dif = 0;
  312. }
  313. if (empty($clickmax)) $clickmax = 99;
  314. if (empty($clickmaxtime)) $clickmaxtime = 1;
  315. if (empty($emailalert_num)) $emailalert_num = 5;
  316.  
  317. /*
  318.  * Begin adding variables to config_settings.php
  319.  */
  320. $open_file = fopen("../config_settings.php", "w");
  321.  
  322. /*
  323.  * If the script can not open the file,
  324.  * produce an error.
  325.  */
  326. if (!$open_file) {
  327.         bodyHeader('error', $version_num);
  328.         bodyNavigation('error');
  329.         echo '<div id="main-copy">' .
  330.                         '<h1>Error!</h1>' .
  331.                         '<p>The file, config_settings.php, was unable to be opened. Verify that permissions are set to 666.</p>' .
  332.                         '<p>Please go back and try again.</p>' .
  333.                 '</div>';
  334.         bodyFooter('error', $start_time);
  335.         exit();
  336. }
  337.  
  338. /*
  339.  * Declare the contents of the file
  340.  */
  341. $file_contents = <<<EOD
  342. <?php
  343. /*
  344.  * You can change these on the Settings page inside your Administration panel.
  345.  */
  346.  
  347. \$email = "$email";
  348.  
  349. \$email_notice = $emailnotice;
  350.  
  351. \$email_alert = $emailalert;
  352.  
  353. \$emailalert_num = $emailalert_num;
  354.  
  355. \$clickmax = $clickmax;
  356.  
  357. \$clickmaxtime = $clickmaxtime * 3600;
  358.  
  359. \$gmt_dif = "$gmtdifference";
  360.  
  361. \$timestamp = time() + 60*60*(\$gmt_dif);
  362.  
  363. \$ip_db_check = $ip_db_check;
  364.  
  365. \$ip_range_ban_list = array(
  366. $bannedstring
  367. );
  368.  
  369. \$disable_all_ads = $disable_all_ads;
  370.  
  371. \$version_num = '$version_num';
  372.  
  373. ?>
  374. EOD;
  375.  
  376. fwrite($open_file, "$file_contents");
  377. fclose($open_file);
  378.  
  379. /*
  380.  * End of writing config_settings.php file.
  381.  */
  382.  
  383. $_SESSION['changesuccess'] = "You have successfully updated your script settings.";
  384.  
  385. /*
  386.  * Delete all logs from the database tables
  387.  */
  388. } elseif ($go == 'drop_all') {
  389.  
  390.         mysql_query("TRUNCATE " . $db_table_prefix . "adcheck_logs")
  391.                 or die(mysql_error());
  392.        
  393.         mysql_query("TRUNCATE " . $db_table_prefix . "blocklogs")
  394.                 or die(mysql_error());
  395.        
  396.         mysql_query("TRUNCATE " . $db_table_prefix . "logfiles")
  397.                 or die(mysql_error());
  398.  
  399.         $_SESSION['changesuccess'] = "You have successfully deleted all of your logs.";
  400.  
  401. /*
  402.  * Delete a single IP from the blocked logs
  403.  */
  404. } elseif ($go == 'dropyourself_block') {
  405.  
  406.         $ip_delete = mysql_real_escape_string($_POST['ip_delete']);
  407.  
  408.         /*
  409.          * Make sure the user actually posted an IP address.
  410.          */
  411.         if (empty($ip_delete)) {
  412.                
  413.                 bodyHeader('error', $version_num);
  414.                 bodyNavigation('error');
  415.                 echo '<div id="main-copy">' .
  416.                                 '<h1>Error!</h1>' .
  417.                                 '<p>Please enter an IP address to delete.</p>' .
  418.                                 '<p>Please go back and try again.</p>' .
  419.                         '</div>';
  420.                 bodyFooter('error', $start_time);
  421.                 exit();
  422.         /*
  423.          * Make sure it is a valid IP address.
  424.          */
  425.         } elseif (!valid_ip($ip_delete)) {
  426.                
  427.                 bodyHeader('error', $version_num);
  428.                 bodyNavigation('error');
  429.                 echo '<div id="main-copy">' .
  430.                                 '<h1>Error!</h1>' .
  431.                                 '<p>Please enter a valid IP address to delete.</p>' .
  432.                                 '<p>Please go back and try again.</p>' .
  433.                         '</div>';
  434.                 bodyFooter('error', $start_time);
  435.                 exit();
  436.         }
  437.  
  438.         /*
  439.          * Go ahead and delete it from the blocked logs.
  440.          */
  441.         mysql_query("DELETE FROM " . $db_table_prefix . "blocklogs WHERE visitor_ip = '$ip_delete'")
  442.         or die(mysql_error());
  443.         $num_rows = number_format(mysql_affected_rows());
  444.         mysql_query("OPTIMIZE TABLE " . $db_table_prefix . "blocklogs");
  445.  
  446.         $_SESSION['changesuccess'] = "You have successfully deleted $num_rows instances of $ip_delete from your block logs.";
  447.  
  448. /*
  449.  * Delete a single IP from the click logs
  450.  */
  451. } elseif ($go == 'dropyourself_all') {
  452.  
  453.         $ip_delete = mysql_real_escape_string($_POST['ip_delete']);
  454.  
  455.         /*
  456.          * Make sure the user actually posted an IP address.
  457.          */
  458.         if (empty($ip_delete)) {
  459.                
  460.                 bodyHeader('error', $version_num);
  461.                 bodyNavigation('error');
  462.                 echo '<div id="main-copy">' .
  463.                                 '<h1>Error!</h1>' .
  464.                                 '<p>Please enter an IP address to delete.</p>' .
  465.                                 '<p>Please go back and try again.</p>' .
  466.                         '</div>';
  467.                 bodyFooter('error', $start_time);
  468.                 exit();
  469.         /*
  470.          * Make sure it is a valid IP address.
  471.          */
  472.         } elseif (!valid_ip($ip_delete)) {
  473.                
  474.                 bodyHeader('error', $version_num);
  475.                 bodyNavigation('error');
  476.                 echo '<div id="main-copy">' .
  477.                                 '<h1>Error!</h1>' .
  478.                                 '<p>Please enter a valid IP address to delete.</p>' .
  479.                                 '<p>Please go back and try again.</p>' .
  480.                         '</div>';
  481.                 bodyFooter('error', $start_time);
  482.                 exit();
  483.         }
  484.  
  485.         /*
  486.          * Go ahead and delete it from the blocked logs.
  487.          */
  488.         mysql_query("DELETE FROM " . $db_table_prefix . "logfiles WHERE visitor_ip = '$ip_delete'")
  489.         or die(mysql_error());
  490.         $num_rows = number_format(mysql_affected_rows());
  491.         mysql_query("OPTIMIZE TABLE " . $db_table_prefix . "logfiles");
  492.        
  493.         $_SESSION['changesuccess'] = "You have successfully deleted $num_rows instances of $ip_delete from your click logs.";
  494.  
  495. } elseif ($go == 'drop_click') {
  496.  
  497.         $click_id = mysql_real_escape_string($_GET['click_id']);
  498.  
  499.         /*
  500.          * Make sure the user actually posted an IP address.
  501.          */
  502.         if (empty($click_id) || !is_numeric($click_id)) {
  503.                 bodyHeader('error', $version_num);
  504.                 bodyNavigation('error');
  505.                 echo '<div id="main-copy">' .
  506.                                 '<h1>Error!</h1>' .
  507.                                 '<p>A click ID was not specified.</p>' .
  508.                                 '<p>Please go back and try again.</p>' .
  509.                         '</div>';
  510.                 bodyFooter('error', $start_time);
  511.                 exit();
  512.         }
  513.  
  514.         /*
  515.          * Go ahead and delete it from the blocked logs.
  516.          */
  517.         mysql_query("DELETE FROM " . $db_table_prefix . "logfiles WHERE id = '$click_id'")
  518.         or die(mysql_error());
  519.         $num_rows = number_format(mysql_affected_rows());
  520.         mysql_query("OPTIMIZE TABLE " . $db_table_prefix . "logfiles");
  521.  
  522.         $ref = './all_clicks.php';
  523.  
  524. /*
  525.  * If no action was specified or the action is invalid,
  526.  * produce an error.
  527.  */
  528. } else {
  529.  
  530.                
  531.                 bodyHeader('error', $version_num);
  532.                 bodyNavigation('error');
  533.                 echo '<div id="main-copy">' .
  534.                                 '<h1>Error!</h1>' .
  535.                                 '<p>No action was specified.</p>' .
  536.                                 '<p>Please go back to the Settings page and try again.</p>' .
  537.                                 '</div>';
  538.                 bodyFooter('error', $start_time);
  539.                 exit();
  540.  
  541. }
  542.  
  543. /*
  544.  * Send the user back to the Settings page with their SESSION message.
  545.  */
  546. header("Location: " . $ref);
  547. exit();
  548. ?>
downloadmanage_action.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