The problem you have is not problem on both rotate.php and dle script, but it's problem where to place "rotate.php" file location, you can't place any php files in your theme folder, it will be blocked by script and htaccess, so the solution is simple, create new folder in your root directory outside "templates" folder, example: "header" or "background"
Then place all images and rotate.php inside that folder so you can access to the folder and images like
http://your-domain.com/header/rotate.php
http://your-domain.com/header/image-1.php
http://your-domain.com/header/image-2.php
...
or
---
http://your-domain.com/background/rotate.php
http://your-domain.com/background/image-1.php
http://your-domain.com/background/image-2.php
Your main.tpl should be like this
<style type="text/css">
.header_img {
overflow: hidden;
width: 1010px;
margin: 0 auto;
height: 276px;
background: url(/header/rotate.php) no-repeat center 0;
/* or */
/*
background: url(/background/rotate.php) no-repeat center 0;
*/
border-width: 0 1px;
</style>
<!-- /header -->
</header>
<div id="header_img">
<div class="header_img"><!-- no text --></div>
</div>
Keep any php files out from "templates" folder. and do not place css in any css files, put all code in main.tpl.
Alternatively you can use this technique which we use in a few websites we did designs for them
1) Download rotator.txt from A List Apart, rename it rotator.php.
2) Put the images to be rotated in the same directory as rotator.php.
3) Upload all the files via FTP.
4) Add this code in main.tpl
<style type="text/css">
#rotator{
overflow: hidden;
width: 1010px;
margin: 0 auto;
height: 276px;
background: url(/background/rotate.php) no-repeat center 0;
border-width: 0 1px;
</style>
<!-- /header -->
</header>
<div id="rotator"> </div>