Aardvark Topsites & PHP v7.2 Fix

by | Feb 8, 2019 | All (Home), Web/Tech | 0 comments

Aardvark Topsites is a php script that was originally developed about 15 years ago, designed to present websites as a dynamic ordered list. A topsites list ranks a group of related sites by popularity. Webmasters join the topsites list and are given a button to put on their site and link back to the topsites list. Aardvark Topsites PHP is a free topsites script built on PHP and MySQL. It is licensed under the GNU General Public License. The last official release was in 2009.

Aardvark has a number of issues but the most annoying for those running the script are the poor spam detection and the inability to run under recent releases of php. I have been running an Aardvark topsites script since 2005 (usaweatherfinder.com) and have managed to work around both of the most annoying problems mentioned above.

First, the annoying spam issue. This was a very low tech but successful fix. After trying capcha changes and other coding tricks I finally just changed my sign-up form. Since most spam applications are bot driven, I added a question that says “Enter the SECRET PASSWORD”. The answer is given clearly and obviously in the separate sign-up instructions page where it says:

"How do I answer the question about Secret Password? The Secret Password is 
CUMULUS (all capital letters)

Since adding this question I have had zero spam sign-up attempts.

The second problem was getting it to run on any php version above 5.6. Since support for php 5 ended in 2018 and my hosting platform was going to begin charging a monthly fee to continue using it, I looked and came up with a solution that allows running ATS on php 7.2 with a bare minimum of code changes. I have to give credit to Github user rubo77 for some of the code which was modified to work on ATS. Here is what I did.

  1. Create a new file named fix_mysql.inc.php located in three locations. ROOT, SOURCES, and SOURCES/SQL. It essentially creates new global variables that replace all mysql_* calls with the new mysqli_* calls, and a few other issues. The code can be downloaded as a .txt file here. Just rename the file with a .php extension instead of .txt.
  2. Add the following single line near the top of your mysql.php file which is located in SOURCES/SQL. Add it after the comments section.
        include_once('fix_mysql.inc.php');

That’s all. You should then be able to change your php version to 7.2.

If you have any questions you can reach me using the Contact Me page on this site or the link on usaweatherfinder.com. Hope this helps someone.