Author |
Message |
jaded
Theme Guru
![](modules/Forums/images/avatars/447fe6544d7f95dc7157a.gif)
Joined: Nov 01, 2003
Posts: 1006
|
Posted:
Wed Aug 16, 2006 8:05 am |
|
I am trying to get all aspects of the czuser info block to work on a new ravennuke site. There is an issue that perhaps you can assist with. The installer gives you this code to change in mainfile.php. However this code is not accurate any longer. I am hoping that someone will be able to show the correct modifications. I have come close but I seem to be missing something..
Open your mainfile.php located in the main root of your site (the same place this file is). Find the function online() it looks just like this:
Code:
function online() {
global $user, $cookie, $prefix, $db;
cookiedecode($user);
$ip = $_SERVER["REMOTE_ADDR"];
$uname = $cookie[1];
if (!isset($uname)) {
$uname = "$ip";
$guest = 1;
}
$past = time()-3600;
$db->sql_query("DELETE FROM ".$prefix."_session WHERE time < '$past'");
$result = $db->sql_query("SELECT time FROM ".$prefix."_session WHERE uname='$uname'");
$ctime = time();
if ($row = $db->sql_fetchrow($result)) {
$db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$uname'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest) VALUES ('$uname', '$ctime', '$ip', '$guest')");
}
}
|
You want to replace that whole function with the one below:
Code:
function online() {
global $user, $cookie, $prefix, $db, $name;
cookiedecode($user);
$ip = $_SERVER['REMOTE_ADDR'];
$url = $_SERVER['REQUEST_URI'];
$uname = $cookie[1];
if (!isset($uname)) {
$uname = "$ip";
$guest = 1;
}
$past = time()-1800;
$db->sql_query("DELETE FROM ".$prefix."_session WHERE time < '$past'");
$result = $db->sql_query("SELECT time FROM ".$prefix."_session WHERE uname='$uname'");
$ctime = time();
$custom_title = addslashes($name);
$url = ereg_replace("&", "&", $url);
if ($uname!="") {
$uname = substr("$uname", 0,25);
if ($row = $db->sql_fetchrow($result)) {
$db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest', module='$custom_title', url='$url' WHERE uname='$uname'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest, module, url) VALUES ('$uname', '$ctime', '$ip', '$guest', '$custom_title', '$url')");
}
}
}
|
Help is greatly appreciated. Thank you in advance. ![Razz](modules/Forums/images/smiles/icon_razz.gif) |
_________________ Themes BB Skins
http://www.jaded-designs.com
Graphic Tees
http://www.cafepress.com/jadeddesigns
Paranormal Tees
http://www.cafepress.com/HauntedTees
Ghost Stories & More
http://www.hauntingtales.net |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Susann
Moderator
![](modules/Forums/images/avatars/4e3210db4efb891870d79.gif)
Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support
|
Posted:
Wed Aug 16, 2006 10:17 am |
|
I changed the mainfile php too on a 6.5 site but I believe that not all functions of this block work proper.For example Most online shows me complete wrong numbers.The PM doesn´t work correct allways. The number of the online users in the forum is wrong.(Don´t know if its through these changes.)
However, I don´t use that function"Most online" anymore. But if you have a W3C valid site there are so much html errors within this block you are busy to fix all these errors and bcause of this issue I don´t use that block for RavenNuke. Sorry, I can ´t help. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jaded
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Aug 16, 2006 10:31 am |
|
this works fine on many other sites for me with the mainfile change. However, in raven nuke the mainfile function online is very different so you cannot just copy and paste. I attempted to make the changes but went wrong somewhere.
Here is the function online for raven nuke
Code:
function online() {
global $nsnst_const, $user, $cookie, $prefix, $db;
if(!file_exists('includes/nukesentinel.php')) {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = $nsnst_const['remote_ip'];
}
$guest = 0;
if (is_user($user)) {
cookiedecode($user);
$uname = $cookie[1];
if (!isset($uname)) {
$uname = $ip;
$guest = 1;
}
} else {
$uname = $ip;
$guest = 1;
}
$past = time()-3600;
$sql = "DELETE FROM ".$prefix."_session WHERE time < '$past'";
$db->sql_query($sql);
$sql = "SELECT time FROM ".$prefix."_session WHERE uname='$uname'";
$result = $db->sql_query($sql);
$ctime = time();
if (!empty($uname)) {
$uname = substr($uname, 0,25);
$row = $db->sql_fetchrow($result);
if ($row) {
$db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest' WHERE uname='$uname'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest) VALUES ('$uname', '$ctime', '$ip', '$guest')");
}
}
$db->sql_freeresult($result);
}
|
now, the changes to be made are in my first post. Clearly it needs some tweaking. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Thu Aug 17, 2006 5:56 am |
|
Well, I don't think this is going to work on 7.6 (RN). I see that the nuke_session table does not have the additional module and url fields. However, if these were added by this tool, then something like this might get you close:
Code:
function online() {
global $nsnst_const, $user, $cookie, $prefix, $db, $name;
if(!file_exists('includes/nukesentinel.php')) {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = $nsnst_const['remote_ip'];
}
$url = $_SERVER['REQUEST_URI'];
$guest = 0;
if (is_user($user)) {
cookiedecode($user);
$uname = $cookie[1];
if (!isset($uname)) {
$uname = $ip;
$guest = 1;
}
} else {
$uname = $ip;
$guest = 1;
}
$past = time()-3600;
$sql = "DELETE FROM ".$prefix."_session WHERE time < '$past'";
$db->sql_query($sql);
$sql = "SELECT time FROM ".$prefix."_session WHERE uname='$uname'";
$result = $db->sql_query($sql);
$ctime = time();
$custom_title = addslashes($name);
$url = ereg_replace("&", "&", $url);
if (!empty($uname)) {
$uname = substr($uname, 0,25);
$row = $db->sql_fetchrow($result);
if ($row) {
$db->sql_query("UPDATE ".$prefix."_session SET uname='$uname', time='$ctime', host_addr='$ip', guest='$guest', module='$custom_title', url='$url' WHERE uname='$uname'");
} else {
$db->sql_query("INSERT INTO ".$prefix."_session (uname, time, host_addr, guest, module, url) VALUES ('$uname', '$ctime', '$ip', '$guest', '$custom_title', '$url')");
}
}
$db->sql_freeresult($result);
}
|
I have no way to test this, so you'll have to take it from here... |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jaded
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Aug 17, 2006 6:18 am |
|
Thanks Montego and Susann! I will give it a go.
BTW, yes, the installer did make the changes to the tables. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jaded
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Aug 17, 2006 6:33 am |
|
I just tried this and it works perfectly. I see what I did differently. Thanks so much! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|