yoshi273
06-17-2002, 01:03 PM
Ive posted something related to this problem before, but i think i have more and better information now.
I wrote this script a while ago that generates files on a server based on some text entered. The files are standard HTML files. They are part of a template for a video player I made, and different people want differnt things on their video players. So, you goto a script, enter some data about what you want on your video player, then click a "generate" button, and it creates all these HTML files customized to what the person wants. Its really simple.
This thing used to work fine on the server, up until one day. It started spewing safe mode errors everywhere complaining that PHP shouldnt be writing files to the disk and whatnot. The server admin insisted that he had done absolutely nothing to the server, but I didnt believe it. Anywho, i couldnt figure out how to fix the problem, so i just ran it on another server as a temporary fix. The temporary server ran PHP4.0.6. Right this minute, im re-investigating this problem, and have found some new information...
I ran a simple phpinfo script on the first server, and found that it had PHP4.2.1. Now, if im not mistaken, that version hasnt been out for more than 2 months i think. The script was working fine before then - so im assuming the server admin upgraded PHP on his server, and the new version might have a problem with my script. Its totally understandable, but im kinda mad that he didnt tell me that. Anyways, ive posted the part of my code that creates the files, if there is some way i can fix it to resolve this (assuming this is even the problem) then please let me know. Any help that you can offer me will help. Thanks!
Oh, and please dont laugh at my coding. Its horribly done, no comments and im sure its full of security issues. =)
if(!file_exists("$cpath/$file"))
{
include("./popup/video/56k_qt.php");
include("./popup/video/56k_real.php");
include("./popup/video/56k_wmp.php");
include("./popup/video/bb_qt.php");
include("./popup/video/bb_real.php");
include("./popup/video/bb_wmp.php");
include("./popup/video/info.php");
mkdir("$cpath/$file", 0777);
mkdir("$cpath/$file/video", 0777);
mkdir("$cpath/$file/video/template", 0777);
$file1 = "$cpath/$file/video/56k_qt.html";
$file2 = "$cpath/$file/video/56k_real.html";
$file3 = "$cpath/$file/video/56k_wmp.html";
$file4 = "$cpath/$file/video/bb_qt.html";
$file5 = "$cpath/$file/video/bb_real.html";
$file6 = "$cpath/$file/video/bb_wmp.html";
$file7 = "$cpath/$file/video/info.html";
$fp1 = fopen($file1, "w+");
$fp2 = fopen($file2, "w+");
$fp3 = fopen($file3, "w+");
$fp4 = fopen($file4, "w+");
$fp5 = fopen($file5, "w+");
$fp6 = fopen($file6, "w+");
$fp7 = fopen($file7, "w+");
fwrite($fp1, $k56_qt);
fwrite($fp2, $k56_real);
fwrite($fp3, $k56_wmp);
fwrite($fp4, $bb_qt);
fwrite($fp5, $bb_real);
fwrite($fp6, $bb_wmp);
fwrite($fp7, $info);
fclose($fp7);
fclose($fp6);
fclose($fp5);
fclose($fp4);
fclose($fp3);
fclose($fp2);
fclose($fp1);
copy("./popup/index.html", "$cpath/$file/index.html");
copy("./popup/video/index.html", "$cpath/$file/video/index.html");
copy("./popup/video/template/56k.html", "$cpath/$file/video/template/56k.html");
copy("./popup/video/template/bb.html", "$cpath/$file/video/template/bb.html");
copy("./popup/video/template/choose_speed.html", "$cpath/$file/video/template/choose_speed.html");
copy("./popup/video/template/c-top.html", "$cpath/$file/video/template/c-top.html");
copy("./popup/video/template/getplayer.html", "$cpath/$file/video/template/getplayer.html");
copy("./popup/video/template/help.html", "$cpath/$file/video/template/help.html");
copy("./popup/video/template/sniffer.html", "$cpath/$file/video/template/sniffer.html");
copy("./popup/video/template/v-bottom.html", "$cpath/$file/video/template/v-bottom.html");
copy("./popup/video/template/vsniffer.swf", "$cpath/$file/video/template/vsniffer.swf");
oh, and just in case you need a better idea of what my code is doing:
1: First, load all the HTMl templates w/ variables into memory. These are the include lines @ the top
2: create some folders for all this crap to go into, mkdir commands
3: define the filenames
4: open connections to those files. They shouldnt already exist, so w+ should create new files.
5: write the templates to files w/ variables replaced (the variables were defined earlier in the script)
6: close file connections
7: copy files that dont need to be changed/templated to complete the video player.
I wrote this script a while ago that generates files on a server based on some text entered. The files are standard HTML files. They are part of a template for a video player I made, and different people want differnt things on their video players. So, you goto a script, enter some data about what you want on your video player, then click a "generate" button, and it creates all these HTML files customized to what the person wants. Its really simple.
This thing used to work fine on the server, up until one day. It started spewing safe mode errors everywhere complaining that PHP shouldnt be writing files to the disk and whatnot. The server admin insisted that he had done absolutely nothing to the server, but I didnt believe it. Anywho, i couldnt figure out how to fix the problem, so i just ran it on another server as a temporary fix. The temporary server ran PHP4.0.6. Right this minute, im re-investigating this problem, and have found some new information...
I ran a simple phpinfo script on the first server, and found that it had PHP4.2.1. Now, if im not mistaken, that version hasnt been out for more than 2 months i think. The script was working fine before then - so im assuming the server admin upgraded PHP on his server, and the new version might have a problem with my script. Its totally understandable, but im kinda mad that he didnt tell me that. Anyways, ive posted the part of my code that creates the files, if there is some way i can fix it to resolve this (assuming this is even the problem) then please let me know. Any help that you can offer me will help. Thanks!
Oh, and please dont laugh at my coding. Its horribly done, no comments and im sure its full of security issues. =)
if(!file_exists("$cpath/$file"))
{
include("./popup/video/56k_qt.php");
include("./popup/video/56k_real.php");
include("./popup/video/56k_wmp.php");
include("./popup/video/bb_qt.php");
include("./popup/video/bb_real.php");
include("./popup/video/bb_wmp.php");
include("./popup/video/info.php");
mkdir("$cpath/$file", 0777);
mkdir("$cpath/$file/video", 0777);
mkdir("$cpath/$file/video/template", 0777);
$file1 = "$cpath/$file/video/56k_qt.html";
$file2 = "$cpath/$file/video/56k_real.html";
$file3 = "$cpath/$file/video/56k_wmp.html";
$file4 = "$cpath/$file/video/bb_qt.html";
$file5 = "$cpath/$file/video/bb_real.html";
$file6 = "$cpath/$file/video/bb_wmp.html";
$file7 = "$cpath/$file/video/info.html";
$fp1 = fopen($file1, "w+");
$fp2 = fopen($file2, "w+");
$fp3 = fopen($file3, "w+");
$fp4 = fopen($file4, "w+");
$fp5 = fopen($file5, "w+");
$fp6 = fopen($file6, "w+");
$fp7 = fopen($file7, "w+");
fwrite($fp1, $k56_qt);
fwrite($fp2, $k56_real);
fwrite($fp3, $k56_wmp);
fwrite($fp4, $bb_qt);
fwrite($fp5, $bb_real);
fwrite($fp6, $bb_wmp);
fwrite($fp7, $info);
fclose($fp7);
fclose($fp6);
fclose($fp5);
fclose($fp4);
fclose($fp3);
fclose($fp2);
fclose($fp1);
copy("./popup/index.html", "$cpath/$file/index.html");
copy("./popup/video/index.html", "$cpath/$file/video/index.html");
copy("./popup/video/template/56k.html", "$cpath/$file/video/template/56k.html");
copy("./popup/video/template/bb.html", "$cpath/$file/video/template/bb.html");
copy("./popup/video/template/choose_speed.html", "$cpath/$file/video/template/choose_speed.html");
copy("./popup/video/template/c-top.html", "$cpath/$file/video/template/c-top.html");
copy("./popup/video/template/getplayer.html", "$cpath/$file/video/template/getplayer.html");
copy("./popup/video/template/help.html", "$cpath/$file/video/template/help.html");
copy("./popup/video/template/sniffer.html", "$cpath/$file/video/template/sniffer.html");
copy("./popup/video/template/v-bottom.html", "$cpath/$file/video/template/v-bottom.html");
copy("./popup/video/template/vsniffer.swf", "$cpath/$file/video/template/vsniffer.swf");
oh, and just in case you need a better idea of what my code is doing:
1: First, load all the HTMl templates w/ variables into memory. These are the include lines @ the top
2: create some folders for all this crap to go into, mkdir commands
3: define the filenames
4: open connections to those files. They shouldnt already exist, so w+ should create new files.
5: write the templates to files w/ variables replaced (the variables were defined earlier in the script)
6: close file connections
7: copy files that dont need to be changed/templated to complete the video player.