1 infuse Aug 23, 2006 17:13
3 infuse Aug 24, 2006 03:20
cool. archives settled. someone should bring that to the b2e developers :-/
as for the referers issue, i have .htaccess configured to block out anyone who isn't supposed to be reading, so spammers aren't an issue. is it safe to reuse the plugin from dawn?
4 stk Aug 24, 2006 03:29
Urm, I believe that blueyed (a b2evo developer) was instrumental in solving the archive problem in the thread I linked. (So ... "they" know) ;)
With regards to "safe" ... that's your call. If you say
spammers aren't an issue
, then go for it.
However, much of the internal code has changed from v0.9.x to v1.x and I'd seriously doubt that it'd work without some function mods (I might be wrong, as obsolete functions are also shipped with v1.8).
Best answer ... give it a whirl. :D
Please come back and say what you did to get it working, as there might be other people for whom public stats are desirable.
Cheers,
5 infuse Aug 24, 2006 18:30
kill me for being lazy. i couldn't be bothered to dig through the docs or framework to find an answer. so i wrote some messy code. i bet theres a more secure (and easier) way of doing this.
<?php
$con = mysql_pconnect("localhost", "username", "password") or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("evo_db_name", $con);
$query = "select count(*) times, right(hit_referer,length(hit_referer)-7) referer ";
$query .= "from `evo_hitlog` ";
$query .= "where hit_referer_type = 'referer' ";
$query .= "group by hit_referer ";
$query .= "order by times desc ";
$query .= "limit 5";
$rs = mysql_query($query,$con) or die(mysql_error());
while ($row = mysql_fetch_assoc($rs)) {
$fullReferer = $row['referer'];
$referer = strtok($fullReferer, "/");
if (strpos($referer,"www.")===0)
$referer = substr($referer,4);
echo "<li><a target=\"_blank\" href=\"http://$fullReferer\">$referer</a>";
}
?>
dumped that code in a file and did an include ''; in my _main.php template.
6 edb Aug 24, 2006 18:44
You should start that file with a bit of protection since you have your login data in it.
if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
I'm also thinking you don't need to connect again since you're already connected if you're properly inside b2evolution, so you might want to play with removing the connection part.
7 stk Aug 24, 2006 19:12
LOL ... that's what I was going to say - don't worry about connecting b/c the DB should ALREADY be connected. ;)
Messy code? ... no worries (I operate on "YAY ... it works" method of coding. It ain't messy if it works!!) :D
My coding may be dangerous, but it's never neat. :|
8 infuse Aug 24, 2006 19:15
sounds good. so whats the name of the connection that b2e has created?
9 stk Aug 24, 2006 19:46
Hmmm ... I don't know, but I've never used a "name". I just plow in with a mysql_query and go from there.
10 infuse Aug 24, 2006 19:48
OH! right. my php is getting rusty haha
11 yabba Aug 24, 2006 19:52
You should look into the db class (inc/misc/_db.class.php in 1.8.summat) ;)
¥
infuse,
I believe that the top-referrers/stats.php file has been deprecated, in newer versions of the software.
(Spammers were utilizing the stats page to get inbound links and higher page rankings to their spammy pages.)
http://b2evolution.net/news/2005/09/15/b2evolution_0_9_1_dawn_released - indicates that public stats were removed as of this version.
I think you'll have to hack that functionality back in, if you really want it, but I wouldn't recommend it.
Regarding the archives problem, you may find an answer to that problem [url=http://forums.b2evolution.net/viewtopic.php?t=8951]in this thread[/url].
Hope this helps.