You're beautiful! It works!

I had that code or something very similar, but had put at the very beginning of a couple of pages to test it, and it wasn't working. But putting it within rotate.php has it working perfectly. I don't know why I didn't think of trying it in there myself.

So thank you! It now works exactly the way I had wanted it to