Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues
Author Message
Adrenalizer3
Regular
Regular



Joined: Jun 22, 2003
Posts: 54

PostPosted: Mon Apr 05, 2010 10:57 am Reply with quote

What specific things need changed for this to work in RN2.4 Last time I used it was in nuke 7.6 or something. Just stumbled onto it on my HD and tried to use it. No go. Something about line 26 was the error.

Any help would be greatly appreciated. Laughing

Code:
<?php

/************************************************************************************/
/* PHP-NUKE: Web Portal System                                                      */
/* ===========================                                                      */
/*                                                                                  */
/*  2001 by Francisco Burzi (fburzi@ncc.org.ve)                                     */
/*  http://phpnuke.org                                                              */
/*                                                                                  */
/* Copyright (c)Michael Yarbrough   opedog@comediccadavers.com                      */
/* http://www.comediccadavers.com/                                                  */
/*                                                                                  */
/* Copyright (c) 2003 by Jack Kozbial http://www.internetintl.com                   */
/* PHP-NUKE block : Last Seen for phpNuke 6.5                                       */
/*                                                                                  */
/* This program is free software. You can redistribute it and/or modify             */
/* it under the terms of the GNU General Public License as published by             */
/* the Free Software Foundation; either version 2 of the License.                   */
/************************************************************************************/

if (eregi("block-Last_Seen.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}
global $admin, $user, $cookie, $dbi, $prefix;
   
sql_query("CREATE TABLE IF NOT EXISTS $prefix"._lastseen."
         (id INT (15) not null AUTO_INCREMENT,
        username TEXT not null,
        date INT(15) not null,
        ip CHAR(50),
        PRIMARY KEY (id),
        UNIQUE (id))", $dbi);
       
function Lastseen_cookiedecode($user) {
    global $cookie, $prefix, $db, $user_prefix;
    $user = base64_decode($user);
    $cookie = explode(":", $user);
   
    $sql = "SELECT user_password FROM ".$user_prefix."_users WHERE username='$cookie[1]'";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $pass = $row[user_password];
    if ($cookie[2] == $pass && $pass != "") {
   return $cookie;
    } else {
   unset($user);
   unset($cookie);
    }
}
    lastseen_cookiedecode($user);
$numuser = 10; // limit number of users displayed in the list
$lastseen = $cookie[1];
$content = "";
        if (isset($lastseen)) {
                $ip = $_SERVER["REMOTE_HOST"];
                if (empty($ip)) {
                        $ip = $_SERVER["REMOTE_ADDR"];
                }
 
                $result = mysql_query("SELECT * FROM $prefix"._lastseen." WHERE username = \"$lastseen\"");
                if (mysql_num_rows($result) > 0) {
                        mysql_query("UPDATE $prefix"._lastseen." SET date = " . time() . " WHERE username = \"$lastseen\"");
                } else {
                        mysql_query("INSERT INTO $prefix"._lastseen." VALUES (\"\", \"$lastseen\", ".time().", \"".$ip."\")");
        }
}
$numuser++;
// limit number of users displayed in the list for Administrator
$numadmin = 20;
if(is_admin($admin)) {
$result = mysql_query("SELECT username, date FROM $prefix"._lastseen." ORDER BY date DESC limit 0,$numadmin");
} else {
$result = mysql_query("SELECT username, date FROM $prefix"._lastseen." ORDER BY date DESC limit 0,$numuser");
}
        while (list($lastseen, $date) = mysql_fetch_row($result)) {
                if ($lastseen != $username && $lastseen != "Array") {
                        $realtime = time() - $date;
                        $dont = false;
// Content for your Last Seen block
 $content .= "<font class=\"content\"><img src=\"images/blocks/ur-member.gif\" height=\"10\" width=\"14\">&nbsp;<a href=\"modules.php?name=Your_Account&op=userinfo&username=$lastseen\">$lastseen</a>:  ";
// how many days ago?
                        if ($realtime >= (60*60*24*2)) { // if it's been more than 2 days
                                $days = floor($realtime / (60*60*24));
                                $dont = true;
                        } else if ($realtime >= (60*60*24)) { // if it's been less than 2 days
                                $days = 1;
                                $realtime -= (60*60*24);
                        }
 
                        if (!$dont) {
                                // how many hours ago?
                                if ($realtime >= (60*60)) {
                                        //$body .= " ($realtime) ";
                                        $hours = floor($realtime / (60*60));
                                        $realtime -= (60*60*$hours);
                                }
 
                                // how many minutes ago?
                                if ($realtime >= 60) {
                                        $mins = floor($realtime / 60);
                                        $realtime -= (60*$mins);
                                }
 
                                // just a little precation, although I don't *think* mins will ever be 60...
                                if ($mins == 60) {
                                        $mins = 0;
                                        $hours += 1;
                                }
                        }
if ($dont) {
                                $content .= " ".$days." days";
                        } else {
                                if ($days > 0) {
                                        $content .= " ".$days." day".(($hours == 0 && $mins == 0)?(""):(","));
                                }
                                if ($hours > 0) {
                                        $content .= " ".$hours." ".(($hours > 1)?("hrs"):("hr")).(($mins == 0)?(""):(","));
                                }
                                if ($mins > 0) {
                                        $content .= " ".$mins." ".(($mins > 1)?("min"):("min"))."";
                                }  else { // less than a minute :)
                                        $content .= " ".$realtime." sec.";
                                }
                        }
                         $content .= " ago</font><br>\n";
 
                        $days = 0;
                        $hours = 0;
                        $mins = 0;
                        $dont = false;
      }
   }
?>
 
View user's profile Send private message
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Mon Apr 05, 2010 11:17 am Reply with quote

There may be one posted in the forums, but this is the problem. [ Only registered users can see links on this board! Get registered or login! ]

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
Adrenalizer3







PostPosted: Mon Apr 05, 2010 11:48 am Reply with quote

I read that post and re-read it, made some changes but still getting this

Code:
Fatal error: Call to undefined function sql_query() in /home1/adssetup/public_html/site/blocks/block-lastseen.php on line 26


I guess if you know php it's all clear but for me it's too much information for my little pea brain to comprehend.

Thanks anyway.
 
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Mon Apr 05, 2010 11:57 am Reply with quote

Can you paste the code from around line 26 in that file.
 
View user's profile Send private message
Adrenalizer3







PostPosted: Mon Apr 05, 2010 12:12 pm Reply with quote

I'd like to have this block working but Im not gonna stress over it. If we (you) can get it going that would be wonderful. I know you all are busy with bigger fish frying so no problems if its a pain.


Code:
sql_query("CREATE TABLE IF NOT EXISTS $prefix"._lastseen." 

         (id INT (15) not null AUTO_INCREMENT,
        username TEXT not null,
        date INT(15) not null,
        ip CHAR(50),
        PRIMARY KEY (id),
        UNIQUE (id))", $db);
 
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Mon Apr 05, 2010 12:22 pm Reply with quote

It should look like this:

Code:
global $admin, $user, $cookie, $db, $prefix;

   
$db->sql_query("CREATE TABLE IF NOT EXISTS $prefix"._lastseen."
         (id INT (15) not null AUTO_INCREMENT,
        username TEXT not null,
        date INT(15) not null,
        ip CHAR(50),
        PRIMARY KEY (id),
        UNIQUE (id))");

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
Palbin







PostPosted: Mon Apr 05, 2010 12:45 pm Reply with quote

Look for a post by spasticdonkey on the second page. He posts a link to a zip file.
[ Only registered users can see links on this board! Get registered or login! ]
 
Adrenalizer3







PostPosted: Mon Apr 05, 2010 1:43 pm Reply with quote

Worked like a champ nuken Thanks so much!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> v2.4 RN Issues

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 ©