View Full Version : Multiple file attachments?
350Chevy
12-08-2002, 07:07 AM
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
Is there a multiple file attachment hack out yet? I've searched up and down with nothing.
https://vborg.vbsupport.ru/showthread.php?postid=313441#post313441
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 (http://www.vbulletin.org/hacks/index.php?s=&action=showhack&hackid=774)
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
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.
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
$sound='<embed src="$wav_file" autostart="true" hidden="true">';
like this:
$sound='<embed src="'.$wav_file.'" autostart="true" hidden="true">';
also congratulations! ;)
@350Chevy: remove this line:
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
Originally posted by Logician
@350Chevy: remove this line:
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:
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:
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
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
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
function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); }
and place in in global.php under
<?php
next find this in global.php
$headnewpm='';
if ($checknewpm and $bbuserinfo['userid']!=0 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:
$headerpms='';
$permissions=getpermissions();
if ($enablepms==1 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
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/
:)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.