Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro
Author Message
jaded
Theme Guru


Joined: Nov 01, 2003
Posts: 1006

PostPosted: Wed Aug 16, 2006 8:05 am Reply with quote

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

_________________
Themes BB Skins Only registered users can see links on this board! Get registered or login!
Graphic Tees Only registered users can see links on this board! Get registered or login!
Paranormal Tees Only registered users can see links on this board! Get registered or login!
Ghost Stories & More Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Susann
Moderator


Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Wed Aug 16, 2006 10:17 am Reply with quote

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.
 
View user's profile Send private message
jaded
PostPosted: Wed Aug 16, 2006 10:31 am Reply with quote

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.
 
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9449
Location: Arizona

PostPosted: Thu Aug 17, 2006 5:56 am Reply with quote

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! 
View user's profile Send private message Visit poster's website
jaded
PostPosted: Thu Aug 17, 2006 6:18 am Reply with quote

Thanks Montego and Susann! I will give it a go. Smile
BTW, yes, the installer did make the changes to the tables.
 
jaded
PostPosted: Thu Aug 17, 2006 6:33 am Reply with quote

I just tried this and it works perfectly. I see what I did differently. Thanks so much!
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©