Changeset 462 for trunk/includes/global_function.php
- Timestamp:
- Apr 14, 2010, 6:58:33 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/global_function.php
r460 r462 536 536 } 537 537 538 function LogRefer al()538 function LogReferrer() 539 539 { 540 540 global $System; 541 541 542 if(array_key_exists('HTTP_REFERER', $_SERVER)) $Referer = addslashes($_SERVER['HTTP_REFERER']); 543 else $Referer = ''; 544 $Referer = substr($Referer, strpos($Referer, '/') + 2); 545 $HostName = substr($Referer, 0, strpos($Referer, '/')); 546 if(substr($HostName, -1) == '.') $HostName = substr($HostName, 0, -1); 547 //if($HostName != gethostbyname($HostName)) 548 { 549 $Referer = 'http://'.$HostName.'/'; 550 $System->Database->query('REPLACE INTO `Referal` (`Web`, `DateFirst`, `DateLast`, `LastURL`) VALUES ("'.$Referer.'", NOW(), NOW( ), "'.addslashes($_SERVER['HTTP_REFERER']).'")'); 542 if(array_key_exists('HTTP_REFERER', $_SERVER)) 543 { 544 $Referrer = addslashes($_SERVER['HTTP_REFERER']); 545 $HostName = substr($Referrer, strpos($Referrer, '/') + 2); 546 $HostName = substr($HostName, 0, strpos($HostName, '/')); 547 if($HostName != $System->Config['Web']['Host']) 548 { 549 $DbResult = $System->Database->query('SELECT `Id` FROM `Referrer` WHERE `Web` = "'.$HostName.'"'); 550 if($DbResult->num_rows > 0) 551 { 552 $DbRow = $DbResult->fetch_assoc(); 553 $System->Database->query('UPDATE `Referrer` SET `DateLast` = NOW(), `LastURL` = "'.addslashes($Referrer).'" WHERE `Id` = '.$DbRow['Id']); 554 } else $System->Database->query('INSERT INTO `Referrer` (`Web`, `DateFirst`, `DateLast`, `LastURL`) VALUES ("'.$HostName.'", NOW(), NOW( ), "'.addslashes($Referrer).'")'); 555 } 551 556 } 552 557 }
Note:
See TracChangeset
for help on using the changeset viewer.