Jump to content

Random Remix Script for Artists (or anyone else)


DarkeSword
 Share

Recommended Posts

So here's a fun little PHP script I whipped up. It redirects you to a random OCReMix by me.

<?
srand(time());

$mixes = array('01095', '01178', '01463', '00758', '01154', '01069', '01235', '01374', '01316', '01286', '01507', '01343', '01044', '00982', '01129', '00943', '01010', '01591', '01079');

$random = (rand()%count($mixes));
$destination = 'http://www.ocremix.org/remix/OCR' . $mixes[$random] . '/';

header( "Location:" . $destination );
?>

The remix ID numbers are stored in the $mixes array; if you want to specify your own mixes, just replace the numbers I have there with your own 5-digit ID numbers for your mixes.

You can find the remix id number in the remix's URL. Ex:

ocremix.org/remix/OCR01591

01591 is the remix id number for my Twilight Princess remix.

Replace the numbers and save the code to a .php file and store it on a server that lets you use PHP. Then, whenever you point your browser to that file, it'll redirect you.

I've got mine stored here:

http://darkesword.com/randommix.php

Link to comment
Share on other sites

Either that, or just parse out the remix URLs from the HTML, and return a random one.

Yeah, but really that kind of stuff is way easier to do if you have access to the site code. I don't (and I don't want it).

As far as breaking the array, I'm not really sure, but it would be easier to make an array with all of the IDs for the removed remixes, set the randomization to the highest ID number on OCR, and then use an if-else statement to make sure you're always redirected to a valid remix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...