note 37919 added to function.eregi

From: Date: Tue, 02 Dec 2003 08:28:47 +0000
Subject: note 37919 added to function.eregi
Groups: php.notes 
Request: Send a blank email to php-notes+get-61256@lists.php.net to get a copy of this message
Was wanting to use this script on my server, but it requires global_settings to be 'On' (which my host does not allow), my question is can it be re-written to work with them 'Off' ?? Thanks in advance to anyone who takes the time to re-write this for me. :) if (!eregi($HTTP_HOST, $HTTP_REFERER)) { if ($HTTP_REFERER) { // We want to know only the main server, without any subdirectories $http_referer = substr($HTTP_REFERER, 0, strpos($HTTP_REFERER, "/", strpos($HTTP_REFERER, "//")+2)); $sql = "SELECT * FROM " . REFERERS_TABLE . " WHERE REFERER_HTTP = '$http_referer'"; if (!$query = $db->sql_query($sql)) { // message_die(GENERAL_ERROR, 'Could not obtain referers information', '', __LINE__, __FILE__, $sql); } $result = $db->sql_fetchrow($query); if (!$result) { $firstvisit = time(); $sql = "INSERT INTO " . REFERERS_TABLE . " (referer_http, referer_hits, referer_firstvisit) VALUES ('$http_referer', '1', $firstvisit)"; if (!$result = $db->sql_query($sql)) { // message_die(GENERAL_ERROR, 'Could not insert new referer', '', __LINE__, __FILE__, $sql); } } else { $lastvisit = time(); $sql = "UPDATE " . REFERERS_TABLE . " SET referer_hits = $result[referer_hits]+1, referer_lastvisit = $lastvisit WHERE referer_http = '$http_referer'"; if (!$result = $db->sql_query($sql)) { // message_die(GENERAL_ERROR, 'Could not update referers information', '', __LINE__, __FILE__, $sql); } } } } ---- Manual Page -- http://www.php.net/manual/en/function.eregi.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37919 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37919&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37919&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#61256) next »