vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   variation of FireFly's "Online Users" hack (https://vborg.vbsupport.ru/showthread.php?t=37287)

TECK 04-11-2002 05:45 AM

variation of FireFly's "Online Users" hack
 
1 Attachment(s)
i want to change this hack to make it use images instead of numbers. an easy way to do would be to make one zillion gif files named 1.gif, 2.gif.... 894.gif. ;) however, a much more elegant solution would be to create all the digits individually, then have them replace the actual values. so if i have 89 members online the 2 digits will be replaced by 8.gif and 9.gif.

i'm not sure what is the exact aproach on this. can you spare few minutes of your time and give me a solution?
please, post a code example in this thread.

i attached a picture, so you see actually what i try to achieve.
thanks for taking the time to help me solve this problem.

Reeve of shinra 04-11-2002 05:49 AM

I think it has something to do with png file types. I dont know much about it except that you can have scripts in php place a value over an image.

*shrug* its a start.

Reeve of shinra 04-11-2002 05:51 AM

flash can also be updated dynamically .. so that might be another option for you ...

TECK 04-11-2002 06:18 AM

unfortunatelly, the font is extremly small. in flash, it will be invisible. the only way i see it is by using the little digits i made. it should be a way to call and replace them individually, using if arguments. i honestly dont know how to do it. help is apreciated. thanks.

Admin 04-11-2002 10:01 AM

Here's one way to do that. $number holds the number you want to turn into images:
PHP Code:

$number 123;
$images '<img src="' implode('.gif"><img src="'preg_split('//', (string) $number, -1PREG_SPLIT_NO_EMPTY)) . '.gif">'

(the preg_split() call is taken from PHP's manual)
For that number you'll get this output:
Code:

<img src="1.gif"><img src="2.gif"><img src="3.gif">

TECK 04-11-2002 12:53 PM

i'm the happiest guy in the world.. you saved me a ton of work firefly!!!!! thank you so much!!!
i will try it tonight....

TECK 04-11-2002 04:42 PM

so i can use this function with basically every numbers listed in VB, like for example posts/threads right?

Admin 04-11-2002 05:21 PM

Yup.

TECK 04-11-2002 09:10 PM

thanks for the the help, firefly.

TECK 04-17-2002 05:41 AM

ok, now firefly(or any experienced hacker)... i have another prob... when i try to replace the number of threads in forumhome, i get stuck. here's what i did:
i opened functions.php and located the $threadcount. then i got amased with the + in there:
Code:

$threadcount[high]+[/high]=$getchildforum[threadcount];
if it wouldnt be that +, i would do this:
PHP Code:

$threadcount=$getchildforum[threadcount];
$threadcountimage='<img src="'.implode('.gif"><img src="',preg_split('//',(string) $threadcount,-1,PREG_SPLIT_NO_EMPTY)).'.gif">'

can i do this?
PHP Code:

$threadcount+=$getchildforum[threadcount];
$threadcountimage='<img src="'.implode('.gif"><img src="',preg_split('//',(string) $threadcount+,-1,PREG_SPLIT_NO_EMPTY)).'.gif">'

can you explain to me please what the + do?
thanks alot.

Neo 04-17-2002 05:48 AM

well here is a example:

$var1 += $var2

now this is using the +=

this is what it would look like but do the same thing with out the +=

$var1 = $var1 + $var2

TECK 04-17-2002 05:52 AM

ok.. i understand.. then the code will not work the way i put it..
it will look for 89.gif instead of 8.gif 9.gif

what is the solution?
thanks for your help.

Zzed 04-17-2002 07:54 AM

I just ran that little code snippet. It does create a string with 8.gif and 9.gif.

Admin 04-17-2002 07:59 AM

Don't touch that part of the code. Create the images string after the loop, not inside.

TECK 04-17-2002 08:23 AM

so it will look like?
PHP Code:

if ($getchildforum[parentid]==$forumid) {
  
$threadcount+=$getchildforum[threadcount];
}
$threadcountimage='<img src="'.implode('.gif"><img src="',preg_split('//',(string) $threadcount+,-1,PREG_SPLIT_NO_EMPTY)).'.gif">'

let me know if it correct. thanks.

TECK 04-17-2002 08:28 AM

nope.. is better this way:
PHP Code:

    $forumslist.=",$getchildforum[forumid]";
  }
  
$DB_site->free_result($getchildforums);
  
$threadcountimage='<img src="'.implode('.gif"><img src="',preg_split('//',(string) $threadcount+,-1,PREG_SPLIT_NO_EMPTY)).'.gif">'

am i correct?

TECK 04-17-2002 08:51 AM

nope. not working.. getting parse errors all over the place. :(
i tried also single quoted.. same result.

TECK 04-17-2002 09:09 AM

ok.. i think i got it:
PHP Code:

$forumslist.=",$getchildforum[forumid]";
}
$DB_site->free_result($getchildforums);
$threadcountimage='<img src="'.implode('.gif"><img src="',preg_split('//',(string) $threadcount,-1,PREG_SPLIT_NO_EMPTY)).'.gif">'

i forgot about the +, there is no need to have it there.. thanks alot ZZed.
i will let you all know tomorrow if it worked. ;)

Admin 04-17-2002 04:17 PM

Create a function to do that stuff... i.e:
Code:

function num2img ($number, $path = '') {
        return '<img src="' . implode('.gif"><img src="', preg_split('//', (string) $number, -1, PREG_SPLIT_NO_EMPTY)).' . gif">';
}

Stick that in functions.php and then just use it like this:
Code:

$threadcountimage = num2img($threadcount);

TECK 04-17-2002 04:59 PM

thanks alot firefly. :)
excellent idea the function.

btw, i'm trying the "answer through email"... ;)

__________________________________________________ _______________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

Chris M 04-17-2002 07:52 PM

Cool Hack idea nakkid...

I suppose if you like having all those number pictures, its ok...Doesnt it take longer to load the images than just text?

Satan

TECK 04-17-2002 08:28 PM

nope.. not if you use it as digits..
and what's up with the satan thing?

__________________________________________________ _______________
Join the world?s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


All times are GMT. The time now is 02:01 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.01634 seconds
  • Memory Usage 1,774KB
  • 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
  • (4)bbcode_code_printable
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (22)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