://@:/?# * If query string is set, cut all other query-strings. (user settings) * 2) removes unnecessary '/./',... * 3) changes /index.* to / (user settings) */ $url = pureURL($url); /* * NEW visitor tracking through PHP in combination with JS * If we get the logid handed over by JS (jslogid), just update * the resolution/color and mp-title information of the current log. */ if (isset($jslogid) && $st == 'js') { $sql = "UPDATE $tbl_logs SET res_w = $res_w, res_h = $res_h, color = $c WHERE logid = $jslogid"; $res = mysql_query($sql); mpdl_setTitle ($url, $title); setcookie($cookie_same, $jslogid, time()+$timeout); // nothing else needs to be done here echo "document.open()\ndocument.write(' ')\ndocument.close()\n"; exit; } /* insert URL into pphl_xxxxx_mpdl table */ $entryid = insert_mpdl($url, 'mp', $tbl_mpdl, $title); /* --------------------------------------------- BROWSER-TRACKER - the heart of Power-Phlogger --------------------------------------------- */ if (isset($$cookie_same)) $logid = $$cookie_same; // case 1: cookie is around, IP may have changed else $logid = get_logid($ip); // case 2: cookie is gone, same IP /* * If it's an existing visitor who accesses the site during the $timeout, * this we're updating the logs table and are not going to log the visitor * as another unique hit. */ if ($logid) { $newpath = getNewPath($entryid,$logid); // get the current visitor path $sql = "UPDATE $tbl_logs SET t_reload = $curr_gmt_time, online = $curr_gmt_time - time, mp = mp+1"; if($newpath) $sql .= ", path='$newpath'"; // only update the path if it has changed $sql .= " WHERE logid = $logid"; $res = mysql_query($sql); // DO NOT SET COOKIE if called by st='phpjs' - cookie will be set in following st='js' if($st != 'phpjs') setcookie($cookie_same, $logid, time()+$timeout); /* * If it's a new visitor, log him... */ } else { /* * increase the user's counter */ $sql = "UPDATE $tbl_users SET hits = hits+1," . "last_access = $curr_gmt_time " . "WHERE id = $id"; $res = mysql_query($sql); $hits += 1; /* * get the top-level-domain */ if (($hostname > '') && ($hostname!=$ip)) { $tld = substr(strrchr($hostname, '.'), 1); } else { $tld = ''; } /* * get agent information */ if(isset($HTTP_USER_AGENT)) $agent = addslashes(urldecode($HTTP_USER_AGENT)); else $agent = ''; /* * extract keywords from referrer */ if (strstr($referer,'?')) { $arr_engines = load_engines(); $keywrd = show_keywords($referer, $arr_engines); if (is_array($keywrd) && $keywrd[3]) { insert_keyw($keywrd[3]); $seareng = $keywrd[2]; } else { $seareng = ''; } } else { $seareng = ''; } /* * get rid of own referrers */ $referer = removeOwnRef($referer); /* * extract agent information * If agent already exists in pphlogger_agents, just get it's ID */ $agentid = insert_agent($agent, TRUE); /* insert all log-data into the user's loglist */ $sql = "INSERT INTO $tbl_logs " . "(hostname,tld,ip,entryid,path,referer,seareng,agentid,res_w,res_h,color,time,t_reload,proxy,proxy_ip,proxy_hostname) " . "VALUES ('$hostname','$tld','$ip',$entryid,$entryid,'$referer','$seareng',$agentid,$res_w,$res_h,$c,$curr_gmt_time,$curr_gmt_time," . "'$proxy','$proxy_ip','$proxy_hostname')"; $res = mysql_query($sql); $logid = mysql_insert_id(); /* DEBUG !!! - send email to administrator*/ if(mysql_error()) { // if there was an error in the above mysql-statement, mail it to the admin $err_msg = mysql_errno().": ".mysql_error(); $err_time = date("M d, h:i:s A"); mail($admin_mail, "mysql error - ".$username, $sql.CRLF.CRLF.CRLF.$err_msg.CRLF.CRLF.$err_time, getMailheader($admin_mail)); } // DO NOT SET COOKIE if called by st='phpjs' - cookie will be set in following st='js' if($st != 'phpjs') setcookie($cookie_same, $logid, time()+$timeout); /* --------------------------------------------- MAIL-NOTIFICATION --------------------------------------------- */ if ($hit_mail > 0 && ($hits % $hit_mail) == 0) { $subject = "Log hits from ".$primary_url; $file_body_txt = CFG_MSG_PATH.'email_notif_'.$lang.'.txt'; $body_txt = fread($fp = fopen($file_body_txt, 'r'), filesize($file_body_txt)); fclose($fp); $body_txt = str_replace('{CFG_PHPEXT}',CFG_PHPEXT,$body_txt); // ugly work-around while(preg_match('/(%.+%)/U',$body_txt, $matches) == TRUE){ $matchvar = str_replace('%','',$matches[1]); $body_txt = str_replace($matches[1], $$matchvar, $body_txt); } // mail() requires a comma-separated list for multiple email $email_to = emailAdressString($email, $username, ','); mail($email_to, $subject, $body_txt, getMailheader($admin_mail)); } } } // cookie is not set | IP is blocked | Ref is blocked register_shutdown_function("pphlShutdown"); /* --------------------------------------------- VISIBILITY --------------------------------------------- */ if ($url_error || !$conf) $visible = 0; $show_txt = $hits; include INC_VISIBILITY; } // if(!defined('__MAIN_DUMMY__')) ?>