BVB Source Codes

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

Return Download Vehicle AdLogger v1.4.0 shu han edition: download index.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 script's version number.
  30. Anytime the version number is changed, it just has to be edited here.
  31. */
  32. $version_num = '1.4.0';
  33.  
  34.  
  35.  
  36. /* Let's get started! */
  37.  
  38.  
  39. // Report any and all errors that go wrong during this installation
  40. error_reporting(E_ALL);
  41.  
  42. // Declare the functions and start the HTML output
  43. require ("../admin/functions.php");
  44.         $start_time = micro_time(0);
  45.         bodyHeader('install', $version_num);
  46.         bodyNavigation('install');
  47.  
  48. /*
  49. During the installation, there are multiple steps.  The user is passed to the next step
  50. through a POST variable sent from the previous page. This checks what page the user is on.
  51. */
  52. if (isset($_POST['step'])) {
  53.         $current_step = $_POST['step'];
  54. } else {
  55.         $current_step = 1;
  56. }
  57. ?>
  58.  
  59. <div id="installation-progress-bar">
  60.         <div>
  61.                 <p class="sideBarTitle">安装进度</p>
  62.                 <ul>
  63.                         <?php
  64.                         /*
  65.                          * Highlight the step in the sidebar that the user is currently on.
  66.                         */
  67.                         ?>
  68.                         <li<?php if ($current_step == 1) echo " class=\"selected\""; ?>>&rsaquo; 1.程序要求</li>
  69.                         <li<?php if ($current_step == 2) echo " class=\"selected\""; ?>>&rsaquo; 2.程序授权</li>
  70.                         <li<?php if ($current_step == 3) echo " class=\"selected\""; ?>>&rsaquo; 3.服务器信息</li>
  71.                         <li<?php if ($current_step == 4) echo " class=\"selected\""; ?>>&rsaquo; 4.设置信息</li>
  72.                         <li<?php if ($current_step == 5) echo " class=\"selected\""; ?>>&rsaquo; 5.安装完成</li>
  73.                 </ul>
  74.         </div>
  75. </div>
  76.  
  77. <div id="main-copy">
  78.  
  79. <?php
  80. /*
  81. Begin first step
  82. */
  83. if ($current_step == 1) {
  84.  
  85. /*
  86. The $discontinue_install variable is set to true after any of the requirements are not met.
  87. If this value is set to TRUE, the "Continue" button is disabled.
  88. */
  89. $discontinue_install = false;
  90.  
  91. // Try to automatically CHMOD the configuration files to writable status:
  92.         @chmod('../config_admin.php', 0666);
  93.         @chmod('../config_database.php', 0666);
  94.         @chmod('../config_settings.php', 0666);
  95. ?>
  96.  
  97.         <h1>安装概述</h1>
  98.  
  99.         <p>欢迎下载使用AdLogger. 再过几分钟, 您就可以开始使用这个程序了.</p>
  100.         <p>了解更详细的设置信息, 请浏览: <a href="http://www.adlogger.org/index.php/Documentation" title="AdLogger Official Documentation" target="_blank">online documentation</a>.</p>
  101.         <p>安装使用这个程序之前, 请先确定您的PHP环境满足以下要求:</p>
  102.  
  103.         <p><strong>第一步: </strong>CHMOD 配置文件权限为 666. (Windows服务器不需要设置 - 译者注)</p>
  104.         <p><strong>第二步: </strong>在您的控制面板中为AdLogger建立一个数据库. (AdLogger可以与其他程序共用一个数据库, 只要表头不一样 - 译者注)</p>
  105.  
  106.         <h1>验证需求</h1>
  107.         <br />
  108.  
  109.                 <form name="form1" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
  110.                         <fieldset>
  111.                                 <legend>需求情况</legend>
  112.        
  113.                                 <label>config_admin.php 文件可写:</label>
  114.                                                 <?php
  115.                                                         /*
  116.                                                         Check the permissions of the config_admin file.
  117.                                                         It must be writable so that the installation script can write the
  118.                                                         necessary values to it.
  119.                                                         If it's not, don't let the user continue with the installation.
  120.                                                         */
  121.                                                         if (!check_permissions('../config_admin.php')) {
  122.                                                                 echo '<span class="install-OK">成功</span>';
  123.                                                         } else {
  124.                                                                 echo '<span class="install-NotOK">失败</span>';
  125.                                                                 $discontinue_install = true;
  126.                                                         }
  127.                                                 ?>
  128.        
  129.                                 <br /><br />
  130.        
  131.                                 <label>config_database.php 文件可写:</label>
  132.                                                 <?php
  133.                                                         /*
  134.                                                         Check the permissions of the config_database file.
  135.                                                         It must be writable so that the installation script can write the
  136.                                                         necessary values to it.
  137.                                                         If it's not, don't let the user continue with the installation.
  138.                                                         */
  139.                                                         if (!check_permissions('../config_database.php')) {
  140.                                                                 echo '<span class="install-OK">成功</span>';
  141.                                                         } else {
  142.                                                                 echo '<span class="install-NotOK">失败</span>';
  143.                                                                 $discontinue_install = true;
  144.                                                         }
  145.                                                 ?>
  146.  
  147.                                 <br /><br />
  148.  
  149.                                 <label>config_settings.php 文件可写:</label>
  150.                                                 <?php
  151.                                                         /*
  152.                                                         Check the permissions of the config_settings file.
  153.                                                         It must be writable so that the installation script can write the
  154.                                                         necessary values to it.
  155.                                                         If it's not, don't let the user continue with the installation.
  156.                                                         */
  157.                                                         if (!check_permissions('../config_settings.php')) {
  158.                                                                 echo '<span class="install-OK">成功</span>';
  159.                                                         } else {
  160.                                                                 echo '<span class="install-NotOK">失败</span>';
  161.                                                                 $discontinue_install = true;
  162.                                                         }
  163.                                                 ?>
  164.  
  165.                                 <br /><br />
  166.  
  167.                                 <label>PHP GD 环境开启:</label>
  168.                                                 <?php
  169.                                                         /*
  170.                                                         Check if the GD Library is installed.  Needed for displaying
  171.                                                         color attributes of clicked ads.
  172.                                                         */
  173.                                                         if (extension_loaded('gd') && function_exists('gd_info')) {
  174.                                                                 $gd_enabled = 'true';
  175.                                                                 echo '<span class="install-OK">成功</span>';
  176.                                                         } else {
  177.                                                                 $gd_enabled = 'false';
  178.                                                                 echo '<span class="install-Warning">失败</span>';
  179.                                                         }
  180.                                                 ?>
  181.  
  182.                                 <br />
  183.  
  184.                         </fieldset>
  185.  
  186.                         <fieldset>
  187.                                 <legend>继续安装</legend>
  188.  
  189.                                 <input type="hidden" name="gd_enabled" value="<?php echo $gd_enabled; ?>" />
  190.                                 <input name="step" type="hidden" id="step" value="2" />
  191.  
  192.                                 <div align="center">
  193.                                         <?php
  194.                                                 /*
  195.                                                 If the requirements weren't met,
  196.                                                 produce an error and disable the Continue button.
  197.                                                 */
  198.                                                 if ($discontinue_install) { ?>
  199.                                                         <strong>您的主机环境不能满足程序需求, 请确认后再继续安装.</strong>
  200.  
  201.                                                         <br /><br />
  202.  
  203.                                                         请做相应的修改后, 点击 <a href="<?php echo $_SERVER['REQUEST_URI']; ?>">刷新</a> 重新查看支持情况.
  204.  
  205.                                                         <br /><br />
  206.  
  207.                                                         <input type="submit" name="Submit" value="Continue" disabled="disabled" />
  208.                                         <?php } else { ?>
  209.                                                         <input type="submit" name="Submit" value="下一步" />
  210.                                         <?php } ?>
  211.                                 </div>
  212.                         </fieldset>
  213.                 </form>
  214.  
  215. <?php }
  216. // If the user is at step 2, show the license agreement.
  217. elseif ($current_step == 2) {
  218. ?>
  219.  
  220.         <h1>许可协议</h1>
  221.         <p>Please familiarize yourself with the GNU General Public License, under which AdLogger is licensed.</p>
  222.  
  223.         <div id="licenseFrameInstall">
  224.                 <br />
  225.                 <h2 align="center">The GNU General Public License (GPL)</h2>
  226.                 <h3 align="center">Version 2, June 1991</h3>
  227.  
  228.                 <p>Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</p>
  229.                 <p>Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</p>
  230.  
  231.                 <p><strong>Preamble</strong></p>
  232.  
  233.                 <p>The licenses for most software are designed to take away your freedom to share and change it.  By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.  This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it.  (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.)  You can apply it to your programs, too.</p>
  234.                 <p>When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.</p>
  235.                 <p>To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.</p>
  236.                 <p>For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.  You must make sure that they, too, receive or can get the source code.  And you must show them these terms so they know their rights.</p>
  237.                 <p>We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.</p>
  238.                 <p>Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software.  If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.</p>
  239.                 <p>Finally, any free program is threatened constantly by software patents.  We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary.  To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.</p>
  240.                 <p>The precise terms and conditions for copying, distribution and modification follow.</p>
  241.  
  242.                 <p><strong>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</strong></p>
  243.  
  244.                 <p><strong>0</strong>. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License.  The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.  (Hereinafter, translation is included without limitation in the term "modification".)  Each licensee is addressed as "you".</p>
  245.                 <p>Activities other than copying, distribution and modification are not covered by this License; they are outside its scope.  The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.</p>
  246.                 <p><strong>1</strong>. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.</p>
  247.                 <p>You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.</p>
  248.                 <p><strong>2</strong>. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:</p>
  249.                 <blockquote>
  250.                         <p>a) You must cause the modified files to carry prominent notices     stating that you changed the files and the date of any change.</p> <p>b) You must cause any work that you distribute or publish, that in     whole or in part contains or is derived from the Program or any     part thereof, to be licensed as a whole at no charge to all third     parties under the terms of this License.</p> <p>c) If the modified program normally reads commands interactively     when run, you must cause it, when started running for such     interactive use in the most ordinary way, to print or display an     announcement including an appropriate copyright notice and a     notice that there is no warranty (or else, saying that you provide     a warranty) and that users may redistribute the program under     these conditions, and telling the user how to view a copy of this     License.  (Exception: if the Program itself is interactive but     does not normally print such an announcement, your work based on     the Program is not required to print an announcement.)</p>
  251.                 </blockquote>
  252.                 <p>These requirements apply to the modified work as a whole.  If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.  But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.</p>
  253.                 <p>Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.</p>
  254.                 <p>In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.</p>
  255.                 <p><strong>3</strong>. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:</p>
  256.                 <blockquote>
  257.                         <p>a) Accompany it with the complete corresponding machine-readable     source code, which must be distributed under the terms of Sections     1 and 2 above on a medium customarily used for software interchange; or,</p> <p>b) Accompany it with a written offer, valid for at least three     years, to give any third party, for a charge no more than your     cost of physically performing source distribution, a complete     machine-readable copy of the corresponding source code, to be     distributed under the terms of Sections 1 and 2 above on a medium     customarily used for software interchange; or,</p> <p>c) Accompany it with the information you received as to the offer     to distribute corresponding source code.  (This alternative is     allowed only for noncommercial distribution and only if you     received the program in object code or executable form with such     an offer, in accord with Subsection b above.)</p>
  258.                 </blockquote>
  259.                 <p>The source code for a work means the preferred form of the work for making modifications to it.  For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable.  However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.</p>
  260.                 <p>If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.</p>
  261.                 <p><strong>4</strong>. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License.  Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.</p>
  262.                 <p><strong>5</strong>. You are not required to accept this License, since you have not signed it.  However, nothing else grants you permission to modify or distribute the Program or its derivative works.  These actions are prohibited by law if you do not accept this License.  Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.</p>
  263.                 <p><strong>6</strong>. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.  You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.</p>
  264.                 <p><strong>7</strong>. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License.  If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all.  For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.</p>
  265.                 <p>If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.</p>
  266.                 <p>It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices.  Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.</p>
  267.                 <p>This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.</p>
  268.                 <p><strong>8</strong>. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded.  In such case, this License incorporates the limitation as if written in the body of this License.</p>
  269.                 <p><strong>9</strong>. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time.  Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</p>
  270.                 <p>Each version is given a distinguishing version number.  If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation.  If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.</p>
  271.                 <p><strong>10</strong>. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.  For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this.  Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.</p>
  272.                 <p><strong>NO WARRANTY</strong></p>
  273.                 <p><strong>11</strong>. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
  274.                 <p><strong>12</strong>. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
  275.  
  276.                 <h3 align="center">END OF TERMS AND CONDITIONS</h3>
  277.  
  278.         </div>
  279.  
  280.         <br />
  281.  
  282.         <form name="install_license_agreement" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" onsubmit="return validate_license_agreement(this);">
  283.                
  284.                 <fieldset>
  285.                         <legend>继续安装</legend>
  286.                        
  287.                         <div align="center">
  288.                                 <input type="checkbox" name="agree_license_terms_check" />
  289.                                 我已经阅读并接受此公共许可协议.
  290.                                 <br />
  291.                                 <input name="step" type="hidden" id="step" value="3" />
  292.                                 <input type="hidden" name="gd_enabled" value="<?php echo $_POST['gd_enabled']; ?>" />
  293.                                 <input type="submit" name="Submit" value="下一步" />
  294.                         </div>
  295.                        
  296.                 </fieldset>
  297.  
  298.         </form>
  299.  
  300.  
  301.  
  302.  
  303. <?php }
  304. // If the user is at step 3, perform this code
  305. elseif ($current_step == 3) {
  306.  
  307. /*
  308. Check to make sure they agreed to the terms and conditions of the license.
  309. If they didn't, produce an error and direct them back to the previous page.
  310. */
  311. if (empty($_POST['agree_license_terms_check'])) { ?>
  312.         <h1>错误!</h1>
  313.         <p>您必须接受此条款才能继续安装.</p>
  314.         </div>
  315. <?php bodyFooter('error', $start_time); exit(); }
  316.  
  317. /*
  318. Now, have the user input all his server information.
  319. Database info and absolute location of the AdLogger directory.
  320. */
  321. ?>
  322.         <h1>服务器信息</h1>
  323.         <p>请填写您的 MySQL 服务信息.</p>
  324.  
  325.                 <form name="install_step_2" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" onsubmit="return validate_step_2(this);">
  326.                         <fieldset>
  327.                                 <legend>数据服务器信息</legend>
  328.                                 <label for="db_host"><strong>数据库服务器: </strong></label>
  329.                                 <input name="db_host" type="text" id="db_host" value="localhost" size="50" />
  330.                                 <br />
  331.                                 <label>默认为本地服务器 'localhost'.</label>
  332.                                 <br />
  333.                                 <br />
  334.                                
  335.                                 <label for="db_port"><strong>服务器端口: </strong></label>
  336.                                 <input name="db_port" type="text" id="db_port" value="3306" size="50" />
  337.                                 <br />
  338.                                 <label>默认为3306端口 (原版中为3307)</label>
  339.                                 <br />
  340.                         </fieldset>
  341.  
  342.                         <br />
  343.  
  344.                         <fieldset>
  345.                                 <legend>数据库信息</legend>
  346.                                 <label for="db_name"><strong>数据库名: </strong></label>
  347.                                 <input name="db_name" type="text" id="db_name" size="50" />
  348.                                 <br />
  349.                                 <label>AdLogger 安装到哪个 MySQL 数据库中</label>
  350.                                 <br />
  351.                                 <br />
  352.                                
  353.                                 <label for="db_user"><strong>用户名: </strong></label>
  354.                                 <input name="db_user" type="text" id="db_user" size="50" />
  355.                                 <br />
  356.                                 <label>您的 MySQL 数据库用户名</label>
  357.                                 <br />
  358.                                 <br />
  359.                                
  360.                                 <label for="db_pass"><strong>密码: </strong></label>
  361.                                 <input name="db_pass" type="password" id="db_pass" size="50" />
  362.                                 <br />
  363.                                 <label>您的 MySQL 数据库权限密码</label>
  364.                                 <br />
  365.                                 <br />
  366.                                
  367.                                 <label for="db_table_prefix"><strong>表头: </strong></label>
  368.                                 <input name="db_table_prefix" type="text" id="db_table_prefix" value="adlogger_" size="50" />
  369.                                 <br />
  370.                                 <label>AdLogger 数据表在数据库中的表头</label>
  371.                                 <br />
  372.                         </fieldset>
  373.  
  374.                         <br />
  375.  
  376.                         <fieldset>
  377.                                 <legend>AdLogger 位置信息</legend>
  378.                                 <p align="center">这里安装程序会自动检查, 一般不需要修改.</p>
  379.                                 <label for="siteurl"><strong>网站地址: </strong></label>
  380.                                 <input name="siteurl" type="text" id="siteurl" value="<?php echo "http://" . $_SERVER['SERVER_NAME']; ?>" size="50" />
  381.                                 <br />
  382.                                 <label>AdLogger 安装在哪个网站下</label>
  383.                                 <br />
  384.                                 <br />
  385.  
  386.                                 <label for="adlogger_loc"><strong>AdLogger 目录: </strong></label>
  387.                                 <input name="adlogger_loc" type="text" id="adlogger_loc" value="<?php echo preg_replace("/\/install\/[index\.php]*/", '', $_SERVER['PHP_SELF']); ?>" size="50" />
  388.                                 <br />
  389.                                 <label>AdLogger 所在目录</label>
  390.                                 <br />
  391.                                 <br />
  392.  
  393.                                 <label for="adlogger_doc_path"><strong>AdLogger 文件路径: </strong></label>
  394.                                 <input name="adlogger_doc_path" type="text" id="adlogger_doc_path" value="<?php echo preg_replace("/\/install\/[index\.php]*/", '', __FILE__); ?>" size="50" />
  395.                                 <br />
  396.                                 <label>AdLogger 文件所在绝对路径</label>
  397.                                 <br />
  398.                         </fieldset>
  399.  
  400.                         <br />
  401.                        
  402.                         <fieldset>
  403.                                 <legend>继续安装</legend>
  404.                                 <label for="submit">&nbsp;</label>
  405.                                 <input name="step" type="hidden" id="step" value="4" />
  406.                                 <input type="hidden" name="gd_enabled" value="<?php echo $_POST['gd_enabled']; ?>" />
  407.                                 <input type="submit" name="Submit" value="下一步" />
  408.                         </fieldset>
  409.  
  410.                 </form>
  411.  
  412. <?php }
  413. /*
  414. If the user is at step 4, perform this code.
  415. In step 4, it creates two files: config_database.php and config_admin.php
  416. And it sets up the tables in the database
  417. */
  418. elseif ($current_step == 4) {
  419.  
  420. // Get and declare all the variables that have been posted from the previous step
  421. $db_host = $_POST['db_host'];
  422. $db_port = $_POST['db_port'];
  423. $db_user = $_POST['db_user'];
  424. $db_pass = $_POST['db_pass'];
  425. $db_name = $_POST['db_name'];
  426. $db_table_prefix = $_POST['db_table_prefix'];
  427. $siteurl = $_POST['siteurl'];
  428. $adlogger_loc = $_POST['adlogger_loc'];
  429. $adlogger_doc_path = $_POST['adlogger_doc_path'];
  430.  
  431. $gd_enabled = $_POST['gd_enabled'];
  432.  
  433. /*
  434. Even though we told the user not to add a trailing slash to any of the location variables,
  435. let's go ahead and double check, just to make sure they were listening.
  436. */
  437. if ((preg_match("/\/\z/", $siteurl)) || (preg_match("/\/\z/", $adlogger_loc)) || (preg_match("/\/\z/", $adlogger_doc_path))) { ?>
  438.         <h1>错误!</h1>
  439.         <p>位置信息不正确, 这可能导致程序不能发挥作用! 请检查以下信息并修正后继续:</p>
  440.         <p>例如: <strong>http://www.adlogger.org/</strong> 是无效的, 有效形式为 <strong>http://www.adlogger.org</strong>
  441.         <ul>
  442.                 <li>网站地址</li>
  443.                 <li>AdLogger 目录</li>
  444.                 <li>AdLogger 文件位置</li>
  445.         </ul>
  446.         <p>以上信息程序会自动完成, 建议不要进行修改. 点击后退按钮重试.</p>
  447.         </div>
  448. <?php bodyFooter('error', $start_time); exit(); }
  449.  
  450. // If the user left the database hostname entry empty, use the default "localhost"
  451. if (empty($db_host)) {
  452.         $db_host = 'localhost';
  453. }
  454.  
  455. // If the user left the database table prefix empty, use "adlogger_"
  456. if (empty($db_table_prefix)) {
  457.         $db_table_prefix = 'adlogger_';
  458. }
  459.  
  460. /*
  461. If the user specified a port OTHER than the default "3307",
  462. add it to the hostname so the script can connect to it.
  463. If it is left at 3307, it's not needed, so you can forget about it.
  464. */
  465. if ($db_port != '3307') {
  466.         $db_host = $db_host . ":" . $db_port;
  467. }
  468.  
  469. /*
  470. Before actually saving the connection info, let's do a test.
  471. This will test a database connection using the given hostname, port, username, and password.
  472. If it can't connect, it produces an error and directs them to the previous page.
  473. */
  474. $test_mysql_connection = @mysql_connect("$db_host", "$db_user", "$db_pass");
  475. if (!$test_mysql_connection) { ?>
  476.         <h1>错误!</h1>
  477.         <p>您填写的数据库信息无法正常连接, 可能存在以下错误, 请检查:</p>
  478.         <ul>
  479.                 <li>数据库服务器地址或端口错误</li>
  480.                 <li>数据库名或用户名错误</li>
  481.                 <li>用户密码错误</li>
  482.         </ul>
  483.         <p>请点击后退按钮返回重试.</p>
  484.         </div>
  485. <?php bodyFooter('error', $start_time); exit(); }
  486.  
  487. /*
  488. Again, before actually trying to put data in the database, let's do another test.
  489. This will test accessing the given database table.
  490. If it can't select the database, it produces an error and direct them to the previous page.
  491. */
  492. $test_mysql_db_selection = @mysql_select_db("$db_name");
  493. if (!$test_mysql_db_selection) { ?>
  494.         <h1>错误!</h1>
  495.         <p>您填写的数据库信息不正确, 可能存在以下两个原因:</p>
  496.         <ul>
  497.                 <li>数据库名错误</li>
  498.                 <li>用户没有操作此数据库的权限</li>
  499.         </ul>
  500.         <p>请点击后退按钮返回重试.</p>
  501.         </div>
  502. <?php bodyFooter('error', $start_time); exit(); }
  503.  
  504. ### First, let's write the first file: config_database.php
  505. /*
  506. Let's test to make sure we can actually open up config_database.php in order to add values to it.
  507. If not, produce an error.
  508. */
  509. $open_file = @fopen("../config_database.php", "w");
  510.         if (!$open_file) { ?>
  511.                 <h1>错误!</h1>
  512.                 <p>无法正常访问 config_database.php 文件, 请检查后重试.</p>
  513.                 <p>请点击后退按钮返回重试.</p>
  514.                 </div>
  515.         <?php bodyFooter('error', $start_time); exit(); }
  516.  
  517. /*
  518. Declare what the contents of config_database.php will be.
  519. This includes all the data that was passed from the previous page.
  520. */
  521. $file_contents = <<<EOD
  522. <?php
  523. \$db_host = "$db_host";
  524. \$db_user = "$db_user";
  525. \$db_pass = "$db_pass";
  526. \$db_name = "$db_name";
  527. \$db_table_prefix = "$db_table_prefix";
  528.  
  529. \$adlogger_db_connect = mysql_connect("\$db_host", "\$db_user", "\$db_pass");
  530. \$adlogger_db_select = mysql_select_db("\$db_name");
  531.  
  532. \$siteurl = "$siteurl";
  533. \$adlogger_loc = "$adlogger_loc";
  534. ?>
  535. EOD;
  536.  
  537. // Write all that stuff to the file.
  538. fwrite($open_file, "$file_contents");
  539.  
  540. // Close the file.  We don't need to edit it any more.
  541. fclose($open_file);
  542.  
  543.  
  544.  
  545. ### Now, let's write our second file: config_admin.php
  546. /*
  547. Let's test to make sure we can actually open up config_admin.php in order to add values to it.
  548. If not, produce an error.
  549. */
  550. $open_file = @fopen("../config_admin.php", "w");
  551.         if (!$open_file) { ?>
  552.                 <h1>错误!</h1>
  553.                 <p>无法正常访问 config_database.php 文件, 请检查后重试.</p>
  554.                 <p>请点击后退按钮返回重试.</p>
  555.                 </div>
  556.         <?php bodyFooter('error', $start_time); exit(); }
  557.  
  558. /*
  559. The login hash is a value unique to this user's installation of AdLogger.
  560. It is used as the login session and Remember Me cookie.
  561. */
  562. $login_hash = createRandomString(75);
  563.  
  564. /*
  565. Declare what the contents of config_database.php will be.
  566. This includes all the data that was passed from the previous page.
  567. */
  568. $file_contents = <<<EOD
  569. <?php
  570.  
  571. \$ip_info_url = "http://www.dnsstuff.com/tools/ipall.ch?domain=";
  572.  
  573. \$adlogger_doc_path = "$adlogger_doc_path";
  574.  
  575. \$admin_cookie = \$db_table_prefix . "adminglog";
  576.  
  577. \$login_hash = "$login_hash";
  578.  
  579. \$gd_enabled = $gd_enabled;
  580.  
  581. \$version_num = '$version_num';
  582.  
  583. ?>
  584. EOD;
  585.  
  586. // Write all that stuff to the file.
  587. fwrite($open_file, "$file_contents");
  588.  
  589. // Close the file.  We don't need to edit it any more.
  590. fclose($open_file);
  591.  
  592.  
  593.  
  594.  
  595. /*
  596. Now that we know the database info is correct, let's add stuff to it.
  597. This will setup the tables and structure.
  598. */
  599. // Include the database configuration we just setup so we can access the database.
  600. require ("../config_database.php");
  601.  
  602. /*
  603. This is the SQL code that will build the tables and insert preliminary data.
  604. */
  605. $sql_install[0] = "
  606.                 CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "adcheck_logs (
  607.                         `id` int(12) NOT NULL auto_increment,
  608.                         `timestamp` varchar(12) NOT NULL default '',
  609.                         `visitor_ip` varchar(15) NOT NULL default '',
  610.                         PRIMARY KEY  (`id`)
  611.                 ) ENGINE=MyISAM;
  612.         ";
  613.  
  614. $sql_install[1] = "CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "blocklogs (
  615.                         `id` int(11) NOT NULL auto_increment,
  616.                         `timestamp` varchar(12) NOT NULL default '',
  617.                         `visitor_ip` varchar(15) NOT NULL default '',
  618.                         `reason` int(1) NOT NULL default '0',
  619.                         `blocked_url` varchar(250) NOT NULL default '',
  620.                         PRIMARY KEY  (`id`)
  621.                 ) ENGINE=MyISAM;
  622.         ";
  623.  
  624. $sql_install[2] = "CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "channels (
  625.                         `id` int(4) NOT NULL auto_increment,
  626.                         `chan_name` varchar(50) NOT NULL default '',
  627.                         `chan_desc` varchar(250) NOT NULL default '',
  628.                         PRIMARY KEY  (`id`)
  629.                 ) ENGINE=MyISAM;
  630.         ";
  631.  
  632. $sql_install[3] = "CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "logfiles (
  633.                         `id` int(12) NOT NULL auto_increment,
  634.                         `timestamp` int(12) NOT NULL,
  635.                         `visitor_ip` varchar(15) NOT NULL default '',
  636.                         `visitor_agent` varchar(250) NOT NULL default '',
  637.                         `ch_id` int(4) NOT NULL,
  638.                         `disp_url` varchar(250) NOT NULL default '',
  639.                         `ref` varchar(250) NOT NULL default '',
  640.                         `targ_url` varchar(50) NOT NULL default '',
  641.                         `click_type` int(1) NOT NULL,
  642.                         `disp_time` int(12) NOT NULL,
  643.                         `format` varchar(16) NOT NULL default '',
  644.                         `color_bg` varchar(6) NOT NULL default '',
  645.                         `color_txt` varchar(6) NOT NULL default '',
  646.                         `color_lnk` varchar(6) NOT NULL default '',
  647.                         `color_url` varchar(6) NOT NULL default '',
  648.                         `color_brd` varchar(6) NOT NULL default '',
  649.                         `ad_type` varchar(10) NOT NULL default '',
  650.                         PRIMARY KEY  (`id`)
  651.                 ) ENGINE=MyISAM;
  652.         ";
  653.  
  654. $sql_install[4] = "CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "quickstats (
  655.  
  656.                         `id` int(1) NOT NULL default '0',
  657.  
  658.                         `last_update_time` int(12) NOT NULL default '0',
  659.  
  660.                         `index.today.total` int(8) NOT NULL default '0',
  661.                         `index.today.unique` int(8) NOT NULL default '0',
  662.                         `index.today.ads` int(8) NOT NULL default '0',
  663.                         `index.today.links` int(8) NOT NULL default '0',
  664.                         `index.yesterday.total` int(8) NOT NULL default '0',
  665.                         `index.yesterday.unique` int(8) NOT NULL default '0',
  666.                         `index.yesterday.ads` int(8) NOT NULL default '0',
  667.                         `index.yesterday.links` int(8) NOT NULL default '0',
  668.                         `index.week.total` int(8) NOT NULL default '0',
  669.                         `index.week.unique` int(8) NOT NULL default '0',
  670.                         `index.week.ads` int(8) NOT NULL default '0',
  671.                         `index.week.links` int(8) NOT NULL default '0',
  672.                         `index.overall.total` int(8) NOT NULL default '0',
  673.                         `index.overall.unique` int(8) NOT NULL default '0',
  674.                         `index.overall.ads` int(8) NOT NULL default '0',
  675.                         `index.overall.links` int(8) NOT NULL default '0',
  676.  
  677.                         `block.today.total` int(8) NOT NULL default '0',
  678.                         `block.today.unique` int(8) NOT NULL default '0',
  679.                         `block.yesterday.total` int(8) NOT NULL default '0',
  680.                         `block.yesterday.unique` int(8) NOT NULL default '0',
  681.                         `block.week.total` int(8) NOT NULL default '0',
  682.                         `block.week.unique` int(8) NOT NULL default '0',
  683.  
  684.                         `db_size` int(20) NOT NULL default '0',
  685.  
  686.                         PRIMARY KEY  (`id`)
  687.                 ) ENGINE=MyISAM;
  688.         ";
  689.  
  690. $sql_install[5] = "INSERT INTO " . $db_table_prefix . "quickstats VALUES (1, 530659320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);";
  691. $sql_install[6] = "INSERT INTO " . $db_table_prefix . "quickstats VALUES (2, 530659320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);";
  692. $sql_install[7] = "INSERT INTO " . $db_table_prefix . "quickstats VALUES (3, 530659320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);";
  693.  
  694. $sql_install[8] = "CREATE TABLE IF NOT EXISTS " . $db_table_prefix . "users (
  695.                         `id` int(2) NOT NULL auto_increment,
  696.                         `username` varchar(15) NOT NULL default '',
  697.                         `password` varchar(50) NOT NULL default '',
  698.                         PRIMARY KEY  (`id`)
  699.                 ) ENGINE=MyISAM;
  700.         ";
  701.  
  702. foreach ($sql_install as $sql) {
  703.         $sql = trim($sql);
  704.  
  705.         // And finally execute each query
  706.         mysql_query($sql);
  707. }
  708.  
  709. /*
  710. Looking good so far.  Now let the user customize the script and make some changes.
  711. */
  712.  
  713. ?>
  714.  
  715.         <h1>安装完成</h1>
  716.         <p>保存数据库连接信息... 成功.<br />数据库中写入数据表... 成功.</p>
  717.         <h1>AdLogger 设置</h1>
  718.         <p>对 AdLogger 初始状态进行设置. 这些设置安装完成后您也可以随时在系统中进行修改.</p>
  719.  
  720.         <form name="install_step_3" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>" onsubmit="return validate_step_3(this);">
  721.                         <fieldset>
  722.                                 <legend>管理员信息</legend>
  723.                                 <label for="username"><strong>用户名:</strong></label>
  724.                                 <input name="username" type="text" id="username" />
  725.                                 <br />
  726.                                 <br />
  727.  
  728.                                 <label for="password1"><strong>密码:</strong></label>
  729.                                 <input name="password1" type="password" id="password1" />
  730.                                 <br />
  731.                                 <br />
  732.  
  733.                                 <label for="password1"><strong>再次输入:</strong></label>
  734.                                 <input name="password2" type="password" id="password2" />
  735.                                 <br />
  736.                                 <br />
  737.                         </fieldset>
  738.  
  739.                 <br />
  740.  
  741.                         <fieldset>
  742.                         <legend>时区设置</legend>
  743.  
  744.                                 <div align="center">
  745.                                 <br />
  746.                                 您的服务器当前时间是: <?php echo date('g:i A', time()) . " on " . date('l, F jS, Y', time()); ?>.
  747.                                 <br /><br />
  748.                                 如需要修改, 请从列表中选择.
  749.                                 <br /><br />
  750.                                         <select name="timezone">
  751.                                                 <option value="-12"> - 12:00 ---- <?php time_change(-12); ?></option>
  752.                                                 <option value="-11"> - 11:00 ---- <?php time_change(-11); ?></option>
  753.                                                 <option value="-10"> - 10:00 ---- <?php time_change(-10); ?></option>
  754.                                                 <option value="-9"> - 9:00 ---- <?php time_change(-9); ?></option>
  755.                                                 <option value="-8"> - 8:00 ---- <?php time_change(-8); ?></option>
  756.                                                 <option value="-7"> - 7:00 ---- <?php time_change(-7); ?></option>
  757.                                                 <option value="-6"> - 6:00 ---- <?php time_change(-6); ?></option>
  758.                                                 <option value="-5"> - 5:00 ---- <?php time_change(-5); ?></option>
  759.                                                 <option value="-4"> - 4:00 ---- <?php time_change(-4); ?></option>
  760.                                                 <option value="-3.5"> - 3:30 ---- <?php time_change(-3.5); ?></option>
  761.                                                 <option value="-3"> - 3:00 ---- <?php time_change(-3); ?></option>
  762.                                                 <option value="-2"> - 2:00 ---- <?php time_change(-2); ?></option>
  763.                                                 <option value="-1"> - 1:00 ---- <?php time_change(-1); ?></option>
  764.                                                 <option value="0" selected="selected"> + 0:00 ---- <?php time_change(0); ?></option>
  765.                                                 <option value="1"> + 1:00 ---- <?php time_change(1); ?></option>
  766.                                                 <option value="2"> + 2:00 ---- <?php time_change(2); ?></option>
  767.                                                 <option value="3"> + 3:00 ---- <?php time_change(3); ?></option>
  768.                                                 <option value="3.5"> + 3:30 ---- <?php time_change(3.5); ?></option>
  769.                                                 <option value="4"> + 4:00 ---- <?php time_change(4); ?></option>
  770.                                                 <option value="4.5"> + 4:30 ---- <?php time_change(4.5); ?></option>
  771.                                                 <option value="5"> + 5:00 ---- <?php time_change(5); ?></option>
  772.                                                 <option value="5.5"> + 5:30 ---- <?php time_change(5.5); ?></option>
  773.                                                 <option value="6"> + 6:00 ---- <?php time_change(6); ?></option>
  774.                                                 <option value="7"> + 7:00 ---- <?php time_change(7); ?></option>
  775.                                                 <option value="8"> + 8:00 ---- <?php time_change(8); ?></option>
  776.                                                 <option value="9"> + 9:00 ---- <?php time_change(9); ?></option>
  777.                                                 <option value="9.5"> + 9:30 ---- <?php time_change(9.5); ?></option>
  778.                                                 <option value="10"> + 10:00 ---- <?php time_change(10); ?></option>
  779.                                                 <option value="11"> + 11:00 ---- <?php time_change(11); ?></option>
  780.                                                 <option value="12"> + 12:00 ---- <?php time_change(12); ?></option>
  781.                                         </select>
  782.                                         <br />
  783.                                 </div>
  784.  
  785.                         <br />
  786.                 </fieldset>
  787.  
  788.                 <br />
  789.  
  790.                         <fieldset>
  791.                                 <legend>通知设置</legend>
  792.                                 <label for="email"><strong>邮箱地址: </strong></label>
  793.                                 <input name="email" type="text" id="email" size="30" />
  794.                                 <br />
  795.                                 <br />
  796.                                 <label for="email"><strong>再次输入: </strong></label>
  797.                                 <input name="email_confirm" type="text" id="email_confirm" size="30" />
  798.                                 <br />
  799.                                 <br />
  800.  
  801.                                 <label for="emailnotice"><strong>邮件通知: </strong></label>
  802.                                 <input name="emailnotice" type="radio" value="true" checked="checked" /> 需要
  803.                                 <input name="emailnotice" type="radio" value="false" /> 不需要
  804.                                 <br />
  805.                                 <label>您是否需要每次点击后, 都邮件通知您?</label>
  806.                                 <br />
  807.                                 <br />
  808.  
  809.                                 <label for="emailalert"><strong>邮件警告: </strong></label>
  810.                                 <input name="emailalert" type="radio" value="true" checked="checked" /> 需要
  811.                                 <input name="emailalert" type="radio" value="false" /> 不需要
  812.                                 <br />
  813.                                 <label>当有同一IP多次点击后, 是否需要邮件通知您?</label>
  814.                                 <br />
  815.                                 <br />
  816.                         </fieldset>
  817.  
  818.                 <br />
  819.  
  820.                         <fieldset>
  821.                                 <legend>恶意点击设置 [可选]</legend>
  822.                                 <div align="center">
  823.                                 一个浏览者 <input name="clickmaxtime" type="text" size="3" /> 小时内, 最多点击 <input name="clickmax" type="text" size="3" /> 次.
  824.                                 </div>
  825.                                 <br />
  826.  
  827.                         </fieldset>
  828.  
  829.                 <br />
  830.  
  831.                         <fieldset>
  832.                                 <legend>继续安装</legend>
  833.                                 <label for="submit">&nbsp;</label>
  834.                                 <input name="step" type="hidden" id="step" value="5" />
  835.                                 <input type="submit" name="Submit" value="下一步" />
  836.                         </fieldset>
  837.  
  838.         </form>
  839.  
  840.  
  841.  
  842. <?php }
  843. /*
  844. If the user is at step 5, perform this code
  845. */
  846. elseif ($_POST['step'] == '5') {
  847.  
  848. // Get and declare all the variables that have been posted from the previous step
  849. $username = $_POST['username'];
  850. $password1 = $_POST['password1'];
  851. $password2 = $_POST['password2'];
  852. $gmtdifference = $_POST['timezone'];
  853. $email = trim($_POST['email']);
  854. $email_confirm = trim($_POST['email_confirm']);
  855. $emailnotice = $_POST['emailnotice'];
  856. $emailalert = $_POST['emailalert'];
  857. $clickmax = $_POST['clickmax'];
  858. $clickmaxtime = $_POST['clickmaxtime'];
  859.  
  860. /*
  861. If the user left the click fraud values blank,
  862. insert two numbers in there so the script won't produce an error.
  863. */
  864. if (empty($clickmax)) $clickmax = 99;
  865. if (empty($clickmaxtime)) $clickmaxtime = 1;
  866.  
  867. /*
  868. Verify that the user didn't leave anything in the form blank.
  869. */
  870. if (empty($username) || empty($password1) || empty($password2) || empty($email) || empty($email_confirm)) { ?>
  871.         <h1>错误!</h1>
  872.         <p>您必须完整填写所有信息, 下列信息不能留空:</p>
  873.         <ul>
  874.                 <li>用户名</li>
  875.                 <li>密码</li>
  876.                 <li>密码验证</li>
  877.                 <li>邮箱</li>
  878.                 <li>邮箱验证</li>
  879.         </ul>
  880.         <p>请点击后退按钮返回重试.</p>
  881.         </div>
  882. <?php bodyFooter('error', $start_time); exit(); }
  883.  
  884. // Verify that the password and confirmation password are the same.
  885. if ($password1 != $password2) { ?>
  886.         <h1>错误!</h1>
  887.         <p>您两次输入的密码不一致.</p>
  888.         <ul>
  889.                 <li>密码</li>
  890.                 <li>验证密码</li>
  891.         </ul>
  892.         <p>请点击后退按钮返回重试.</p>
  893.         </div>
  894. <?php bodyFooter('error', $start_time); exit(); }
  895.  
  896. // Verify that the password is at least 6 characters long.
  897. if (strlen($password1) < 6) { ?>
  898.         <h1>错误!</h1>
  899.         <p>出于安全, 您的密码必须设置6位以上.</p>
  900.         <p>请点击后退按钮返回重试.</p>
  901.         </div>
  902. <?php bodyFooter('error', $start_time); exit(); }
  903.  
  904. // Verify that the email and confirmation email are the same.
  905. if ($email != $email_confirm) { ?>
  906.         <h1>错误!</h1>
  907.         <p>您两次输入的邮箱地址不一致.</p>
  908.         <ul>
  909.                 <li>邮箱地址</li>
  910.                 <li>邮箱地址验证</li>
  911.         </ul>
  912.         <p>请点击后退按钮返回重试.</p>
  913.         </div>
  914. <?php bodyFooter('error', $start_time); exit(); }
  915.  
  916. // Make sure that the email address is a valid email address.
  917. if (!is_valid_email("$email")) { ?>
  918.         <h1>错误!</h1>
  919.         <p><?php echo $email; ?> 您输入的不是一个有效的邮箱地址, 请正确输入, 否则程序可能会多处提醒出错.</p>
  920.         <p>请点击后退按钮返回重试.</p>
  921.         </div>
  922. <?php bodyFooter('error', $start_time); exit(); }
  923.  
  924. // Verify that the click fraud settings are actually numbers.
  925. if (!is_numeric($clickmax) || !is_numeric($clickmaxtime)) { ?>
  926.         <h1>错误!</h1>
  927.         <p>最大点击次数必须是数字.</p>
  928.         <p>请点击后退按钮返回重试.</p>
  929.         </div>
  930. <?php bodyFooter('error', $start_time); exit(); }
  931.  
  932. /*
  933. Let's test to make sure we can actually open up config_settings.php in order to add values to it.
  934. If not, produce an error.
  935. */
  936. $open_file = @fopen("../config_settings.php", "w");
  937.         if (!$open_file) { ?>
  938.                 <h1>错误!</h1>
  939.                 <p>程序不能正常访问 config_settings.php 文件, 请检查后重试.</p>
  940.                 <p>请点击后退按钮返回重试.</p>
  941.                 </div>
  942.         <?php bodyFooter('error', $start_time); exit(); }
  943.  
  944. /*
  945. Declare what the contents of config_database.php will be.
  946. This includes all the data that was passed from the previous page.
  947. */
  948. $file_contents = <<<EOD
  949. <?php
  950. /*
  951.  * You can change these on the Settings page inside your Administration panel.
  952.  */
  953.  
  954. \$email = "$email";
  955.  
  956. \$email_notice = $emailnotice;
  957.  
  958. \$email_alert = $emailalert;
  959.  
  960. \$emailalert_num = 5;
  961.  
  962. \$clickmax = $clickmax;
  963.  
  964. \$clickmaxtime = $clickmaxtime * 3600;
  965.  
  966. \$gmt_dif = "$gmtdifference";
  967.  
  968. \$timestamp = time() + 60*60*(\$gmt_dif);
  969.  
  970. \$ip_db_check = true;
  971.  
  972. \$ip_range_ban_list = array(
  973. ""
  974. );
  975.  
  976. \$disable_all_ads = false;
  977.  
  978. ?>
  979. EOD;
  980.  
  981. // Write all that stuff to the file.
  982. fwrite($open_file, "$file_contents");
  983.  
  984. // Close the file.  We don't need to edit it any more.
  985. fclose($open_file);
  986.  
  987. // End of writing config_settings.php file
  988. //
  989.  
  990. /*
  991. Open up both configuration files because we know need
  992. to know the values that are stored in each of them.
  993. */
  994. require ("../config_database.php");
  995. require ("../config_settings.php");
  996. require ("../config_admin.php");
  997.  
  998. /*
  999. We don't want to store the password in the database as plain text.
  1000. So let's hash it using 160-bit hash: SHA-1
  1001. */
  1002. $password_hash = sha1($password1);
  1003.  
  1004. // Now insert the username and hashed password into the database.
  1005. mysql_query("INSERT INTO " . $db_table_prefix . "users
  1006.         SET
  1007.         username='$username',
  1008.         password='$password_hash'
  1009. ")
  1010. or die(mysql_error());
  1011.  
  1012. /*
  1013. That's pretty much it with the installation.
  1014. Now tell the user what else he has to do to clean up and start using AdLogger!
  1015. */
  1016. ?>
  1017.         <h1>安装完成</h1>
  1018.         <p>
  1019.                 保存数据库连接信息... 完成.
  1020.                 <br />
  1021.                 数据库中写入数据表... 完成.
  1022.                 <br />保存设置... 完成.
  1023.         </p>
  1024.         <p><strong>祝贺! AdLogger 已经安装完成!</strong></p>
  1025.  
  1026.         <h1>安装完成提示</h1>
  1027.         <ul>
  1028.                 <li>删除安装目录 (/install).</li>
  1029.  
  1030.                 <?php
  1031.                 // Try to automatically change permissions on the config files back to 644.
  1032.                 @chmod('../config_admin.php', 0644);
  1033.                 @chmod('../config_database.php', 0644);
  1034.                 @chmod('../config_settings.php', 0644);
  1035.  
  1036.                 /*
  1037.                 Check the configuration files permissions to see if they're already set back.
  1038.                 If not, tell the user he'll have to do it manually.
  1039.                 */
  1040.                 if (check_permissions('../config_admin.php') && check_permissions('../config_database.php') && check_permissions('../config_settings.php')) {
  1041.                         echo '<li>CHMOD the configuration files back to 644.</li>';
  1042.                 }
  1043.                 ?>
  1044.         </ul>
  1045.  
  1046.         <p><strong>登录信息: </strong>请使用这个地址登录您的系统: <a href="<?php echo $siteurl . $adlogger_loc; ?>"><?php echo $siteurl . $adlogger_loc; ?></a></p>
  1047.  
  1048. <?php
  1049. /*
  1050. Send a confirmation email to the user telling them they're good to go.
  1051. Also contains the post-installation instructions.
  1052. */
  1053. $msg = "Congratulations! AdLogger has been successfully installed. You are now ready to being using it.<BR><BR>
  1054. Before AdLogger can begin recording stats, you must place a piece of javascript code on each of your AdSense pages. This code can be found on the Code Generator page in your admin panel.<BR><BR>
  1055. To become fully aware of the strengths and shortcomings of the AdLogger script, please read the documentation and frequently asked questions: http://www.adlogger.org/index.php/Documentation<BR><BR>
  1056. If you run into any problems whatsoever, please fill out a bug report and submit it in the support forum.<BR><BR>
  1057. You can accesss your administration panel at the following URL: $siteurl$adlogger_loc<BR><BR>
  1058. Thanks and enjoy!<BR><BR>
  1059. Trevor Fitzgerald<BR>
  1060. AdLogger Founder";
  1061.  
  1062. $subject = "AdLogger Installation";
  1063. $mailheaders = "MIME-Version: 1.0\n";
  1064. $mailheaders .= "Content-type: text/html; charset=iso-8859-1\n";
  1065.  
  1066. $to = $email;
  1067. $mailheaders .= "From: AdLogger <$email>\n";
  1068. $mailheaders .= "Reply-To: $email";
  1069.  
  1070. mail($to, $subject, $msg, $mailheaders);
  1071.  
  1072. }
  1073. /*
  1074. If, for some reason, the POST variables weren't working
  1075. to send the user to the next step, produce an error.
  1076. */
  1077. else { ?>
  1078.         <h1>错误!</h1>
  1079.         <p>安装出现错误, 自动跳转到安装步骤.</p>
  1080.         </div>
  1081.         <?php bodyFooter('error', $start_time); exit(); ?>
  1082. <?php } ?>
  1083.  
  1084. </div>
  1085.  
  1086. <?php
  1087. // Output the closing HTML code
  1088. bodyFooter('install', $start_time);
  1089.  
  1090. /* Ta da! */
  1091. ?>
downloadindex.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