Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
megabyte2001
New Member
New Member



Joined: Apr 15, 2006
Posts: 9

PostPosted: Tue Nov 28, 2006 4:37 pm Reply with quote

I'm looking for a block that will display other blocks at random or by list.

One time it might show block-1.php, then after a refresh, block-2.php and so on and so forth.

Anyone heard of such a thing or know how to code this?
 
View user's profile Send private message
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6437

PostPosted: Tue Nov 28, 2006 4:48 pm Reply with quote

Interesting... You could try randomly including the other blocks in the random blocks block file.

_________________
I search, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
megabyte2001







PostPosted: Tue Nov 28, 2006 6:20 pm Reply with quote

huh?
 
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Tue Nov 28, 2006 8:32 pm Reply with quote

Laughing Thanks for the laugh guys.megabyte2001, when I first came here, boy how many times did I think to myself to type Just that.

kguske, you have the exact idea I was thinking about.

Now megabyte, do you want this to show blocks that are not active?
Basically all types of blocks?
After thinking about this I was thinking to using another directory.

Paste this in your BEST text editor:


<?php
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}

$directory='random_blocks';
$countrand=0;
if (!($handlerand = opendir($directory))) {
die('Failure to read from '.$directory);
}


//right from php.net, no reason to reinvent the wheel.
while (false !== ($file = readdir($handlerand))) {
if(($file!=='.')AND($file!='..')){
$countrand=$countrand+1;
//This turns it into an array to later be used.
$file_name[$countrand]=$file;

}
}


$rnum=rand(1,$countrand);//Dont need to use anymore then we already have

include($file_name[$rnum]);
?>

Now name it something like block-Random_blocks.php.
Now you have the block that will have the random_blocks you selected.
In your site root, make a folder called random_blocks, upload the blocks you want it to use.
Hope you find this to be what you are looking for.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
gregexp







PostPosted: Tue Nov 28, 2006 10:55 pm Reply with quote

Now this is tested, but not tested against security, I dont really see anything that would cause any security issue, I cant see how this could be hijacked or placed under attack. Hope you find it usefull.
 
megabyte2001







PostPosted: Wed Nov 29, 2006 6:32 am Reply with quote

Works great...thanx
 
kguske







PostPosted: Wed Nov 29, 2006 7:07 am Reply with quote

Thanks, darklord - that was what I had in mind - just didn't have the time to put the code together and test. Nice job!
 
gregexp







PostPosted: Wed Nov 29, 2006 7:25 am Reply with quote

Glad it worked for you. RavensScripts
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©