PDA

View Full Version : showthread php question


gengar003
05-03-2003, 12:08 AM
So, i've got my showthread.php file right?


Now, you'd think if i put something at the top of the page, it would execute upon loading of the page, right? well it doesn't... :( This is probably because of some inadequacy of mine, but I don't get what, so there you are. Anyway, I've got a simple code to check the user's Points (from lesane store hack) and I know it does indeed pull them from the DB and assign it to a variable, because is can make the points print @ the top of the page. I have this set to work ONLY in forum id #51.


However, when I try to put that into an "If" statement, and show the points ONLY if they've less than 1000, it ONLY works when, on the forum main page, I click the "goto newest" arrow thing by the time and poster....


Anywhere else, it does nothing. Any Ideas why?




require('./global.php');
$userstuff = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if ($points < 1000 && $forumid == 51){
echo $points;
}

mr e
05-03-2003, 06:57 AM
have you tried adding an else?

gengar003
05-03-2003, 11:30 AM
Hmm... Yes, actually, but I had the "else" containing the rest of the file. Would that have caused a problem?

mr e
05-03-2003, 05:14 PM
and right now your file looks like this?


require('./global.php');
$userstuff = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if ($points < 1000 && $forumid == 51){
echo $points;
}

rest of file

noppid
05-04-2003, 01:30 PM
The reason it fails is you are requiring global.php, then later in the file it tries to include it again and the page fails. Try moving your code below the forms actual call to require(global.php).

At least that's what bit us once.

gengar003
05-04-2003, 02:11 PM
Yesterday at 07:14 PM mr e said this in Post #4 (https://vborg.vbsupport.ru/showthread.php?postid=390909#post390909)
and right now your file looks like this?


require('./global.php');
$userstuff = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if ($points < 1000 && $forumid == 51){
echo $points;
}

rest of file



yes

gengar003
05-04-2003, 02:12 PM
Today at 03:30 PM noppid said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=391203#post391203)
The reason it fails is you are requiring global.php, then later in the file it tries to include it again and the page fails. Try moving your code below the forms actual call to require(global.php).

At least that's what bit us once.


Hm? The page runs, but my code doesn't... and the call to require etc that was originally there is halfway down the page, (roughly) and there's code above it I want to run AFTER the check is preformed... I'll try it, though.

gengar003
05-20-2003, 11:25 PM
anyone?

Boofo
05-21-2003, 12:17 AM
Try this:

$userstuff = $DB_site->query_first("SELECT storep AS points FROM user WHERE userid=$bbuserinfo[userid]");
if ($userstuff[points] < 1000 && $forumid == 51){
echo $userstuff[points];
}

Link14716
05-21-2003, 02:41 AM
05-02-03 at 09:08 PM gengar003 said this in Post #1 (https://vborg.vbsupport.ru/showthread.php?postid=390682#post390682)


require('./global.php');
$userstuff = $DB_site->query_first("SELECT storep FROM user WHERE userid=$bbuserinfo[userid]");
$points=$userstuff[storep];
if ($points < 1000 && $forumid == 51){
echo $points;
}


Why do so many people select from the user table for something already in the $bbuserinfo array?


$points=$bbuserinfo[storep];
if ($points < 1000 && $forumid == 51){
echo $points;
}

Put that under this:$templatesused = 'showthread_ratingdisplay,postbit_search,postbit_b uddy,postbit_ignore,postbit_useremail,icq,aim,yaho o,postbit_homepage,postbit_profile,postbit_ip_show ,postbit_ip_hidden,postbit,postbit_sendpm,postbit_ avatar,postbit_offline,postbit_online,postbit_edit edby,postbit_signature,postbit_attachment,postbit_ attachmentimage,showthread_adminoptions,showthread _threadrate,showthread_pollresults_voted,showthrea d_pollresults_closed,showthread_pollresults_cantvo te,showthread_firstunread,showthread_nextnewestthr ead,showthread_nextoldestthread,forumrules,showthr ead';
require('./global.php');

gengar003
05-21-2003, 10:10 PM
I don't have that bit of code in my showthread.php file. It's the vb 2.3.0, and this is the closest there is:

[php]
// ################################################## ##########################
// ############################# SHOW POST ####################################
// ################################################## ##########################

if ($action=="showpost") {

$templatesused =

'postbit_search,vbcode_smilies,vbcode_smiliebit,vb code_smilies_getmore,postbit_b uddy,postbit_useremail,ic

q,aim,yahoo,postbit_homepage,postbit_profile,postb it_ip_show,postbit_ip_hidden,p ostbit,postbit_sendpm,pos

tbit_avatar,postbit_offline,postbit_online,postbit _editedby,postbit_signature,po stbit_attachment,postbit_

attachmentimage,showpost';
include('./global.php');

[php]

Brad
05-22-2003, 02:18 AM
Find:

// oldest first or newest first
if ($postorder==0) {
$postorder="";
} else {
$postorder="DESC";
}

Above that add:


// Start display points hack
$points=$bbuserinfo['storep'];
if ($points < 1000 && $foruminfo['forumid'] == 51 && $bbuserinfo['usergourid']!=0){
$userpoints=$points;
} else {
$userpoints="";
}

Put $userpoints anywhere in the showthread template to display it.