Mini-Me 24 Report post Posted February 28, 2010 As Ashley was one of the lot people that asked me how I did my avatar that shows different images each time, I just decided to post that here for you. Since I don't know the code I use by heart, I wrote something new, so try this: <?php $links = array( 'http://example.com/image1.jpg', 'http://example.com/image2.gif', 'http://example.com/image3.png', ); header( "Location: {$links[rand(0,count($links)-1)]}" ); ?> Change the links to what you need and save that in a file with a php ending of your choice, e.g: avatar.php. That should work just fine. Upload it to a webserver of your choice and you're done. However, to trick IP.Board, you'll need even more. IPS is the opinion that it's good to limit embeddable extensions, php is one of the disabled. So you'll need a way around that. Rename the file and change it's extension to one of the common image ones. Then you'll need a webserver that allows some .htaccess configuration. If you know that yours does, or you want to try, copy&paste this into a new file: AddType application/x-httpd-php .jpg Change the extension to whatever you chose, save it as .htaccess and upload it. Please keep in mind that php parser will now run over all files with this extension. I suggest you to create an extra subfolder for this and save both in there. That's all so far. If any of my codes that I just took from memory don't work, just tell me . Share this post Link to post Share on other sites
daangelo29 5 Report post Posted February 28, 2010 Ooooh. Thanks Mini-Me. I can finally have use those other sigs I made sometime ago. Gonna change my avatar and sig once I get back from school. Share this post Link to post Share on other sites
Ashley+ 0 Report post Posted March 1, 2010 this is confusing i got this far making this into a php file <?php $links = array( 'http://i799.photobucket.com/albums/yy280/ashleytomphson/signature5.jpg', 'http://i799.photobucket.com/albums/yy280/ashleytomphson/siggy.jpg', 'http://i799.photobucket.com/albums/yy280/ashleytomphson/untitled-2-1.jpg', 'http://i799.photobucket.com/albums/yy280/ashleytomphson/Image1-3.jpg', ); header( "Location: {$links[rand(0,count($links)-1)]}" ); ?> and now i'm stuck Share this post Link to post Share on other sites
Mini-Me 24 Report post Posted March 1, 2010 You now need a webserver that allows you executing php and since you might want to use it here, it also must be slightly configurable through .htaccess files . Ripway.com, which is suggested quite often @invisionfree/zetaboard's support forum for such simple exercises doesn't offer the last method as it runs Microsoft IIS on Windows . However, here's one you could use: website.org I tried my codes there and they work fine. Share this post Link to post Share on other sites
bluespace88 9 Report post Posted March 1, 2010 i might do that too XD Cept i'm going to edit the code. Share this post Link to post Share on other sites
♠Grim♂ Reaper 1666◙ 17 Report post Posted March 1, 2010 would an astahost web server work (phpbb3 scripts work on there) Share this post Link to post Share on other sites
Ashley+ 0 Report post Posted March 2, 2010 ok i uploaded everything to ripway and the php works fine but when i turn it into a jpg it doesnt work Share this post Link to post Share on other sites
Mini-Me 24 Report post Posted March 2, 2010 You didn't read, did you? You need the second code in a .htaccess file on a server that supports them - I said ripway doesn't support them. Cept i'm going to edit the code. As it is now, it wont work . If I might ask, to what are you going to change it? would an astahost web server work (phpbb3 scripts work on there) I guess. The first one will, for the second (to change the extension to a non default php-parsed) you'll just have to try. Share this post Link to post Share on other sites
bluespace88 9 Report post Posted March 2, 2010 Just to use the time as the seed generator, which I think it does right now. Share this post Link to post Share on other sites
Mini-Me 24 Report post Posted March 2, 2010 It most likely does, but you'll have to limit that to the ints in that your array has the links (to clarify my brainfart: In my example the returned variable may only be 0, 1, 2, or 3. No further numerics). The easiest method is what I used, as I see it. Share this post Link to post Share on other sites
bluespace88 9 Report post Posted March 2, 2010 umm yeah, I already know that............. Share this post Link to post Share on other sites
Mini-Me 24 Report post Posted March 2, 2010 Well, I know you knew. But from what you said I couldn't think of a different, easy implementation . Share this post Link to post Share on other sites
Ashley+ 0 Report post Posted March 2, 2010 You need the second code in a .htaccess file on a server that supports them - I said ripway doesn't support them. but if i put the .htacess file on another server then i'd have to put the pictures and php on the same place wouldnt i? edit: ok i uploaded everything to website.org and again when i rename the php file it doesnt seem to work heres the site to prove i have all the files http://www.ashleyalternate.uk.nu/ Share this post Link to post Share on other sites
Mini-Me 24 Report post Posted March 3, 2010 Again read closer! The file must be named .htaccess (<DOT>htaccess)! The images don't need to be on the same server. But if you want them to, you can shorten the links and make them relative. BUT keep in mind that you should not have the images and the script in the same folder! Otherwise the php parser will be uselessly activated for these. So here's a full example how it could look like on the URL http://www.example.com/ example.com/ |- image1.jpg |- image2.gif |- image3.png |- script/ |- signature.jpg |- .htaccess signature.jpg is not a true image, but a text file and can contain: <?php $links = array( '../image1.jpg', '../image2.gif', '../image3.png', 'http://www.google.com/intl/en_us/images/logo.gif', 'http://lnx.outatime.it/util/frame.php?cs=438000', ); header( "Location: {$links[rand(0,count($links)-1)]}" ); ?> .htaccess contains: AddType application/x-httpd-php .jpg Share this post Link to post Share on other sites