vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Showthread.php $post[userid]... (https://vborg.vbsupport.ru/showthread.php?t=63291)

TouchingVirus 04-01-2004 02:41 PM

Showthread.php $post[userid]...
 
This is a little bit of a cry for help, so please feel free to move it to the approriate forum because i couldnt find one except this...

I have a hack that displays a stat on the posbit/postbit_legacy.. lets call it valueable_posts

Well this is my problem. I am an admin, i dont want people (including myself) to see what valueable_posts i have or havnt got (coz the value is almost always 0 for the whole admin team :nervous: )

I tried to use the following code

PHP Code:

$value_post =$DB_site->query_first("SELECT valuenumber FROM valuepost WHERE userid='$post[userid]'");

$posts_valued=$value_post['valuenumber'];

if (
$post[userid]='1')
{
$value_template '';
}
else
{
eval(
'$value_template = "' fetch_template('valuetemplate') . '";');


This doesnt work, instead of it showing anything, for every user it shows nothing at all..

I did a simple "echo $post[userid]" before my if statement, and it showed up correctly at the top of the page. I then put in another "echo $post[userid]" statement during the if statement and for some unknown reason, the results always came back as '1'..no matter what user logged in.

Could you please help me as to how i can acheive my goal?

Xenon 04-01-2004 05:26 PM

why not use an ifcondition in the postbit template?

HTML Code:

<if conditon="$post[userid] != 1 OR $bbuserinfo[userid] == 1">$value_template
but to answer your question, you have just missed one = in your condition, a single = doesn't compare, it sets a variable

TouchingVirus 04-01-2004 07:00 PM

i had a feeling i was doing some major begginers mistake, thanks very very much Xenon, much appreciated!!

Xenon 04-01-2004 07:44 PM

No prob, you're welcome :)

TouchingVirus 04-01-2004 08:27 PM

Sorry to bother you again, but only one more thing i need some help with...


I want to be able to enable/disable all my hacks, especially this one, so i made a table called hack_enabled with the hackname and a tinyint where 0 = off and 1 = on..i copied some code from forum.php and just modded it to my needs, but i dont know how to get PHP to read the value's of the Yes/No and change them into 1 for yes and 0 for no...

Any ideas on this code, or even if you got an easier way of doing it, just like you had the templates..

PHP Code:

if ($_REQUEST['do'] == 'valueposts')
{
    
globalize($_REQUEST, array());

    
print_form_header('value''dovalueposts');

    
print_table_header('Hack Enabling');
    
print_yes_no_row('Enable Value Posts''options[enabled]'$forum['warnall']);
    
print_submit_row($vbphrase['save']);
    
print_cp_footer();
}

// ###################### Update The Value.. ####################### 
if ($_POST['do'] == 'dovalueposts'

    
globalize($_POST, array('options')); 

    
$DB_site->query("UPDATE hack_enabled SET enabled='xxx' WHERE hack ='valueposts'"); 
    
define('CP_REDIRECT'"index.php?do=home"); 
    
print_stop_message('hack_enabled_success); 




TouchingVirus 04-01-2004 11:50 PM

never mind i got it :)


All times are GMT. The time now is 11:10 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.01057 seconds
  • Memory Usage 1,732KB
  • 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
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete