Created
March 15, 2015 10:00
-
-
Save boy3vil/980dc203e24756a38c65 to your computer and use it in GitHub Desktop.
sql record every user acses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE IF NOT EXISTS `mitm` ( | |
| `id` int(8) NOT NULL AUTO_INCREMENT, | |
| `request_time` datetime NOT NULL, | |
| `request_time_old` int(10) NOT NULL, | |
| `remote_address` text COLLATE latin1_general_ci NOT NULL, | |
| `remote_host` text COLLATE latin1_general_ci NOT NULL, | |
| `remote_port` text COLLATE latin1_general_ci NOT NULL, | |
| `x_forwarded_for` text COLLATE latin1_general_ci NOT NULL, | |
| `http_via` text COLLATE latin1_general_ci NOT NULL, | |
| `user_agent` text COLLATE latin1_general_ci NOT NULL, | |
| `referer` text COLLATE latin1_general_ci NOT NULL, | |
| `php_self` text COLLATE latin1_general_ci NOT NULL, | |
| `query_string` text COLLATE latin1_general_ci NOT NULL, | |
| `request_method` text COLLATE latin1_general_ci NOT NULL, | |
| `script_name` text COLLATE latin1_general_ci NOT NULL, | |
| `request_uri` text COLLATE latin1_general_ci NOT NULL, | |
| `catatan` text COLLATE latin1_general_ci NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci | |
| function hal() | |
| { | |
| $waktu = date("Y-m-d H:i:s", $_SERVER['REQUEST_TIME']); | |
| $mitmquery = " | |
| INSERT INTO | |
| `mitm` ( | |
| `id` , | |
| `request_time` , | |
| `remote_address` , | |
| `remote_host` , | |
| `remote_port` , | |
| `x_forwarded_for` , | |
| `http_via`, | |
| `user_agent` , | |
| `referer` , | |
| `php_self` , | |
| `query_string` , | |
| `request_method` , | |
| `script_name` , | |
| `request_uri` , | |
| `catatan` | |
| ) | |
| VALUES ( | |
| NULL , | |
| '" . $waktu . "', | |
| '" . $_SERVER['REMOTE_ADDR'] . "', | |
| '" . $_SERVER['REMOTE_HOST'] . "', | |
| '" . $_SERVER['REMOTE_PORT'] . "', | |
| '" . $_SERVER['HTTP_X_FORWARDED_FOR'] . "', | |
| '" . $_SERVER['HTTP_VIA'] . "', | |
| '" . $_SERVER['HTTP_USER_AGENT'] . "', | |
| '" . $_SERVER['HTTP_REFERER'] . "', | |
| '" . $_SERVER['PHP_SELF'] . "', | |
| '" . $_SERVER['QUERY_STRING'] . "', | |
| '" . $_SERVER['REQUEST_METHOD'] . "', | |
| '" . $_SERVER['SCRIPT_NAME'] . "', | |
| '" . $_SERVER['REQUEST_URI'] . "', '' | |
| )"; | |
| $mitm = @sql($mitmquery, '', ''); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment