Thanks for your input to the bpth of you.
I tried your method drawmack, but it seemed to take my source and wipe it all and add the last few letters of the file name and the extension of the file, and then wrote that to the file.
Here is what I am working with. Obviously, it doesnt work. Maybe by showing you what I am working with, I might be able to shed a little more light on the problem.
$open = opendir($onsite_dir);
while (($check = readdir($open))!= false){
if ($check != "." && $check != "..") {
$handle = fopen($check, "r");
if (!function_exists('file_get_contents')) {
$read = fread($handle, 800000);
} else {
$read = file_get_contents($onsite_url.$check);
}
str_replace("<script", "<?php /* <script", $read);
str_replace("</script>", "</script> */ ?>", $read);
if(!chmod($onsite_dir.$check, 0755)){ echo "Cannot change permission on file."; exit;}
if(!$open = fopen($onsite_dir.$check, "w")) { echo "Error :: Cannot open file: ".$check; exit;}
if (!fwrite($open, $read)) { echo "Cannot write to file: ".$handle."<br>"; exit;}
echo $check." Success.";
}
}
With the script above it doesnt do anything at all. Here is what all of the java tags look like.
<script type="text/javascript" language='javascript'>
//bunc of crap here
</script>
Thanks for your help thus far!