vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Multiple file attachments? (https://vborg.vbsupport.ru/showthread.php?t=46482)

350Chevy 12-08-2002 07:07 AM

Multiple file attachments?
 
Is there a multiple file attachment hack out yet? I've searched up and down with nothing.

I've also been looking for a way to play random sounds (.wav) from anywhere on vB when recieving a PM. :)

Logician 12-08-2002 12:49 PM

Quote:

Is there a multiple file attachment hack out yet? I've searched up and down with nothing.
https://vborg.vbsupport.ru/showthrea...441#post313441

Quote:

I've also been looking for a way to play random sounds (.wav) from anywhere on vB when recieving a PM.
This code will produce the file name in this format : "soundX.wav". X will be randomly between 1 to 10. I guess you can insert it to this hack
PHP Code:

function make_seed() {list($usec$sec) = explode(' 'microtime());return (float) $sec + ((float) $usec 100000);}
    
srand(make_seed()); $srand_code rand (1,10);
$wav_file='sound'.$srand_code.'.wav'

Use "$wav_file" variable instead of file name in that hack..

Boofo 12-08-2002 01:30 PM

Sinan, I tried to get that function to work with that hack but couldn't get it to do it. :)

Logician 12-08-2002 01:44 PM

Quote:

Originally posted by Boofo
Sinan, I tried to get that function to work with that hack but couldn't get it to do it. :)
Can u please post the code u used?

BTW. long time no see, where have u been? :)

Boofo 12-08-2002 02:02 PM

Here's the block of code I tried to use. It works with his sound file.

PHP Code:

 if ($newpm['messages']==0) {
    
$lightbulb='off';
  } else {
    
$lightbulb='on';
  }

function 
make_seed() {list($usec$sec) = explode(' 'microtime());return (float) $sec + ((float) $usec 100000);}
    
srand(make_seed()); $srand_code rand (1,10);
$wav_file='sound'.$srand_code.'wav';

//new PM sound hack
if ($unreadpm['messages']==0) {
$sound='';
} else {
$sound='<embed src="$wav_file" autostart="true" hidden="true">';
}
//end new PM sound hack 

Yeah, it's been a while. ;) The wife just gave birth to twin boys about 4 weeks ago. She was on complete bedrest for the last couple of months of the pregnancy, due to complications, so I was taking care of her and our 5-year-old. :)

350Chevy 12-08-2002 03:07 PM

Holy crap I can't believe I missed that! Many many thanks! :D

350Chevy 12-08-2002 07:53 PM

Fatal error: Cannot redeclare make_seed() (previously declared in /var/home/ls6/www/htdocs/forums/index.php:75) in /var/home/ls6/www/htdocs/forums/index.php on line 275

Yup, didn't work for me either. :)

Logician 12-08-2002 08:16 PM

@boofo:

change this line
PHP Code:

$sound='<embed src="$wav_file" autostart="true" hidden="true">'

like this:
PHP Code:

$sound='<embed src="'.$wav_file.'" autostart="true" hidden="true">'

also congratulations! ;)

@350Chevy: remove this line:
PHP Code:

function make_seed() {list($usec$sec) = explode(' 'microtime());return (float) $sec + ((float) $usec 100000);} 

I guess you are using my birthday greetings hack or another hack which uses the exact function, that's why you got this error..

Boofo 12-08-2002 08:38 PM

Thank you for the congratulations. It has been well worth the trip. ;)

I still get no sound for pms from the code you had me change. :)

350Chevy 12-08-2002 10:56 PM

Quote:

Originally posted by Logician
@350Chevy: remove this line:
PHP Code:

function make_seed() {list($usec$sec) = explode(' 'microtime());return (float) $sec + ((float) $usec 100000);} 

I guess you are using my birthday greetings hack or another hack which uses the exact function, that's why you got this error..

You are correct but it still plays no sound. I've also tried to change the line to something like this:

PHP Code:

srand(make_seed()); $srand_snd rand (1,18); 
$sound='<embed src="audio\sound'.$srand_snd.'wav" autostart="true" loop="0" hidden="true"></embed>'

And still nothing.. I've used $srand_code = rand (1,10) with no results, then changed it to $srand_snd thinking I needed a different string name considering the birthday mod installed and still nada. So I dunno... :)

Logician 12-08-2002 11:03 PM

guys you both receive a pm in your board and check source code of the page where this code is displayed. Check how is it rendered in the source code. You probably have file name or URL problem. Dont forget to have sound files in this format:
sound1.wav
sound2.wav
etc.

and caps is important in file names!

Also is the directory structure..

350Chevy 12-09-2002 01:30 AM

You da man...

I thought there was something missing there... It was searching for sound1wav because your line of code was missing a simple . lol

should be:

PHP Code:

srand(make_seed()); $srand_snd rand (1,18); 
$sound='<embed src="audio\sound'.$srand_snd.'.wav" autostart="true" loop="0" hidden="true"></embed>'

Thanks again.. it's working perfectly! Now if only someone would release the multiple file attach. :)

350Chevy 12-09-2002 02:00 AM

You can also add the function to the global file then call it from the template to call the sound from any page.. which is preferable. ;)

Boofo 12-09-2002 03:33 AM

Quote:

Originally posted by 350Chevy
You can also add the function to the global file then call it from the template to call the sound from any page.. which is preferable. ;)
350Chevy, what is your exact coding for that piece of code? :)

350Chevy 12-09-2002 03:56 AM

Quote:

Originally posted by Boofo


350Chevy, what is your exact coding for that piece of code? :)

Take all the code out of index.php that you added...

Make sure this code is NOT in index.php

PHP Code:

function make_seed()  { list($usec$sec) = explode(' 'microtime()); return (float) $sec + ((float) $usec 100000); } 

and place in in global.php under

PHP Code:

<?php

next find this in global.php

PHP Code:

$headnewpm='';

if (
$checknewpm and $bbuserinfo['userid']!=and $bbuserinfo['pmpopup']==2) {
  if (
$noshutdownfunc) {
    
$DB_site->query("UPDATE user SET pmpopup=1 WHERE userid=$bbuserinfo[userid]");
  } else {
    
$shutdownqueries[]="UPDATE LOW_PRIORITY user SET pmpopup=1 WHERE userid=$bbuserinfo[userid]";
  }
  
$newpmmsg=1;
  eval(
"\$headnewpm = \"".gettemplate('head_newpm')."\";");


Add this under that code:

PHP Code:

$headerpms='';
$permissions=getpermissions();
if (
$enablepms==and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
  
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ',$bbuserinfo[ignorelist]));
  }
  
$headpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
  if (
$headpm['messages']!=0) {
    
srand(make_seed()); $srand_snd rand (1,10); 
    
$sound='<embed src="audio\sound'.$srand_snd.'.wav" autostart="true" loop="0" hidden="true"></embed>';
  } else {
    
$sound=''
  
}


and place your sound1.wav - sound10.wav files in the sub folder called audio.

then open your header template and place $sound anywhere you see fit.

That should do it. ;)

350Chevy 12-09-2002 03:57 AM

I have the blinking PM's in header mod installed too so I'm not sure if all that code above is needed but it should still do the trick. :)

Boofo 12-09-2002 04:07 AM

Whoa! You've totally lost me on this. I have no sound wav files at all. All I needed to do is get the sound code that Logician wrote to play on new messages. Where do I get the sound wav files. :)

Logician 12-09-2002 08:43 AM

Quote:

Originally posted by Boofo
Whoa! You've totally lost me on this. I have no sound wav files at all. All I needed to do is get the sound code that Logician wrote to play on new messages. Where do I get the sound wav files. :)
LOL Boofo!

The hack is for playing a random sound file when you have a PM and it produces a file name like sound1.wav, sound2.wav etc. So you have to have these files in your server.. :knockedout:

I just gave you the code, I don't use the hack myself. So I hope 350Chevy will help you with wav files..

EvilLS1 12-09-2002 09:32 AM

You can find lots of free wav files here:

http://www.eventsounds.com/

or here:

http://www.top50wavsites.com/

:)


All times are GMT. The time now is 03:04 AM.

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.02496 seconds
  • Memory Usage 1,801KB
  • 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
  • (12)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (19)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