Onderstaand script slaat de ip's op (en nog wat dingen)
Maar kan er hier iemand kijken om die echo's weg te doen, het is namelijk niet de bedoeling dat de bezoeker alles ziet.
Hij mag het zelfs niet weten dat hij gelogt is.
[syntax="php"]<? ob_start(); ?>
<html>
<head>
<title>Ip logger</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
a{
color: #000066;
text-decoration: none;
}
a:hover{
color: #000066;
text-decoration: underline;
}
input, textarea, select{
font-family: verdana;
font-size: 7pt;
border: 1px solid #000000;
}
body, td{
font-family: verdana;
font-size: 7pt;
}
</style>
</head>
<body>
<?
session_start();
error_reporting(E_ALL);
##################################################################
## Dit script is geschreven door S.A. en Micra voor een battle. ##
## Het schrijven van dit script is klaar gemaakt op wmcity.nl ##
## ##
## Datum : 6 juni 2004 ##
## Laatste update : 9 juni 2004 21:57 ##
##################################################################
## ##
## ©2004 Micra & S.A. ##
##################################################################
/*
CREATE TABLE ip_log (
id int(20) NOT NULL auto_increment,
name varchar(255) NOT NULL default '',
ip varchar(20) NOT NULL default '0',
host varchar(255) NOT NULL default '',
referer varchar(255) NOT NULL default '',
locatie varchar(255) NOT NULL default '',
OS varchar(255) NOT NULL default '',
browser varchar(255) NOT NULL default '',
datum int(20) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
*/
##################################################################
class ip{
var $actie;
var $id;
var $error = array();
var $r;
var $name;
var $ip;
var $os;
var $browser;
var $sort;
var $manier;
var $gip;
var $re;
var $lo;
var $sb;
var $p;
var $pp;
var $perp;
var $user;
var $ww;
var $suser;
var $sww;
function _get_error($g_e = ''){
if($g_e != "" && $g_e != "gw"){
$this->error[] = $g_e;
}
elseif(count($this->error) != 0 && $g_e == "gw"){
echo "De volgende fouten zijn opgetreden:<br />";
foreach($this->error as $wa => $er){
echo " ".($wa+1).". ".$er."<br />";
}
exit();
}
elseif($g_e == "chek"){
return count($this->error);
}
}
function get_connection($host,$user,$ww,$db){
mysql_connect($host,$user,$ww) or $this->_get_error("Mysql error: ".mysql_error());
mysql_select_db($db) or $this->_get_error("Mysql error: ".mysql_error());
}
function _get_action(){
if(isset($_GET["actie"])){
$this->actie = $_GET["actie"];
}
else{
$this->actie = "";
}
}
function _get_page(){
if(isset($_GET["page"])){
$this->p = $_GET["page"];
}
else{
$this->p = 1;
}
$this->p--;
$my_nu = mysql_query("SELECT id FROM ip_log") or $this->_get_error("Mysql error: ".mysql_error());
$nu_nu = mysql_num_rows($my_nu);
$ptot = $nu_nu/$this->perp;
$ptot = ceil($ptot);
if($this->p <= 0){
$this->pp .= '<b>< Vorige</b> | ';
}
else{
$this->pp .= '<a href="?page='.$this->p.'&manier='.$this->manier.'&sort='.$this->sort.'">< Vorige</a> | ';
}
for($p = 0; $p < $ptot; $p++){
$r = $p+1;
if($r == ($this->p+1)){
$this->pp .= '<b>'.$r.'</b>';
}
else{
$this->pp .= '<a href="?page='.$r.'&manier='.$this->manier.'&sort='.$this->sort.'">'.$r.'</a>';
}
$this->pp .= ' | ';
}
if($this->p >= ($ptot-1)){
$this->pp .= '<b>Volgende ></b>';
}
else{
$this->pp .= '<a href="?page='.($this->p+2).'&manier='.$this->manier.'&sort='.$this->sort.'">Volgende ></a>';
}
}
function get_admin($gebruikersnaam, $wachtwoord) {
$this->user = $gebruikersnaam;
$this->ww = $wachtwoord;
}
function _get_session(){
if(isset($_SESSION["user"])){
$this->suser = $_SESSION["user"];
}
else{
$this->suser = "";
}
if(isset($_SESSION["ww"])){
$this->sww = $_SESSION["ww"];
}
else{
$this->sww = "";
}
if($this->suser == $this->user && $this->sww == $this->ww){
return "ja";
}
else{
return "nee";
}
}
function _get_manier() {
if(isset($_GET["manier"]) && ($_GET["manier"] == "ASC" || $_GET["manier"] == "DESC")){
$this->manier = $_GET["manier"];
if($this->manier == "ASC"){
$this->sb = "DESC";
}
else{
$this->sb = "ASC";
}
}
else{
$this->manier = "DESC";
$this->sb = "ASC";
}
}
function _get_sort(){
if(isset($_GET["sort"])){
$this->sort = $_GET["sort"];
}
else {
$this->sort = "id";
}
}
function _get_ip(){
if(isset($_GET["ip"])){
$this->gip = $_GET["ip"];
}
else{
$this->gip = "";
}
}
function _get_id(){
if(isset($_GET["id"])){
$this->id = $_GET["id"];
}
else{
$this->id = "";
}
}
function _ip(){
if(getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")){
$this->ip = getenv("HTTP_CLIENT_IP");
}
elseif (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")){
$this->ip = getenv("HTTP_X_FORWARDED_FOR");
}
elseif (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")){
$this->ip = getenv("REMOTE_ADDR");
}
elseif (isset($_SERVER["REMOTE_ADDR"]) && $_SERVER["REMOTE_ADDR"] && strcasecmp($_SERVER["REMOTE_ADDR"], "unknown")){
$this->ip = $_SERVER["REMOTE_ADDR"];
}
else{
$this->ip = "Onbekend";
}
}
function _browser() {
$http_u_a = strtolower(rawurldecode($_SERVER['HTTP_USER_AGENT']));
if(eregi('opera ([0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Opera ".$regs[1];
}
elseif(eregi('msie ([0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Microsoft Internet Explorer ".$regs[1];
}
elseif(eregi('opera/([0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Opera ".$regs[1];
}
elseif(eregi('lynx/([0-9]+\.[0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Lynx ".$regs[1];
}
elseif((eregi('bot', $http_u_a)) || (eregi('google', $http_u_a)) || (eregi('slurp', $http_u_a)) || (eregi('scooter', $http_u_a)) || (eregi('spider', $http_u_a)) || (eregi('crawler', $http_u_a)) || (eregi('archiver', $http_u_a))){
$this->br = 'Zoekmachine';
}
elseif(eregi('netscape6/([0-9]+\.[0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Netscape ".$regs[1];
}
elseif (eregi('mozilla/([0-9]+\.[0-9]+)', $http_u_a, $regs)){
$this->browser = "Netscape ".$regs[1];
}
}
function _os() {
$http_u_a = strtolower(rawurldecode($_SERVER['HTTP_USER_AGENT']));
if(eregi("(win|windows)[ ]*((nt)*[ /]*([0-9]+(.?[0-9]+))*)", $http_u_a, $regs)){
if(eregi("(win|windows)[ ](95)", $http_u_a)){
$this->os = 'Windows 95';
}
elseif(eregi("(win|windows)[ ](98)", $http_u_a)){
$this->os = 'Windows 98';
}
elseif(eregi("(win|windows)[ ](me)", $http_u_a)){
$this->os = 'Windows ME';
}
elseif(eregi("(win|windows)[ ](nt)", $http_u_a)){
if(eregi("(win|windows)[ ](nt)[ ](5.1)", $http_u_a)){
$this->os = 'Windows XP';
}
elseif(eregi("(win|windows)[ ](nt)[ ](5.0)", $http_u_a)){
$this->os = 'Windows 2000';
}
else{
$this->os = 'Windows NT';
}
}
else{
$this->os = 'Windows';
}
}
elseif(stristr($http_u_a, "linux")){
$this->os = 'Linux';
}
elseif(stristr($http_u_a, "unix")){
$this->os = 'Unix';
}
elseif(stristr($http_u_a, "mac")){
$this->os = 'MacOS';
}
elseif(stristr($http_u_a, "ppc")){
$this->os = 'MacOS';
}
else{
$this->os = 'Onbekend';
}
}
function _get_name(){
$my_ca = mysql_query("SELECT name FROM ip_log WHERE ip='".$this->ip."' AND name!='' ORDER BY id DESC LIMIT 0,1") or $this->_get_error("Mysql error: ".mysql_error());
$as_ca = mysql_fetch_assoc($my_ca);
if($as_ca == ""){
$this->name = "";
}
else{
$this->name = $as_ca["name"];
}
}
function _ref(){
if(getenv("HTTP_REFERER") && strcasecmp(getenv("HTTP_REFERER"), "unknown")){
$this->re = getenv("HTTP_REFERER");
}
elseif(isset($_SERVER["HTTP_REFERER"]) && strcasecmp($_SERVER["HTTP_REFERER"], "unknown")){
$this->re = $_SERVER["HTTP_REFERRER"];
}
elseif(isset($_SERVER["HTTP_REFERRER"])){
$this->re = $_SERVER["HTTP_REFERRER"];
}
elseif(isset($HTTP_REFERER)){
$this->re = $HTTP_REFERER;
}
else{
$this->re = "Onbekend";
}
}
function _loc(){
if(getenv("REQUEST_URI") && strcasecmp(getenv("REQUEST_URI"), "unknown")){
$this->lo = getenv("REQUEST_URI");
}
elseif(isset($_SERVER["REQUEST_URI"]) && strcasecmp($_SERVER["REQUEST_URI"], "unknown")){
$this->lo = $_SERVER["REQUEST_URI"];
}
else{
$this->lo = "Onbekend";
}
}
function _tel(){
$this->_get_name();
$da = time();
mysql_query("INSERT INTO ip_log (name, ip, host, referer, locatie, OS, browser, datum) VALUES ('".$this->name."', '".$this->ip."', '".gethostbyaddr($_SERVER["REMOTE_ADDR"])."', '".$this->re."', '".$this->lo."' , '".$this->os."', '".$this->browser."', '".$da."')") or $this->_get_error("Mysql error: ".mysql_error());
}
function _get_content(){
if($this->actie == "chek" && $this->id != ""){
$this->_tel();
$arrl = array(
"ac"=>"Ascension Island ", "ad"=>"Andorra ", "ae"=>"United Arab Emirates ", "af"=>"Afghanistan ", "ag"=>"Antigua and Barbuda ",
"ai"=>"Anguilla ", "al"=>"Albania ", "am"=>"Armenia ", "an"=>"Netherlands Antilles ", "ao"=>"Angola ", "aq"=>"Antarctica ",
"ar"=>"Argentina ", "as"=>"American Samoa ", "at"=>"Austria ", "au"=>"Australia ", "aw"=>"Aruba ", "az"=>"Azerbaijan ",
"ba"=>"Bosnia and Herzegovina ", "bb"=>"Barbados ", "bd"=>"Bangladesh ", "be"=>"Belgium ", "bf"=>"Burkina Faso ",
"bg"=>"Bulgaria ", "bh"=>"Bahrain ", "bi"=>"Burundi ", "bj"=>"Benin ", "bm"=>"Bermuda ", "bn"=>"Brunei Darussalam ",
"bo"=>"Bolivia ", "br"=>"Brazil ", "bs"=>"Bahamas ", "bt"=>"Bhutan ", "bv"=>"Bouvet Island ", "bw"=>"Botswana ",
"by"=>"Belarus ", "bz"=>"Belize ", "ca"=>"Canada ", "cc"=>"Cocos (Keeling) Islands ","cd"=>"Congo, Democratic Republic of the ",
"cf"=>"Central African Republic ", "cg"=>"Congo, Republic of ", "ch"=>"Switzerland ", "ci"=>"Cote d'Ivoire ",
"ck"=>"Cook Islands ", "cl"=>"Chile ", "cm"=>"Cameroon ", "cn"=>"China ", "co"=>"Colombia ", "cr"=>"Costa Rica ",
"cu"=>"Cuba ", "cv"=>"Cap Verde ", "cx"=>"Christmas Island ", "cy"=>"Cyprus ", "cz"=>"Czech Republic ","de"=>"Germany ",
"dj"=>"Djibouti ", "dk"=>"Denmark ", "dm"=>"Dominica ", "do"=>"Dominican Republic ", "dz"=>"Algeria ", "ec"=>"Ecuador ",
"ee"=>"Estonia ", "eg"=>"Egypt ", "eh"=>"Western Sahara ", "er"=>"Eritrea ", "es"=>"Spain ", "et"=>"Ethiopia ", "fi"=>"Finland ",
"fj"=>"Fiji ", "fk"=>"Falkland Islands (Malvina) ", "fm"=>"Micronesia, Federal State of ", "fo"=>"Faroe Islands ",
"fr"=>"France ", "ga"=>"Gabon ", "gd"=>"Grenada ", "ge"=>"Georgia ", "gf"=>"French Guiana ", "gg"=>"Guernsey ",
"gh"=>"Ghana ", "gi"=>"Gibraltar ", "gl"=>"Greenland ", "gm"=>"Gambia ", "gn"=>"Guinea ", "gp"=>"Guadeloupe ",
"gq"=>"Equatorial Guinea ", "gr"=>"Greece ", "gs"=>"South Georgia and the South Sandwich Islands ", "gt"=>"Guatemala ",
"gu"=>"Guam ", "gw"=>"Guinea Bissau ", "gy"=>"Guyana ", "hk"=>"Hong Kong ", "hm"=>"Heard and McDonald Islands ",
"hn"=>"Honduras ", "hr"=>"Croatia/Hrvatska ", "ht"=>"Haiti ", "hu"=>"Hungary ", "id"=>"Indonesia ", "ie"=>"Ireland ",
"il"=>"Israel ", "im"=>"Isle of Man ", "in"=>"India ", "io"=>"British Indian Ocean Territory ", "iq"=>"Iraq ",
"ir"=>"Iran (Islamic Republic of) ", "is"=>"Iceland ", "it"=>"Italy ", "je"=>"Jersey ", "jm"=>"Jamaica ", "jo"=>"Jordan ",
"jp"=>"Japan ", "ke"=>"Kenya ", "kg"=>"Kyrgyzstan ", "kh"=>"Cambodia ", "ki"=>"Kiribati ", "km"=>"Comoros ",
"kn"=>"Saint Kitts and Nevis ", "kp"=>"Korea, Democratic People's Republic ", "kr"=>"Korea, Republic of ",
"kw"=>"Kuwait ", "ky"=>"Cayman Islands ", "kz"=>"Kazakhstan ", "la"=>"Lao People's Democratic Republic ", "lb"=>"Lebanon ", "lc"=>"Saint Lucia ",
"li"=>"Liechtenstein ", "lk"=>"Sri Lanka ", "lr"=>"Liberia ", "ls"=>"Lesotho ", "lt"=>"Lithuania ", "lu"=>"Luxembourg ",
"lv"=>"Latvia ", "ly"=>"Libyan Arab Jamahiriya ", "ma"=>"Morocco ", "mc"=>"Monaco ", "md"=>"Moldova, Republic of ", "mg"=>"Madagascar ",
"mh"=>"Marshall Islands ", "mk"=>"Macedonia, Former Yugoslav Republic ", "ml"=>"Mali ",
"mm"=>"Myanmar ", "mn"=>"Mongolia ", "mo"=>"Macau ", "mp"=>"Northern Mariana Islands ", "mq"=>"Martinique ", "mr"=>"Mauritania ",
"ms"=>"Montserrat ", "mt"=>"Malta ", "mu"=>"Mauritius ", "mv"=>"Maldives ", "mw"=>"Malawi ", "mx"=>"Mexico ",
"my"=>"Malaysia ", "mz"=>"Mozambique ", "na"=>"Namibia ", "nc"=>"New Caledonia ", "ne"=>"Niger ", "nf"=>"Norfolk Island ",
"ng"=>"Nigeria ", "ni"=>"Nicaragua ", "nl"=>"Netherlands ", "no"=>"Norway ", "np"=>"Nepal ", "nr"=>"Nauru ",
"nu"=>"Niue ", "nz"=>"New Zealand ", "om"=>"Oman ", "pa"=>"Panama ", "pe"=>"Peru ", "pf"=>"French Polynesia ",
"pg"=>"Papua New Guinea ", "ph"=>"Philippines ", "pk"=>"Pakistan ", "pl"=>"Poland ", "pm"=>"St Pierre and Miquelon ", "pn"=>"Pitcairn Island ",
"pr"=>"Puerto Rico ", "ps"=>"Palestinian Territories ", "pt"=>"Portugal ", "pw"=>"Palau ", "py"=>"Paraguay ", "qa"=>"Qatar ",
"re"=>"Reunion Island ", "ro"=>"Romania ", "ru"=>"Russian Federation ", "rw"=>"Rwanda ", "sa"=>"Saudi Arabia ", "sb"=>"Solomon Islands ",
"sc"=>"Seychelles ", "sd"=>"Sudan ", "se"=>"Sweden ", "sg"=>"Singapore ", "sh"=>"St Helena ", "si"=>"Slovenia ",
"sj"=>"Svalbard and Jan Mayen Islands ", "sk"=>"Slovak Republic ", "sl"=>"Sierra Leone ", "sm"=>"San Marino ", "sn"=>"Senegal ", "so"=>"Somalia ",
"sr"=>"Suriname ", "st"=>"Sao Tome and Principe ", "sv"=>"El Salvador ", "sy"=>"Syrian Arab Republic ", "sz"=>"Swaziland ", "tc"=>"Turks and Caicos Islands ",
"td"=>"Chad ", "tf"=>"French Southern Territories ", "tg"=>"Togo ", "th"=>"Thailand ", "tj"=>"Tajikistan ", "tk"=>"Tokelau ",
"tm"=>"Turkmenistan ", "tn"=>"Tunisia ", "to"=>"Tonga ", "tp"=>"East Timor ", "tr"=>"Turkey ", "tt"=>"Trinidad and Tobago ",
"tv"=>"Tuvalu ", "tw"=>"Taiwan ", "tz"=>"Tanzania ", "ua"=>"Ukraine ", "ug"=>"Uganda ", "uk"=>"United Kingdom ",
"um"=>"US Minor Outlying Islands ", "us"=>"United States ", "uy"=>"Uruguay ", "uz"=>"Uzbekistan ", "va"=>"Holy See (City Vatican State) ", "vc"=>"Saint Vincent and the Grenadines ",
"ve"=>"Venezuela ", "vg"=>"Virgin Islands (British) ", "vi"=>"Virgin Islands (USA) ", "vn"=>"Vietnam ", "vu"=>"Vanuatu ", "wf"=>"Wallis and Futuna Islands ",
"ws"=>"Western Samoa ", "ye"=>"Yemen ", "yt"=>"Mayotte ", "yu"=>"Yugoslavia ", "za"=>"South Africa ", "zm"=>"Zambia ",
"zw"=>"Zimbabwe ", "aero"=>"Aviation (.aero)", "biz"=>"Business (.biz)", "coop"=>"Co-Operative Orga. (.coop)", "info"=>"Info (.info)",
"int"=>"Intern.Organisation (.int)", "name"=>"Homepage (.name)", "us"=>"Museum (.museum)", "us"=>"USA (.us)",
"org"=>"Organisation (.org)", "com"=>"Commercial (.com)", "net"=>"Network (.net)", "org"=>"Organisation (.org)",
"edu"=>"University USA (.edu)", "gov"=>"Government USA (.gov)", "mil"=>"US Army (.mil)");
$my_ch = mysql_query("SELECT * FROM ip_log WHERE id='".$this->id."'") or $this->_get_error("Mysql error: ".mysql_error());
$as_ch = mysql_fetch_assoc($my_ch);
$gbadr = $as_ch["host"];
$expad = explode(".",$gbadr);
$land = $expad[(count($expad)-1)];
$land = $arrl[$land];
$prov = $expad[(count($expad)-2)];
$pakk = $expad[(count($expad)-3)];
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Id</b></td>';
$this->r .= '<td width="50%">'.htmlentities($as_ch["id"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Os</b></td>';
$this->r .= '<td width="50%"><i>'.htmlentities($as_ch["OS"]).'</i></td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Browser</b></td>';
$this->r .= '<td width="50%"><i>'.htmlentities($as_ch["browser"]).'</i></td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Host</b></td>';
$this->r .= '<td width="50%">'.htmlentities($as_ch["host"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Ip</b></td>';
$this->r .= '<td width="50%">'.htmlentities($as_ch["ip"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Referer</b></td>';
$this->r .= '<td width="50%">'.htmlentities($as_ch["referer"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Plaats</b></td>';
$this->r .= '<td width="50%">'.htmlentities($as_ch["locatie"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Datum</b></td>';
$this->r .= '<td width="50%">'.date("d-m-Y H:i:s",$as_ch["datum"]).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Land</b></td>';
$this->r .= '<td width="50%">'.htmlentities($land).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Provider</b></td>';
$this->r .= '<td width="50%">'.htmlentities($prov).'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td width="50%"><b>Pakk</b></td>';
$this->r .= '<td width="50%">'.htmlentities($pakk).'</td>';
$this->r .= '</tr>';
$this->r .= '</table>';
}
elseif($this->actie == "admin"){
if($this->_get_session() == "nee"){
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= '<form method="post">';
$this->r .= ' <tr>';
$this->r .= ' <td width="50%"><strong>Gebruikersnaam:</strong></td>';
$this->r .= ' <td width="50%"><input type="text" name="gebruikersnaam"></td>';
$this->r .= ' </tr>';
$this->r .= ' <tr>';
$this->r .= ' <td width="50%"><strong>Wachtwoord:</strong></td>';
$this->r .= ' <td width="50%"><input type="password" name="wachtwoord"></td>';
$this->r .= ' </tr>';
$this->r .= ' <tr>';
$this->r .= ' <td width="50%"> </td>';
$this->r .= ' <td width="50%"><input type="submit" name="login" value="Login"></td>';
$this->r .= ' </tr>';
$this->r .= '</form>';
$this->r .= '</table>';
if(isset($_POST["login"])) {
$_SESSION["user"] = $_POST["gebruikersnaam"];
$_SESSION["ww"] = $_POST["wachtwoord"];
$this->_get_session();
if($this->_get_session($_POST["gebruikersnaam"], $_POST["wachtwoord"])){
header("Location: ?actie=admin");
}
else{
$this->_get_error("Je wachtwoord en/of gebruikersnaam klopt niet");
}
}
}
else{
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= ' <tr>';
$this->r .= ' <td width="100%"><a href="?actie=">Home</a></td>';
$this->r .= ' </tr>';
$this->r .= ' <tr>';
$this->r .= ' <td width="100%"><a href="?actie=reset">Iplogger resetten</a></td>';
$this->r .= ' </tr>';
$this->r .= ' <tr>';
$this->r .= ' <td width="100%"><a href="?actie=uitloggen">Uitloggen</a></td>';
$this->r .= ' </tr>';
$this->r .= '</table>';
}
}
elseif($this->actie == "uitloggen"){
if($this->_get_session() == "ja"){
$_SESSION["user"] = "";
$_SESSION["ww"] = "";
$this->_get_session();
header("Location: ?actie=");
}
else{
$this->_get_error("Je bent niet ingelogd");
}
}
elseif($this->actie == "reset"){
if($this->_get_session() == "ja"){
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= '<form method="post">';
$this->r .= ' <tr>';
$this->r .= ' <td width="100%">Weet je het zeker?</td>';
$this->r .= ' </tr>';
$this->r .= ' <tr>';
$this->r .= ' <td width="100%">Opties: <input type="submit" name="ja" value="Ja"> <input type="submit" name="nee" value="Nee"></td>';
$this->r .= ' </tr>';
$this->r .= '</form>';
$this->r .= '</table>';
if(isset($_POST["ja"])){
mysql_query("truncate table ip_log") or $this->_get_error("Mysql error: ".mysql_error());
header("location: ?actie=admin");
}
elseif(isset($_POST["nee"])) {
header("location: ?actie=admin");
}
}
else{
$this->_get_error("Je bent niet ingelogd");
}
}
elseif($this->actie == "naam" && $this->gip == $this->ip){
$this->_get_name();
$this->r .= '<form method="post">';
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= '<tr>';
$this->r .= '<td><strong>Ip adres:</strong></td>';
$this->r .= '<td><input name="ip" type="text" disabled="true" readonly="true" value="'.$_GET["ip"].'"></td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td><strong>Naam:</strong></td>';
$this->r .= '<td><input name="name" type="text" maxlength="50" value="'.htmlentities($this->name).'"></td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td> </td>';
$this->r .= '<td><input name="vnm" type="submit" value="Naam toevoegen"></td>';
$this->r .= '</tr>';
$this->r .= '</table>';
$this->r .= '</form>';
if(isset($_POST["vnm"])){
if($_POST["name"] == ""){
exit("U hebt geen naam ingegeven");
}
$this->_get_name();
$da = time();
mysql_query("INSERT INTO ip_log (ip, referer, locatie, datum, host, name) VALUES ('".$_GET["ip"]."','".$this->re."','".$this->lo."','".$da."','".gethostbyaddr($_SERVER["REMOTE_ADDR"])."', '".$_POST["name"]."')") or $this->_get_error("Mysql error: ".mysql_error());
mysql_query("UPDATE ip_log SET name='".$_POST["name"]."' WHERE ip='".$_GET["ip"]."'") or $this->_get_error("Mysql error: ".mysql_error());
header("Location: ?actie=");
}
}
elseif($this->actie == "" && $this->id == ""){
$this->_tel();
$m = $this->p*$this->perp;
$my_ip = mysql_query("SELECT * FROM ip_log ORDER BY ".htmlentities($this->sort)." ".htmlentities($this->manier)." LIMIT ".$m.",".$this->perp) or $this->_get_error("Mysql error: ".mysql_error());
$this->r .= '<table border="1" width="100%" bordercolor="#000000" style="border-collapse: collapse" cellpadding="3">';
$this->r .= '<tr>';
$this->r .= '<td width="5%"> <b><a href="?sort=id&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Id</a></b></td>';
$this->r .= '<td width="15%"><b><a href="?sort=ip&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Ip</b></td>';
$this->r .= '<td width="15%"><b><a href="?sort=name&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Naam</b></td>';
$this->r .= '<td width="30%"><b><a href="?sort=referer&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Referer</b></td>';
$this->r .= '<td width="20%"><b><a href="?sort=locatie&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Plaats</b></td>';
$this->r .= '<td width="20%"><b><a href="?sort=datum&manier='.htmlentities($this->sb).'&page='.($this->p+1).'">Datum</b></td>';
$this->r .= '</tr>';
while($as_ip = mysql_fetch_assoc($my_ip)) {
if($as_ip["ip"] == $this->ip){
$url = '<a href="?actie=naam&ip='.htmlentities($as_ip["ip"]).'">'.htmlentities($as_ip["id"]).'</a>';
}
else{
$url = $as_ip["id"];
}
$this->r .= '<tr>';
$this->r .= '<td width="5%"><b>'.$url.'</b></td>';
$this->r .= '<td width="15%"><a href="?actie=chek&id='.htmlentities($as_ip["id"]).'">'.htmlentities($as_ip["ip"]).'</a></td>';
$this->r .= '<td width="15%">'.htmlentities($as_ip["name"]).'</td>';
$this->r .= '<td width="30%">'.htmlentities($as_ip["referer"]).'</td>';
$this->r .= '<td width="20%">'.htmlentities($as_ip["locatie"]).'</td>';
$this->r .= '<td width="20%">'.date("d-m-Y H:i:s",$as_ip["datum"]).'</td>';
$this->r .= '</tr>';
}
$this->r .= '<tr>';
$this->r .= '<td colspan="6">'.$this->pp.'</td>';
$this->r .= '</tr>';
$this->r .= '<tr>';
$this->r .= '<td colspan="6"><a href="?actie=admin">Admin</a></td>';
$this->r .= '</tr>';
$this->r .= '</table>';
}
else{
exit("Er is een fout opgetreden");
}
}
function display_all($perp){
$this->perp = $perp;
$this->_get_action();
$this->_get_id();
$this->_get_ip();
$this->_get_manier();
$this->_get_sort();
$this->_get_page();
$this->_ip();
$this->_os();
$this->_get_session();
$this->_browser();
$this->_ref();
$this->_loc();
$this->_get_content();
$this->_get_error("gw");
if($this->_get_error("chek") == 0){
echo $this->r;
}
}
}
$ip = new ip;
$ip->get_connection("localhost", "", "", "");
$ip->get_admin("admin","admin");
$ip->display_all(50);
?>
</body>
</html>
<? ob_end_flush(); ?>[/syntax]