'."\n";
echo '
'.$title.'
'."\n";
# debug
if (DEBUG)
{
echo 'Query (ref): '.$query.'
';
echo 'Query (sites): '.$query_sites.'
';
echo ($global) ? 'Global: TRUE
' : 'Global: FALSE
';
echo ($sites) ? 'Sites: TRUE
' : 'Sites: FALSE
';
}
# debug
if ($loggedin)
{
if ($isAdmin && isset($refdel)) echo '
'.$rptblacklisted.'
';
echo $menu."\n";
echo '
'."\n";
echo '
'.$total.'
'."\n";
echo '
'.$form.'
'."\n"; # @@@ kluge until FormOpen() is adapted: id should actually be on form itself and div not necessary!
if(isset($_POST[FORM_SUBMIT_SEARCH_TERMS]))
{
echo '
'.$result.'
'."\n";
echo '
'."\n";
echo '';
echo ''.LIST_HEAD_SEARCH_TERM.' | ';
echo ''.LIST_HEAD_FREQ.' |
'."\n";
echo ''."\n";
echo ''."\n";
$search_terms = array();
foreach ($referrers as $referrer)
{
$hits = $referrer['num'];
if ($sites)
{
$ref = $this->htmlspecialchars_ent($referrer['host']);
}
else
{
$ref = $this->htmlspecialchars_ent($referrer['referrer']);
}
// Parse q= attributes from Google refs
//if (0 == preg_match('/http:\/\/.*google.*?\//', $ref))
if (0 == preg_match('/q=(.*?)[& ]/', $ref))
{
continue;
}
else
{
$results = array();
$num_results = preg_match('/q=(.*?)[& ]/', $ref, $results);
if(0 == $num_results)
{
continue;
}
else
{
$results2 = explode("+", strtolower($results[1]));
foreach($results2 as $result)
{
$search_terms[$result] += $hits;
}
}
}
}
arsort($search_terms);
// Output search terms
foreach($search_terms as $key=>$val)
{
echo ''."\n"; #enable alternate row color echo ''.$hits.' | ';
echo ''.$key.' | ';
echo ''.$val.' | ';
echo '
'."\n";
$r++;
}
echo ''."\n";
echo '
'."\n";
}
else if ($creferrers != 0)
{
echo '
'.$result.'
'."\n";
echo '
'."\n";
echo '';
echo ''.LIST_HEAD_HITS.' | ';
if ($isAdmin) echo ''.LIST_HEAD_ACTION.' | ';
echo ''.$refshead.' |
'."\n";
echo ''."\n";
echo ''."\n";
foreach ($referrers as $referrer)
{
$hits = $referrer['num'];
if ($sites)
{
$ref = $this->htmlspecialchars_ent($referrer['host']);
}
else
{
$ref = $this->htmlspecialchars_ent($referrer['referrer']);
}
echo ''."\n"; #enable alternate row color echo ''.$hits.' | ';
echo ''.$hits.' | ';
if ($isAdmin) echo ''.sprintf($blacklink,$ref,$redir).' | ';
if ($sites)
{
echo ''.$ref.' | ';
}
else
{
echo ''.$ref.' | ';
}
echo '
'."\n";
$r++;
}
echo ''."\n";
echo '
'."\n";
}
else
{
echo '
'.$result.'
'."\n";
echo '
'.(($sites) ? sprintf(NONE_NOTE_SITES) : sprintf(NONE_NOTE_REFERRERS)).'
'."\n";
}
}
else
{
echo '
'.LOGIN_NOTE.'
'."\n";
}
echo '
'."\n";
echo '
'."\n";
?>
%%
**Usage**
Point your browser to ##HomePage/referrers##.
Select the ##Referrers to this site## tab.
Modify the search parameters to your preference.
Click the ##Rank Search Terms## button for a list of search terms sorted by frequency.