| Server IP : 208.122.213.31 / Your IP : 216.73.216.45 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/tits-bigtits.com/phphits/ |
Upload File : |
<?php
/*
***************************************************
***************************************************
* phphits v1.1 Beta :: install *
* Coded by Johannes Gamba (jgamba@geekfactory.de) *
***************************************************
***************************************************
*/
// ~~~~~ Load all GET and POST variables into array ~~~~~
$HTTP_REQUEST_VARS = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS);
// ~~~~~ Redirect user to setup.php if he tried to open install.php directly ~~~~~
if(!(isset($HTTP_REQUEST_VARS["admin_user"])))
{
@header("Location: setup.php");
exit;
}
// ~~~~~ Include shared functions ~~~~~
include "phphits.inc.php";
// ~~~~~ Set general variables ~~~~~
$sql_name = "";
$sql_result = "";
// ~~~~~ Store settings in 'settings.inc.php' ~~~~~
$f_handle = @fopen("settings.inc.php", "w");
@fputs($f_handle, "<?php\n\n");
@fputs($f_handle, "/*\n************************************************\n");
@fputs($f_handle, "phphits v" . SCRIPT_VERSION . " :: settings\n");
@fputs($f_handle, "[This file was automatically created by phphits]\n");
@fputs($f_handle, "************************************************\n*/\n\n");
@fputs($f_handle, "// Format: \"SETTING\", \"VALUE\"\n// Edit the value parts to fit your needs\n\n");
@fputs($f_handle, "// ~~~~~ Admin settings ~~~~~\n\n");
@fputs($f_handle, "define(\"ADMIN_USER\", \"" . $HTTP_REQUEST_VARS["admin_user"] . "\");\n");
@fputs($f_handle, "// Admin user name\n");
@fputs($f_handle, "define(\"ADMIN_PWD\", \"" . $HTTP_REQUEST_VARS["admin_pwd"] . "\");\n");
@fputs($f_handle, "// Admin password\n\n");
@fputs($f_handle, "// ~~~~~ MySQL settings ~~~~~\n\n");
@fputs($f_handle, "define(\"SQL_HOST\", \"" . $HTTP_REQUEST_VARS["sql_host"] . "\");\n");
@fputs($f_handle, "// IP or host name of MySQL server\n");
@fputs($f_handle, "define(\"SQL_USER\", \"" . $HTTP_REQUEST_VARS["sql_user"] . "\");\n");
@fputs($f_handle, "// MySQL user name\n");
@fputs($f_handle, "define(\"SQL_PWD\", \"" . $HTTP_REQUEST_VARS["sql_pwd"] . "\");\n");
@fputs($f_handle, "// MySQL password\n");
@fputs($f_handle, "define(\"SQL_DB\", \"" . $HTTP_REQUEST_VARS["sql_db"] . "\");\n");
@fputs($f_handle, "// Name of MySQL database (will be automatically created by phphits)\n");
@fputs($f_handle, "define(\"SQL_TABLE_LOG\", \"" . $HTTP_REQUEST_VARS["sql_table_log"] . "\");\n");
@fputs($f_handle, "// Name of MySQL log table (will be automatically created by phphits)\n");
@fputs($f_handle, "define(\"SQL_TABLE_COUNTER\", \"" . $HTTP_REQUEST_VARS["sql_table_counter"] . "\");\n");
@fputs($f_handle, "// Name of MySQL counter table (will be automatically created by phphits)\n");
@fputs($f_handle, "define(\"SQL_SHOW_ERRORS\", \"" . $HTTP_REQUEST_VARS["sql_show_errors"] . "\");\n");
@fputs($f_handle, "// Show MySQL error messages? (\"0\" = no, \"1\" = yes)\n\n");
@fputs($f_handle, "// ~~~~~ Counter settings ~~~~~\n\n");
@fputs($f_handle, "define(\"COUNTER_MODE\", \"" . $HTTP_REQUEST_VARS["counter_mode"] . "\");\n");
@fputs($f_handle, "// Counter mode (\"1\" = text mode, \"2\" = image mode)\n");
@fputs($f_handle, "define(\"COUNTER_IMG_SUBDIR\", \"" . $HTTP_REQUEST_VARS["counter_img_subdir"] . "\");\n");
@fputs($f_handle, "// Directory where the counter images are located (needed for image mode only)\n");
@fputs($f_handle, "define(\"COUNTER_DIGITS\", \"" . $HTTP_REQUEST_VARS["counter_digits"] . "\");\n");
@fputs($f_handle, "// Number of counter digits\n");
@fputs($f_handle, "define(\"COUNTER_HITS_OFFSET\", \"" . $HTTP_REQUEST_VARS["counter_hits_offset"] . "\");\n");
@fputs($f_handle, "// Counter hits offset (this value is added to the \"real\" hits count)\n");
@fputs($f_handle, "define(\"COUNTER_BLOCK_TIME\", \"" . $HTTP_REQUEST_VARS["counter_block_time"] . "\");\n");
@fputs($f_handle, "// Ignore hit if same visitor has already been counted within the last ... minutes\n");
@fputs($f_handle, "define(\"COUNTER_BLOCK_IP\", \"" . $HTTP_REQUEST_VARS["counter_block_ip"] . "\");\n");
@fputs($f_handle, "// Always ignore hits from visitors with this IP\n");
@fputs($f_handle, "define(\"COUNTER_USERONLINE_TIME\", \"" . $HTTP_REQUEST_VARS["counter_useronline_time"] . "\");\n");
@fputs($f_handle, "// Show number of users who have visited the site within the last ... minutes as \"currently online\"\n\n");
@fputs($f_handle, "// ~~~~~ Log settings ~~~~~\n\n");
@fputs($f_handle, "define(\"SQL_LOG_HITS\", \"" . $HTTP_REQUEST_VARS["sql_log_hits"] . "\");\n");
@fputs($f_handle, "// Number of hits phphits should store in the log table (\"0\" = store all hits)\n");
@fputs($f_handle, "define(\"COUNTER_REC_HOST\", \"" . $HTTP_REQUEST_VARS["counter_rec_host"] . "\");\n");
@fputs($f_handle, "// Look up and record visitor's hostname? (\"0\" = no, \"1\" = yes)\n");
@fputs($f_handle, "define(\"COUNTER_REC_BROWSER\", \"" . $HTTP_REQUEST_VARS["counter_rec_browser"] . "\");\n");
@fputs($f_handle, "// Record visitor's user agent (browser)? (\"0\" = no, \"1\" = yes)\n");
@fputs($f_handle, "define(\"COUNTER_REC_LANGUAGE\", \"" . $HTTP_REQUEST_VARS["counter_rec_language"] . "\");\n");
@fputs($f_handle, "// Record visitor's user language? (\"0\" = no, \"1\" = yes)\n");
@fputs($f_handle, "define(\"COUNTER_REC_REFERRER\", \"" . $HTTP_REQUEST_VARS["counter_rec_referrer"] . "\");\n");
@fputs($f_handle, "// Record page where visitor came from (referrer)? (\"0\" = no, \"1\" = yes)\n");
@fputs($f_handle, "define(\"COUNTER_REC_PAGE\", \"" . $HTTP_REQUEST_VARS["counter_rec_page"] . "\");\n");
@fputs($f_handle, "// Record name of page visitor is looking at? (\"0\" = no, \"1\" = yes)\n\n");
@fputs($f_handle, "// ~~~~~ Log file settings ~~~~~\n\n");
@fputs($f_handle, "define(\"LOG_NUM_HITS\", \"" . $HTTP_REQUEST_VARS["log_num_hits"] . "\");\n");
@fputs($f_handle, "// Number of hits to show in log file\n");
@fputs($f_handle, "define(\"LOG_FONT_FACE\", \"" . $HTTP_REQUEST_VARS["log_font_face"] . "\");\n");
@fputs($f_handle, "// Font(s) used in log file\n");
@fputs($f_handle, "define(\"LOG_HIGHLIGHT_TIME\", \"" . $HTTP_REQUEST_VARS["log_highlight_time"] . "\");\n");
@fputs($f_handle, "// Mark hits within the last ... hours in special color\n");
@fputs($f_handle, "define(\"LOG_HIGHLIGHT_COLOR\", \"" . $HTTP_REQUEST_VARS["log_highlight_color"] . "\");\n");
@fputs($f_handle, "// Use this color to mark these hits");
@fputs($f_handle, "\n\n?>");
@fclose($f_handle);
// ~~~~~ Connect to MySQL server ~~~~~
if (!($sql_id = @mysql_connect($HTTP_REQUEST_VARS["sql_host"], $HTTP_REQUEST_VARS["sql_user"], $HTTP_REQUEST_VARS["sql_pwd"])))
{
phphitsShowErrorMsg("mysql_connect", $sql_id);
}
// ~~~~~ Check if MySQL database already exists ~~~~~
$found_db = @mysql_select_db($HTTP_REQUEST_VARS["sql_db"], $sql_id);
// ---------- Create MySQL database (if necessary) ~~~~~
if(!$found_db)
{
if (!@mysql_create_db($HTTP_REQUEST_VARS["sql_db"], $sql_id))
{
phphitsShowErrorMsg("mysql_create_db", $sql_id);
}
}
// ---------- Activate MySQL databse ~~~~~
if (!@mysql_select_db($HTTP_REQUEST_VARS["sql_db"], $sql_id))
{
phphitsShowErrorMsg("mysql_select_db", $sql_id);
}
// ---------- Check if MySQL tables already exists ~~~~~
$sql_list = @mysql_list_tables($HTTP_REQUEST_VARS["sql_db"], $sql_id);
$found_table_log = 0;
$found_table_counter = 0;
$i = 0;
while($sql_name = @mysql_tablename($sql_list, $i))
{
if($sql_name == $HTTP_REQUEST_VARS["sql_table_log"])
{
$found_table_log = 1;
}
if($sql_name == $HTTP_REQUEST_VARS["sql_table_counter"])
{
$found_table_counter = 1;
}
$i++;
}
// ---------- Create new MySQL tables (if necessary) ~~~~~
if(!$found_table_log)
{
if (!($sql_result = dbRunQuery($sql_id, "CREATE TABLE " . $HTTP_REQUEST_VARS["sql_table_log"] . " (rowid int(10) unsigned NOT NULL auto_increment, ip char(15) NOT NULL default '', host char(100) NOT NULL default '', browser char(100) NOT NULL default '', language char(5) NOT NULL default '', referrer char(100) NOT NULL default '', page char(100) NOT NULL default '', tstamp int(10) NOT NULL default '0', PRIMARY KEY (rowid)) TYPE=MyISAM;")))
{
phphitsShowErrorMsg("mysql_create_table", $sql_id);
}
}
if(!$found_table_counter)
{
if (!($sql_result = dbRunQuery($sql_id, "CREATE TABLE " . $HTTP_REQUEST_VARS["sql_table_counter"] . " (rowid int(10) unsigned NOT NULL default '0', hits int(10) unsigned NOT NULL default '0', PRIMARY KEY (rowid)) TYPE=MyISAM;")))
{
phphitsShowErrorMsg("mysql_create_table", $sql_id);
}
// ~~~~~ Insert row into counter table ~~~~~
if (!($sql_result = dbRunQuery($sql_id, "INSERT INTO " . $HTTP_REQUEST_VARS["sql_table_counter"] . " (rowid,hits) VALUES (1,0)")))
{
phphitsShowErrorMsg("mysql_create_table", $sql_id);
}
}
// ~~~~~ Free memory, close connection to MySQL server ~~~~~
dbDisconnect($sql_id, $sql_result);
// ~~~~~ Output results ~~~~~
echo "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>";
echo "- Counter settings have been stored ('settings.inc.php').<p></p>";
if(!($found_db))
{
echo "- MySQL database has been created.<p></p>";
}
else
{
echo "- MySQL database already exists....<p></p>";
}
if(!($found_table_log))
{
echo "- MySQL log table has been created.<p></p>";
}
else
{
echo "- MySQL log table already exists....<p></p>";
}
if(!($found_table_counter))
{
echo "- MySQL counter table has been created.<p></p>";
}
else
{
echo "- MySQL counter table already exists...<p></p>";
}
echo "<font color=\"#0033CC\">> phphits has been installed successfully!</font>";
echo "</b></font>";
?>