Author |
Message |
Adrenalizer3
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jun 22, 2003
Posts: 54
|
Posted:
Mon Apr 05, 2010 10:57 am |
|
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.
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\"> <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;
}
}
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Mon Apr 05, 2010 11:17 am |
|
There may be one posted in the forums, but this is the problem. http://www.ravenphpscripts.com/postt16627.html |
_________________ "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. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Adrenalizer3
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Apr 05, 2010 11:48 am |
|
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. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
jakec
Site Admin
![](modules/Forums/images/avatars/502a2d1345d88a86ddb4a.png)
Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Mon Apr 05, 2010 11:57 am |
|
Can you paste the code from around line 26 in that file. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Adrenalizer3
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Apr 05, 2010 12:12 pm |
|
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);
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/3234de284ee21bd39eecd.jpg)
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Mon Apr 05, 2010 12:22 pm |
|
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))");
|
|
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Apr 05, 2010 12:45 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Adrenalizer3
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Apr 05, 2010 1:43 pm |
|
Worked like a champ nuken Thanks so much! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|