3. Other Files - andperry256/my-base-theme-and-dbadmin GitHub Wiki

Other Files

DB Admin and My Base Theme are stored in a common area used by all my web sites. There are also a number of miscellaneous files stored in this area, and whilst these do not constitute an integral part of either of the two packages, they have nevertheless been included in this repository. This page gives a brief description of these files.

cipher_funct.php

This file contains two functions encrypt_with_password and decrypt_with_password used to encrypt/decrypt a string of text using a simple password. Each function takes the plain/cipher text plus the password as parameters and returns the resulting cipher/plain text.

counter.php

This file contains a script for maintaining a visitor counter and would normally be included in the page footer script. Its use is subject to the following pre-requisites:-

  • The global variable $CounterDir must be set to the path of a directory to be used to store data for the counter.
  • A table counter_hits must be declared in one of the databases for the site. This contains fields for the date, the remote IP address of the visitor and a counter.
  • The variable $dbid must be set immediately prior to including counter.php. This variable contains the ID of the database containing the counter_hits table. Please see the mysql_connect.php file for the given site for further details.

date_funct.php

This file contains a variety of date-related functions. Please see the file for further details - the functions should be fairly self-explanatory.

display_debug_log.php

This is a standalone PHP script and is used to display the PHP debug log for the site. It assumes that this is stored in the standard location for a WordPress debug log, namely public_html/wp-content/debug.log. It also contains link to clear the current log, which is a link to itself with a parameter to perform the clear operation.

In the online environment this script takes no parameters, but in the local server environment hosting multiple sites, a site parameter is required.

purge_logins.php

This script is designed to run in command-line mode and would normally be invoked by a cron job. Its purpose is to purge any timed-out login sessions for the site. The variables $local_site_dir and $dbid must be set for the given site prior to running this script. Each site would normally have a custom purge_logins.php script in its root (public_html) directory, which sets these variables as required and then runs the common purge_logins.php script.