TightURL

TightURL Git Source Tree

Root/tighturl-killbot.php

1#!/usr/bin/php
2<?php
3define("VERSION", "0.1.4");
4define("REQUIRED_PHP_VERSION", "4.3.0");
5error_reporting (E_ALL);
6
7 if (version_compare(phpversion(), REQUIRED_PHP_VERSION)<0) {
8 die("Error: TightURL ".VERSION." needs PHP >= ".REQUIRED_PHP_VERSION." (you are using ".phpversion().")");
9 }
10
11 if (file_exists("tighturl.tltpattern.inc.php")) include("tighturl.tltpattern.inc.php");
12 if (file_exists("tighturl.urlpattern.inc.php")) include("tighturl.urlpattern.inc.php");
13 if (file_exists("tighturl.ptcpattern.inc.php")) include("tighturl.ptcpattern.inc.php");
14 if (file_exists("tighturl.blippattern.inc.php")) include("tighturl.blippattern.inc.php");
15 (include("tighturl.lib.inc.php")) or die("Error: cannot load tighturl.lib.inc.php");
16 if (file_exists("tighturl.config.inc.php")) include("tighturl.config.inc.php");
17
18 // Connect to MySQL, open database.
19 $conn = @mysql_connect($dbhost, $dbuser, $dbpass) or die("Error: Cannot connect to database.");
20 $db = mysql_select_db($dbname, $conn) or die("Error: Cannot select database. ". mysql_error());
21
22 // Query records with status normal, and added within last 10 days or records with status normal and more than 7 hits and hit within the last 7 days
23 TightURL_KillBot("SELECT * FROM $dbtable where status=0 && (DATE_SUB(CURDATE(), INTERVAL 10 DAY) <= adddate || (hits > 7 && DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= lasthit)) ORDER BY id;");
24 TightURL_NewReport("SELECT * FROM $dbtable where (status=0) && (checkcount < 2) ORDER BY id;");
25 exit;
26
27?>

Archive Download this file

Branches