vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Last XX Posts on non-vB page (https://vborg.vbsupport.ru/showthread.php?t=12324)

Gutspiller 01-07-2004 06:01 AM

I am using this hack right here: http://www.3dnewz.com/forumz/allnewspage.php but it's reporting the wrong date. Why is it doing that and how can I fix it?

gmarik 01-08-2004 10:49 PM

Is this the dunamic scroll srcipt

Gutspiller 01-09-2004 10:18 PM

Quote:

Originally Posted by gmarik
Is this the dunamic scroll srcipt

I don't think this script scrolls at all without the help of another script inside an iframe. Are you talking in general about the hack in this thread, or to me and my post above?

eob 01-09-2004 10:42 PM

Just installed it TubeD, took a bit of hacking around to get it to display the way I wanted to, but it's a brilliant script, works perfectly with VB3, and does exactly what it says on the tin.

10/10

grandeur_69 01-09-2004 10:51 PM

in last10.php ... change line 189 from
Code:

$fd = date($fdt,$threads[lastpost]);
to
Code:

$fd = vbdate($fdt,$threads[lastpost]);
to make use of vbulletin's time

Gutspiller 01-14-2004 04:16 AM

Quote:

Originally Posted by grandeur_69
in last10.php ... change line 189 from
Code:

$fd = date($fdt,$threads[lastpost]);
to
Code:

$fd = vbdate($fdt,$threads[lastpost]);
to make use of vbulletin's time

Thanks grandeur_69. I have one more question, I have that hack that if it was posted today, it says "Today" and if yesterday, it says "Yesterday". The problem is, is that I have those as black text on my forums, well the black text doesn't work on where I'm putting this last10 thing. I tried changing:

PHP Code:

echo("<td HEIGHT=\"25\" bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:90959E;\" align=\"center\">$fd</td>\n"); 

into this:

PHP Code:

echo("<td HEIGHT=\"25\" bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs;\" align=\"center\"><font color=90959E>$fd</font></td>\n"); 

but the text continues to stay black. Any ideas on how to change the color when using it in last10, yet still have it the original color it is now on my forums?

Thanks for any help, anybody can provide.

Ryan McBain 01-22-2004 08:49 PM

I changed my password and I get this error on my front page

Warning: mysql_connect(): Access denied for user: 'ryanmcba@localhost' (Using password: YES) in /home/ryanmcba/public_html/last10.php on line 15
Can't open connection to MySQL

I changed the password in my config.php file and I still get this. Im guessing I have to change my password some where else. What do I do?

mossyuk 01-27-2004 12:42 PM

does this work with vb3?

mossyuk 01-27-2004 12:48 PM

and in answer to my own question, yes it does :) :D Nice 1.

tigerroar 02-02-2004 03:02 PM

nice one, this is just what I wanted.

It's working nicely here :cool:

grandeur_69 02-02-2004 04:15 PM

Gutspiller,
I actually had similar problems with changing the colors, so i stripped most of the other code out and manually coded the html ... be aware of the style sheets that vB uses, and it can make your life a bit easier on the recoding.

OneTake 03-30-2004 02:37 AM

Quote:

Originally Posted by Gutspiller
I am using this hack right here: http://www.3dnewz.com/forumz/allnewspage.php but it's reporting the wrong date. Why is it doing that and how can I fix it?

How'd you get away with opening your adsense links in a new window? They won't even let me run ads on a page that opens in a new window.... grrrr ;)

Onetake

oman 03-30-2004 09:08 PM

its dosnt work with vb3 gold

or jest with me the problem

its give this note

Fatal error: main(): Failed opening required '/nabdhat/includes/config.php'
and
Warning: main(/nabdhat/includes/config.php): failed to open stream: No such file or directory

but the directory is correct

sabret00the 04-03-2004 01:25 PM

Quote:

Originally Posted by oman
its dosnt work with vb3 gold


or jest with me the problem

its give this note

Fatal error: main(): Failed opening required '/nabdhat/includes/config.php'
and
Warning: main(/nabdhat/includes/config.php): failed to open stream: No such file or directory

but the directory is correct

i don't beleive this does work with vb3

however a similar version have been realsed for vb3 gold :)

kirupa 04-06-2004 12:26 AM

Quote:

Originally Posted by sabret00the
i don't beleive this does work with vb3

however a similar version have been realsed for vb3 gold :)

Hey sabre,
I have tried searching for a similar hack for vb3, but I can't seem to find it. Would it be possible for you to provide me with a URL to the vb3 version of a similar hack?

Thanks!
Kirupa :)

sabret00the 04-21-2004 02:07 PM

<a href="https://vborg.vbsupport.ru/showthread.php?t=62624" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=62624</a>

sbryan 06-06-2004 01:34 PM

hi guys. for reasons i wont go into, im using an iFrame and displaying the last10.php file through as as when i tried to include it, it threw out other info on the page.

i want to set the links so that they load in the parent window. i tried adding target="_parent" to these lines..

Quote:

echo("<a href=\"$url/forumdisplay.php?forumid=$threads[forumid]\" style=\"color: $lc;\" >$threads[ftitle]</a>: ");
}
echo("<a href=\"$url/showthread.php?threadid=$threads[threadid]&goto=newpost\" style=\"color: $lc;\" title=\"$threads[title]\">$title</a></nobr></td>\n");
// last poster column?
if ($lastposter == "1") {
echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"center\"><a href=\"$url/member.php?action=getinfo&userid=$threads[userid]\" style=\"color: $lc;\">$threads[lastposter]</a></td>\n");
but it keeps giving an error. is it possible to use normal html in this code to link in a css file and apply custom classes as well as this link option?

*edit*

i worked it out :-) you cant use normal html, i had to use target=\"parent\" and then it worked :D

jp2 08-08-2004 09:25 AM

installed, nice hack man.. thanks.

paulmjno 10-11-2004 05:12 PM

Thank you very much for this. :)

I required a simple list of recent postings rather than to display all that information. So, I changed all the HTML in the hack to suit my needs, maybe someone else will also find this useful?:
PHP Code:

<?

//...........Last X Posts v1.0.5...........\\
//......by Kevin (kevin@tubescan.com)......\\

// For vBulletin version 2 (betas 3, 4, 5, RC1, RC2, RC3)
// (c) 2001 Jelsoft Enterprises, Ltd.

// vBulletin.com thread: http://www.vbulletin.com/forum/showthread.php?threadid=12324

// let's get connected
require("last10config.php");
require("$path/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");

// the base WHERE statement
$wheresql = "WHERE thread.lastposter=user.username AND thread.open!='10'";

// we can't have both the last 24 hours *and* the last 7 days, so error out if needed
if ($last24 == "1" && $last7 == "1") {
    print("Error: \$last24 and \$last7 are both set to 1. Please change one of them to 0.");
    exit;
}
// otherwise we're gonna find out which one it is
// last 24
if ($last24 == "1") {
    $time = time()-86400;
    $wheresql .= " AND thread.lastpost>'$time'";
}
// last 7
if ($last7 == "1") {
    $time = time()-604800;
    $wheresql .= " AND thread.lastpost>'$time'";
}
// are we trying to exclude *and* include forums? if so, error out
if ($excludeforums != "" && $includeforums != "") {
    print("Error: \$includeforums and \$excludeforums are both set with numbers. Please remove the numbers from <b>one</b> of these two to proceed.");
    exit;
}
// otherwise figure out which one we're using
// include forums
if ($includeforums == "" or $includeforums <= "0") {
    $quarter = "no";
} else {
    $incfid = explode(",",$includeforums); $i = 0; $a = count($incfid);
    if ($a > 1) {
        $wheresql .= " AND (thread.forumid='$incfid[0]'";
        ++$i;
        while ($i < $a) {
            $wheresql .= " OR thread.forumid='$incfid[$i]'"; ++$i;
        }
        $wheresql .= ")";
    } else {
        $wheresql .= " AND thread.forumid='$incfid[$i]'";
    }
}
// or exclude forums
if ($excludeforums == "" or $excludeforums <= "0") {
    $quarter = "no";
} else {
    $excfid = explode(",",$excludeforums); $i = 0; $a = count($excfid);
    while ($i < $a) {
        $wheresql .= " AND thread.forumid!='$excfid[$i]'";    ++$i;
    }
}
if ($showforumtitle == "1") {
    $ftitle = ",forum";
    $fsel = ",forum.title AS ftitle";
    $wheresql .= " AND thread.forumid=forum.forumid";
}
// ooh a query!
$query = "SELECT thread.lastpost,thread.title,thread.lastposter,thread.replycount,thread.views,user.userid,thread.threadid,thread.forumid$fsel,thread.iconid FROM thread,user$ftitle $wheresql ORDER BY thread.$ob $obdir LIMIT $maxthreads";
// let's get the info
$tr = mysql_query($query) or die("MySQL reported this error while trying to retreive the info: ".mysql_error());
$dtf = mysql_query("SELECT value FROM setting WHERE varname='dateformat' OR varname='timeformat' OR varname='timeoffset' ORDER BY varname");
$df = mysql_result($dtf,0,0);
$tf = mysql_result($dtf,1,0);
$tof = mysql_result($dtf,2,0);
if ($showdate == "1") {
    $fdt = "$df $tf";
} else {
    $fdt = "$tf";
}
$cols = 1;
// let's display the info
while ($threads = mysql_fetch_array($tr)) {    
    // are we going to show the message too?
    if ($showmessages == "1") {
        $query0 = "SELECT pagetext,postid,dateline,iconid FROM post WHERE threadid='$threads[threadid]' ORDER BY dateline DESC LIMIT 1";
        $lastpost = mysql_query($query0) or die("MySQL reported this error while trying to retrieve the last post info: ".mysql_error());
        while ($lastpost1 = mysql_fetch_array($lastpost)) {
            $lastpostshort = $lastpost1[pagetext];
            $postii = $lastpost1[iconid];
        }
        if (strlen($lastpostshort) > $lplen) {
            $lastpostshort = substr($lastpostshort,0,$lplen);
            $lastpostshort .= "...";
        }
        $smilies = mysql_query("SELECT smilietext,smiliepath FROM smilie");
        while ($smiles = mysql_fetch_array($smilies)) {
            $lastpostshort = str_replace($smiles[smilietext],"<img src=\"".$url."/".$smiles[smiliepath]."\" border=0>",$lastpostshort);
        }
        if ($nb == "1") {
            $lastpostshort = nl2br($lastpostshort);
        }
        $lastpostshort = str_replace("[i]","<i>",$lastpostshort);
        $lastpostshort = str_replace("[/i]","</i>",$lastpostshort);
        $lastpostshort = str_replace("[u]","<u>",$lastpostshort);
        $lastpostshort = str_replace("[/u]","</u>",$lastpostshort);
        $lastpostshort = str_replace("[b]","<b>",$lastpostshort);
        $lastpostshort = str_replace("[/b]","</b>",$lastpostshort);
        $lastpostshort = str_replace("[quote]","<br>quote:<br><hr> ",$lastpostshort);
        $lastpostshort = str_replace("[/quote]"," <hr><br>\n",$lastpostshort);
        $lastpostshort = str_replace("[I]","<i>",$lastpostshort);
        $lastpostshort = str_replace("[/I]","</i>",$lastpostshort);
        $lastpostshort = str_replace("[U]","<u>",$lastpostshort);
        $lastpostshort = str_replace("[/U]","</u>",$lastpostshort);
        $lastpostshort = str_replace("[B]","<b>",$lastpostshort);
        $lastpostshort = str_replace("[/B]","</b>",$lastpostshort);
        $lastpostshort = str_replace("[QUOTE]","<br>quote:<br><hr> ",$lastpostshort);
        $lastpostshort = str_replace("[/QUOTE]"," <hr><br>\n",$lastpostshort);
        $lastpostshort = str_replace("[CODE]","<br>code:<br><hr> ",$lastpostshort);
        $lastpostshort = str_replace("[/CODE]"," <hr><br>\n",$lastpostshort);
        $lastpostshort = str_replace("[code]","<br>code:<br><hr> ",$lastpostshort);
        $lastpostshort = str_replace("[/code]"," <hr><br>\n",$lastpostshort);
        $lastpostshort = str_replace("[img]https://vborg.vbsupport.ru/[/img]","",$lastpostshort);
        $lastpostshort = str_replace("[img]https://vborg.vbsupport.ru/[/img]","",$lastpostshort);
        $lastpostshort = str_replace("[url]","",$lastpostshort);
        $lastpostshort = str_replace("[/url]","",$lastpostshort);
        $lastpostshort = str_replace("[URL]","",$lastpostshort);
        $lastpostshort = str_replace("[/URL]","",$lastpostshort);
    }
    // thanks to kier for this idea to do the alternating row colors
    if (($counter++ % 2) != 0) {
        $bc=$bc1;
    } else {
        $bc=$bc2;
    }
    // if the title is more than $len characters, we need to cut it off and add ... to the end
    if (strlen($threads[title]) > $len) { 
        $title = substr($threads[title],0,$len);
        $title .= "...";
    } else { 
        $title = $threads[title];
    }
    // convert the date to a format readable by non-unix geeks :)
    $fd = date($fdt,$threads[lastpost]);
    echo("<li>");
    if ($showforumtitle == "1") {
        echo("<a href=\"$url/forumdisplay.php?forumid=$threads[forumid]\">$threads[ftitle]</a>: ");
    }
    echo("<a href=\"$url/showthread.php?threadid=$threads[threadid]&goto=newpost\" title=\"$threads[title]\">$title</a></li>\n");
    // last poster column?
    if ($lastposter == "1") {
        echo("<li><a href=\"$url/member.php?action=getinfo&userid=$threads[userid]\">$threads[lastposter]</a></li>\n");
        ++$cols;
    }
    // replies column?
    if ($replies == "1") {
        echo("<li>$threads[replycount]</li>\n");
        ++$cols;
    }
}
?>

When including the file, be sure to wrap the include in <ul>'s.

Gutspiller 10-13-2004 09:44 PM

Maybe we can see an example of what your modifications do?

Brad 11-16-2004 06:41 AM

The attached file is a patched version that will fix the security bug reported here:

http://www.securityfocus.com/bid/11658/info/
http://www.securitytracker.com/id?1012197
http://www.vbulletin.com/forum/showthread.php?t=120915
https://vborg.vbsupport.ru/showthread.php?t=71772

SaN-DeeP 11-16-2004 07:31 AM

Quote:

Originally Posted by sabret00the

I AM getting error - you do not have permission to access this page.
whats the vb 3.x version of this hack :) ?

dellow 11-27-2004 11:06 AM

hello ,,

i just recive a message from some visitor , he said that this hack can allow others to get admin user & password if click on this link :

http://www.domain.com/last.php?fsel=...6%20LIMIT%201/

the full link is :
PHP Code:

last.php?fsel=,user.password%20as%20title,user.%20%20username%20as%20lastposter%20FROM%20user,thread%20%20%20WHERE%20usergroupid=6%20LIMIT%201/* 


is this true ? i have noi idea ..

regards,

FLASHGROUP 12-01-2004 02:08 PM

hi,
has anybody else had problems with the links if you select to show part of the post?
my links show up as [ U R L ] somedomain.com [ / u r l ] ie. in VB code so the link is not working at all :( can anybody help....

so in short does the Parses [ url ] work for everyone else????

cheers
Darren

aldamon 01-10-2005 01:12 PM

Quote:

Originally Posted by Brad.loo

Your file didn't work for me, but I'm on 3.0.5 now. The original file still works fine.

munkeh 01-23-2005 03:46 PM

right im having a problem with this code
Code:

$query = "SELECT thread.lastpost,thread.title,thread.lastposter,thread.replycount,thread.views,user.userid,thread.threadid,thread.forumid$fsel,thread.iconid FROM thread,user$ftitle $wheresql ORDER BY thread.$ob $obdir LIMIT $maxthreads";
Thats on line 115 of the file

I assume it has something to do with
Code:

// destroy some var's to prevent SQL injection (patch by Brad.loo, added 11/16/04)
unset($fsel, $ftitle, $wheresql, $ob, $obdir, $maxthreads);

the error is
Code:

MySQL reported this error while trying to retreive the info: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 5' at line 1
Edit: the problem is only in the patched version

Grethe 01-24-2005 05:15 PM

Dummy Inc. here. This php stuff is killing me :(


I installed the hack on both my localserver (running winXP, Apache for Windows) and my host. Both have SSI enabled. I get this very encouraging error message:

An error occurred while processing this directive

Very informative. Here's how my php10config looks:

---snip----

/////////////// CONFIG ///////////////
//
$path = "localhost/vbulletin/includes"; // path to your config.php file (usually in the /admin directory) - NO TRAILING SLASH! Do not include "config.php"
$url = "localhost/vbulletin"; // URL to your board - NO TRAILING SLASH!
$urlimg = "localhost/vbulletin/images/smilies"; // URL to your board's images - NO TRAILING SLASH!
$maxthreads = "10"; // max threads to show. will show less if $last24 or $last7 limits it to less results than this number
$ob = "lastpost"; // set to one of the following: replycount , views , lastposter , title , lastpost (lastpost is most popular. it's the thread most recently replied to, then the second-to-last most recent, etc.)
$obdir = "desc"; // which direction to sort? "desc" goes from bottom to top (9 to 1, z to a, etc.). "asc" goes top to bottom (1 to 9, a to z, etc.). if you use lastpost for $ob, leave this set to desc or it will not work correctly!
$last24 = "0"; // 1 = last 24 hours; 0 = all (must set this to 0 if $last7 is set to 1)
$last7 = "0"; // 1 = last 7 days; 0 = all (must set this to 0 if $last24 is set to 1)
$bc1 = "#696969"; // first alt color
$bc2 = "#5c5c5c"; // second alt color
$hc = "#999999"; // head background color
$lc = "#EEEEEE"; // link color
$tc = "#FFFFFF"; // text color
$f = "Verdana"; // font face
$fs = "8"; // font size in points - 8 is normal, 6 is on the small side, 10 on the large side. play around with it. :)
$lastposter = "0"; // show last poster? 1 = yes; 0 = no
$views = "0"; // show view count? 1 = yes; 0 = no
$replies = "0"; // show reply count? 1 = yes; 0 = no
$lastpostdate = "1"; // show last post date and time? 1 = yes; 0 = no
$len = 25; // maximum number of characters of the title to show. e.g. if the title is 60 characters and this is set to 25, only the first 25 characters of the title will be shown (followed by ...)
$excludeforums = ""; // if you want to exclude a forum, put it's ID here. more than one, seperate them with commas, NO SPACES! e.g. 1,2,3,4
$includeforums = ""; // if you only want to include certain forums, put their ids here. separate more than one with commas, NO SPACES! e.g. 1,2,3,4
$showmessages = "0"; // show the text of the last post too? 1 = yes; 0 = no
$lplen = "300"; // character length of last post text (if $showmessages is set to 0 this won't do anything).
$tw = ""; // width of the table that shows the info, in either a percent ( e.g. 95% ) or in pixels ( e.g. 300 ). leave blank if you want the table to be sized naturally
$showdate = "0"; // show the date, as well as the time? if the posts that show up in the list are likely to all be from today (or you set $last24 to "1"), you can set this to 0. if the posts are spread over multiple days, you probably want this set to 1.
$cs = "0"; // this is the cellspacing. 1 makes a thin line around the cells. 0 makes no line.
$showicon = "1"; // shows the posts' icon next to the post
$showforumtitle = "0"; // shows the forum title (linked to that forum) next to the thread title
$nb = "0"; // do you want breaks in text to appear as such? this may cause problems if there are large breaks in the text
//
///////////// END CONFIG /////////////

---- snip------

The simpletest.shtml I'm running to test is situated in the localhost/vbulletin directory and looks like this:

<HTML>
<HEAD>
<TITLE>Untitled Page</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY>
<!--#include file="http://localhost/vbulletin/last10.php"-->

</BODY>
</HTML>



What do I do wrong???????? PS. Running vBulletin 3.0.5 (will update to 3.0.6 when or if I get this working)

Thanking bunches in advance for any help!!!!!

sandman1970 02-06-2005 06:10 AM

hi all,

this hack looks great, anyway I use VB 3.0.0 beta x, so the hack does not work for me :(

i need to put 1-2 links of new posts of 1 forum into another forum,
is there any most SIMPLE way?

Many thx for help.

alderwazeh 02-13-2005 10:10 AM

How can I make this great hack work as well in VBadvance portal CMPS... what variables should I set in the default setting their for enabling this hach to work as well in my Poratl vbadvanced CMPS ?

sirbutts 02-13-2005 07:06 PM

this hacks awesome! thank you so much. my forum members absolutely love it.

alderwazeh 02-13-2005 07:19 PM

How can I make this great hack work as well in VBadvance portal CMPS... what variables should I set in the default setting their for enabling this hach to work as well in my Poratl vbadvanced CMPS ?

gator777 03-12-2005 09:42 PM

Quote:

Originally Posted by Brad.loo

I got this error message when viewing the last10.php

PHP Code:

MySQL reported this error while trying to retreive the infoYou have an error in your SQL syntaxCheck the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT' at line 1 

Also, I have a dbprefix of "vb3_", so would that effect it also?

slinky 03-13-2005 03:52 AM

I'm trying to put this hack into a templated CMS. Unfortunately it doesn't allow you to simply paste PHP code into the template and suffice it to say that putting it into the PHP is an incredible pain like you cannot believe. What I need to do is create an output stream that is the HTML captured so that I can put it into a templating system in a CMS like evoarticles like Miraserver has instructions to do. Has anyone been able to do this with the use of a few simple lines so that the output could be captured to a variable that is in HTML format?

torcida 03-13-2005 07:56 AM

I was trying to put this hack work for 3.0.7. but i can't manage to do that.. Do anyone have done this?

Meirion 03-15-2005 11:04 AM

Quote:

Originally Posted by gator777
I got this error message when viewing the last10.php

PHP Code:

MySQL reported this error while trying to retreive the infoYou have an error in your SQL syntaxCheck the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT' at line 1 

Also, I have a dbprefix of "vb3_", so would that effect it also?


Hmm I get that too....grrr
But only with the 'security bugfixed' version of the last10.php file that was posted on the previous page by someone. Using last10.php from the ZIP file works fine, but is it safe to use?

Meirion 03-15-2005 11:07 AM

Quote:

Originally Posted by Grethe
Dummy Inc. here. This php stuff is killing me :(

The simpletest.shtml I'm running to test is situated in the localhost/vbulletin directory and looks like this:

<HTML>
<HEAD>
<TITLE>Untitled Page</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY>
<!--#include file="http://localhost/vbulletin/last10.php"-->

</BODY>
</HTML>



What do I do wrong???????? PS. Running vBulletin 3.0.5 (will update to 3.0.6 when or if I get this working)

Thanking bunches in advance for any help!!!!!

<!--#include file="http://localhost/vbulletin/last10.php"-->
that is what you are doing wrong

As far as I know you need to put the absolute path to the file you want to include, not a web address.

ie something like "/home/username/www/vbulletin/last10.php"
but will obviously depend on your server

Meirion 03-15-2005 11:16 AM

Quote:

Originally Posted by Brad.loo

This patched version didn't work for me unfortunately.
It gave my the "error in mysql near LIMIT 1" error.

Here's how to fix it... in last10.php change this....

Code:

// let's get connected
require("last10config.php");
require("$path/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");

// destroy some var's to prevent SQL injection (patch by Brad.loo, added 11/16/04)
unset($fsel, $ftitle, $wheresql, $ob, $obdir, $maxthreads);

$hfs = $fs+2;

to this....

Code:

// destroy some var's to prevent SQL injection (patch by Brad.loo, added 11/16/04)
unset($fsel, $ftitle, $wheresql, $ob, $obdir, $maxthreads);

// let's get connected
require("last10config.php");
require("$path/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");

$hfs = $fs+2;

should work now. The unset needs to come first else it destroys some of the required variables that were set up in last10config.php
Hope that hasn't defeated the point of the security fix, correct me if I am wrong please, Brad.loo or someone else!

Meza

gator777 03-16-2005 02:56 AM

This worked, but I am still having the issue with the fact that it is not allowing for the DBprefix I added (vb3_). It cannot find the tables. I wish someone could tell me a workaround for this. :)

LamBras 03-19-2005 12:08 PM

I have a problem showing the original author of the thread. Sort by dateline instead of lastpost is working fine. MySQL queries for original author is looking fine to me. :ermm:
Script is located at http://www.dvdboard.de/news.php

I used the code provided in this thread and attached my files below (removed all comments so it's easier to read).

Thank you for any kind of help.


configfile:
PHP Code:

<?
$path = "forum/admin"; // path to your config.php file (usually in the /admin directory) - NO TRAILING SLASH! Do not include "config.php"
$url = "http://www.dvdboard.de/forum"; // URL to your board - NO TRAILING SLASH!
$urlimg = "http://images.dvdboard.de"; // URL to your board's images - NO TRAILING SLASH!
$maxthreads = "20"; // max threads to show. will show less if $last24 or $last7 limits it to less results than this number
$ob = "dateline"; // set to one of the following: replycount , views , lastposter , title , lastpost (lastpost is most popular. it's the thread most recently replied to, then the second-to-last most recent, etc.)
$obdir = "desc"; // which direction to sort? "desc" goes from bottom to top (9 to 1, z to a, etc.). "asc" goes top to bottom (1 to 9, a to z, etc.). if you use lastpost for $ob, leave this set to desc or it will not work correctly!
$last24 = "0"; // 1 = last 24 hours; 0 = all (must set this to 0 if $last7 is set to 1)
$last7 = "1"; // 1 = last 7 days; 0 = all (must set this to 0 if $last24 is set to 1)
$bc1 = "#DCDCDC"; // first alt color
$bc2 = "#CDCDCD"; // second alt color
$hc = "#A3B9D0"; // head background color
$lc = "#000020"; // link color
$tc = "#000000"; // text color
$f = "Verdana"; // font face
$fs = "8"; // font size in points - 8 is normal, 6 is on the small side, 10 on the large side. play around with it. :)
$lastposter = "1"; // show last poster? 1 = yes; 0 = no
$views = "0"; // show view count? 1 = yes; 0 = no
$replies = "1"; // show reply count? 1 = yes; 0 = no
$lastpostdate = "1"; // show last post date and time? 1 = yes; 0 = no
$len = 150; // maximum number of characters of the title to show. e.g. if the title is 60 characters and this is set to 25, only the first 25 characters of the title will be shown (followed by ...)
$excludeforums = ""; // if you want to exclude a forum, put it's ID here. more than one, seperate them with commas, NO SPACES! e.g. 1,2,3,4
$includeforums = "109"; // if you only want to include certain forums, put their ids here. separate more than one with commas, NO SPACES! e.g. 1,2,3,4
$showmessages = "0"; // show the text of the last post too? 1 = yes; 0 = no
$lplen = "300"; // character length of last post text (if $showmessages is set to 0 this won't do anything).
$tw = ""; // width of the table that shows the info, in either a percent ( e.g. 95% ) or in pixels ( e.g. 300 ). leave blank if you want the table to be sized naturally
$showdate = "1"; // show the date, as well as the time? if the posts that show up in the list are likely to all be from today (or you set $last24 to "1"), you can set this to 0. if the posts are spread over multiple days, you probably want this set to 1.
$cs = "0"; // this is the cellspacing. 1 makes a thin line around the cells. 0 makes no line.
$showicon = "0"; // shows the posts' icon next to the post
$showforumtitle = "0"; // shows the forum title (linked to that forum) next to the thread title
$nb = "0"; // do you want breaks in text to appear as such? this may cause problems if there are large breaks in the text
?>

getnews:
PHP Code:

<?
unset($fsel, $ftitle, $wheresql, $ob, $obdir, $maxthreads);

require("getnewsconfig.php");
require("$path/config.php");

$db=mysql_connect($servername,$dbusername,$dbpassword) or die("Can't open connection to MySQL");
mysql_select_db($dbname) or die("Can't select database");

$boarddown1 = mysql_query("SELECT value FROM setting WHERE varname='bbactive'");
$boarddown = mysql_result($boarddown1,0,0);
if ($boarddown == "0") { echo("Die dvdboard.de News befinden sich aktuell im Wartungsmodus. Bitte versuchen Sie es wieder in ein paar Minuten."); exit; }

$hfs = $fs+2;
$fs .= "pt";
$hfs .= "pt";
if ($tw == "") {
        $twt = "";
} else {
        $twt = "width=\"$tw\"";
}
if ($cs == "") {
        $cs = 0;
}
// start up our table, decide whether to show
echo("<table border=0 cellpadding=4 cellspacing=$cs $twt><tr bgcolor=\"$hc\">\n");
if ($showicon == "1") {
        echo("<td>&nbsp;</td>");
}
echo("<td style=\"font-family:$f; font-size:$hfs; color:$tc;\"><b><nobr>Titel:</nobr></b></td>\n");
// the last poster column,
if ($lastposter == "1") {
        echo("<td style=\"font-family:$f; font-size:$hfs; color:$tc;\" align=\"center\"><b><nobr>Autor:</nobr></b></td>\n");
}
// the last post date & time column,
if ($lastpostdate == "1") {
        echo("<td style=\"font-family:$f; font-size:$hfs; color:$tc;\" align=\"center\"><b><nobr>Datum:</nobr></b></td>\n");
}
// the views column,
if ($views == "1") {
        echo("<td style=\"font-family:$f; font-size:$hfs; color:$tc;\" align=\"center\"><b>angesehen:</b></td>\n");
}
// and/or the replies column
if ($replies == "1") {
        echo("<td style=\"font-family:$f; font-size:$hfs; color:$tc;\" align=\"center\"><b>Kommentare:</b></td>\n");
}
echo("</tr>\n");

// the base WHERE statement
$wheresql = "WHERE thread.postusername=user.username AND thread.open!='10'"; 

// we can't have both the last 24 hours *and* the last 7 days, so error out if needed
if ($last24 == "1" && $last7 == "1") {
        print("Error: \$last24 and \$last7 are both set to 1. Please change one of them to 0.");
        exit;
}
// otherwise we're gonna find out which one it is
// last 24
if ($last24 == "1") {
        $time = time()-86400;
        $wheresql .= " AND thread.dateline>'$time'";
}
// last 7
if ($last7 == "1") {
        $time = time()-2419200;
        $wheresql .= " AND thread.dateline>'$time'";
}
// are we trying to exclude *and* include forums? if so, error out
if ($excludeforums != "" && $includeforums != "") {
        print("Error: \$includeforums and \$excludeforums are both set with numbers. Please remove the numbers from <b>one</b> of these two to proceed.");
        exit;
}
// otherwise figure out which one we're using
// include forums
if ($includeforums == "" or $includeforums <= "0") {
        $quarter = "no";
} else {
        $incfid = explode(",",$includeforums); $i = 0; $a = count($incfid);
        if ($a > 1) {
                $wheresql .= " AND (thread.forumid='$incfid[0]'";
                ++$i;
                while ($i < $a) {
                        $wheresql .= " OR thread.forumid='$incfid[$i]'"; ++$i;
                }
                $wheresql .= ")";
        } else {
                $wheresql .= " AND thread.forumid='$incfid[$i]'";
        }
}
// or exclude forums
if ($excludeforums == "" or $excludeforums <= "0") {
        $quarter = "no";
} else {
        $excfid = explode(",",$excludeforums); $i = 0; $a = count($excfid);
        while ($i < $a) {
                $wheresql .= " AND thread.forumid!='$excfid[$i]'";      ++$i;
        }
}
if ($showforumtitle == "1") {
        $ftitle = ",forum";
        $fsel = ",forum.title AS ftitle";
        $wheresql .= " AND thread.forumid=forum.forumid";
}
// ooh a query!
//$query = "SELECT thread.dateline,thread.title,thread.postusername,thread.replycount,thread.views,user.userid,thread.threadid,thread.forumid$fsel,thread.iconid FROM thread,user$ftitle $wheresql ORDER BY thread.$ob $obdir LIMIT $maxthreads";
$query = "SELECT
thread.dateline,thread.title,thread.postuserid,thread.replycount,thread.views,user.userid,thread.threadid,thread.forumid$fsel,thread.iconid 
FROM thread,user$ftitle $wheresql ORDER BY thread.$ob $obdir LIMIT $maxthreads"; 

// let's get the info
$tr = mysql_query($query) or die("MySQL reported this error while trying to retreive the info: ".mysql_error());
$dtf = mysql_query("SELECT value FROM setting WHERE varname='dateformat' OR varname='timeformat' OR varname='timeoffset' ORDER BY varname");
$df = mysql_result($dtf,0,0);
$tf = mysql_result($dtf,1,0);
$tof = mysql_result($dtf,2,0);
if ($showdate == "1") {
        $fdt = "$df $tf";
} else {
        $fdt = "$tf";
}
$cols = 1;
// let's display the info
while ($threads = mysql_fetch_array($tr)) {
        // are we going to show the message too?
        if ($showmessages == "1") {
                $query0 = "SELECT pagetext,postid,dateline,iconid FROM post WHERE threadid='$threads[threadid]' ORDER BY dateline DESC LIMIT 1";
                $lastpost = mysql_query($query0) or die("MySQL reported this error while trying to retrieve the last post info: ".mysql_error());
                while ($lastpost1 = mysql_fetch_array($lastpost)) {
                        $lastpostshort = $lastpost1[pagetext];
                        $postii = $lastpost1[iconid];
                }
                if (strlen($lastpostshort) > $lplen) {
                        $lastpostshort = substr($lastpostshort,0,$lplen);
                        $lastpostshort .= "...";
                }
                $smilies = mysql_query("SELECT smilietext,smiliepath FROM smilie");
                while ($smiles = mysql_fetch_array($smilies)) {
                        $lastpostshort = str_replace($smiles[smilietext],"<img src=\"".$url."/".$smiles[smiliepath]."\" border=0>",$lastpostshort);
                }
                if ($nb == "1") {
                        $lastpostshort = nl2br($lastpostshort);
                }
                $lastpostshort = str_replace("[i]","<i>",$lastpostshort);
                $lastpostshort = str_replace("[/i]","</i>",$lastpostshort);
                $lastpostshort = str_replace("[u]","<u>",$lastpostshort);
                $lastpostshort = str_replace("[/u]","</u>",$lastpostshort);
                $lastpostshort = str_replace("[b]","<b>",$lastpostshort);
                $lastpostshort = str_replace("[/b]","</b>",$lastpostshort);
                $lastpostshort = str_replace("[quote]","<br>quote:<br><hr> ",$lastpostshort);
                $lastpostshort = str_replace("[/quote]"," <hr><br>\n",$lastpostshort);
                $lastpostshort = str_replace("[I]","<i>",$lastpostshort);
                $lastpostshort = str_replace("[/I]","</i>",$lastpostshort);
                $lastpostshort = str_replace("[U]","<u>",$lastpostshort);
                $lastpostshort = str_replace("[/U]","</u>",$lastpostshort);
                $lastpostshort = str_replace("[B]","<b>",$lastpostshort);
                $lastpostshort = str_replace("[/B]","</b>",$lastpostshort);
                $lastpostshort = str_replace("[QUOTE]","<br>quote:<br><hr> ",$lastpostshort);
                $lastpostshort = str_replace("[/QUOTE]"," <hr><br>\n",$lastpostshort);
                $lastpostshort = str_replace("[CODE]","<br>code:<br><hr> ",$lastpostshort);
                $lastpostshort = str_replace("[/CODE]"," <hr><br>\n",$lastpostshort);
                $lastpostshort = str_replace("[code]","<br>code:<br><hr> ",$lastpostshort);
                $lastpostshort = str_replace("[/code]"," <hr><br>\n",$lastpostshort);
                $lastpostshort = str_replace("[img]","",$lastpostshort);
                $lastpostshort = str_replace("[/img]","",$lastpostshort);
                $lastpostshort = str_replace("[img]https://vborg.vbsupport.ru/[/img]","",$lastpostshort);
                $lastpostshort = str_replace("[url]","",$lastpostshort);
                $lastpostshort = str_replace("[/url]","",$lastpostshort);
                $lastpostshort = str_replace("[URL]","",$lastpostshort);
                $lastpostshort = str_replace("[/URL]","",$lastpostshort);
        }
        // thanks to kier for this idea to do the alternating row colors
        if (($counter++ % 2) != 0) {
                $bc=$bc1;
        } else {
                $bc=$bc2;
        }
        // if the title is more than $len characters, we need to cut it off and add ... to the end
        if (strlen($threads[title]) > $len) { 
                $title = substr($threads[title],0,$len);
                $title .= "...";
        } else { 
                $title = $threads[title];
        }
        // convert the date to a format readable by non-unix geeks :)
        $fd = date($fdt,$threads[dateline]); 
        // display everything in a nice table. in the future we're gonna try to do this so others can format the data, but this is sufficient for now
        echo("<tr>");
        if ($showicon == "1") {
                echo("<td bgcolor=\"$bc\">");
                if ($postii != "0" && $postii != "") {
                        echo("<img src=\"$urlimg/icons/icon$postii.gif\" border=\"0\">");
                }
                if (($postii == "0" || $postii == "") && $threads[iconid] != "0" && $threads[iconid] != "") {
                        echo("<img src=\"$urlimg/icons/icon$threads[iconid].gif\" border=\"0\">");
                }
                if (($postii == "0" || $postii == "") && ($threads[iconid] == "0" || $threads[iconid] == "")) {
                        echo("&nbsp;");
                }
                echo("</td>");
                ++$cols;
        }
        echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\"><nobr>");
        if ($showforumtitle == "1") {
                echo("<a href=\"$url/forumdisplay.php?forumid=$threads[forumid]\" style=\"color: $lc;\">$threads[ftitle]</a>: ");
        }
        echo("<a href=\"$url/showthread.php?threadid=$threads[threadid]\" style=\"color: $lc;\" title=\"$threads[title]\">$title</a></nobr></td>\n");
        // last poster column?
        if ($lastposter == "1") {
                echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"center\"><a href=\"$url/member.php?action=getinfo&userid=$threads[userid]\" style=\"color: $lc;\">$threads[lastposter]</a></td>\n");
                ++$cols;
        }
        // the last post date & time column,
        if ($lastpostdate == "1") {
                echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"center\">$fd</td>\n");
                ++$cols;
        }
        // views column?
        if ($views == "1") {
                echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"center\">$threads[views]</td>\n");
                ++$cols;
        }
        // replies column?
        if ($replies == "1") {
                echo("<td bgcolor=\"$bc\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"center\">$threads[replycount]</td>\n");
                ++$cols;
        }
        echo("</tr>");
        // are we showing the last post?
        if ($showmessages == "1") {
                echo("<tr bgcolor=\"$bc\"><td colspan=\"$cols\" style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"left\">\n");
                echo("<table border=0 cellpadding=4 cellspacing=0 width=\"100%\">\n");
                echo("<tr bgcolor=\"$bc\"><td style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"right\" valign=\"top\"><b><nobr>Last Post:</nobr></b></td>\n");
                echo("<td style=\"font-family:$f; font-size:$fs; color:$tc;\" align=\"left\" width=\"100%\">$lastpostshort</td></tr>\n");
                echo("</table></td>\n");
        }
        $fd = "";
}
echo("</tr></table>");
?>



Edit: To answer myself, look for $threads[lastposter] and replace it with $threads[postusername]. Stupid me. :)

knirketusken 04-14-2005 03:58 AM

Quote:

Originally Posted by gator777
This worked, but I am still having the issue with the fact that it is not allowing for the DBprefix I added (vb3_). It cannot find the tables. I wish someone could tell me a workaround for this. :)

I have the same issue with the DB prefix. I have tried to edit last10.php, but have not had any luck yet. I suppose it would be an idea for the developer to make a "DBprefix"-choice in last10config.php so that all of us that where "stupid" enough to choose a prefix during install can use this very useful hack


All times are GMT. The time now is 09:57 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02411 seconds
  • Memory Usage 2,046KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (8)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete