...

View Full Version : What is wrong with this piece of code?



Golden_Eagle
02-25-2003, 04:56 PM
This is the result I'm getting

http://www.font-factory.com/toplist/build.php

this is the code in build.php



<?
include("./config.php");
include("./common.php");
?>
<html>
<head><title></title>
<style>
body {color: #000000; background: #ffffff;}
a:link {color: #00ffff;}
a:visited {color: #00ffff;}
a:active {color: #00ffff;}
a:hover {color: #ffff00;}
</style>
</head>
<body><br><table align="center" cellpadding="6" cellspacing="6" border="0" bgcolor="#000000"><tr><td bgcolor="#000099"><font size="2" face="Arial" color="#ffff00">
<?
// Build index.html
if(!$file=fopen("$base_url/create.php","r")){
echo "Could not open file.";
}else{
while (!feof($file)) {
$buffer = fgets($file,4096);
$text .= $buffer;
}}
if($text){
$build_static=fopen("index.html","w");
fputs($build_static,$text);
echo "<a href=\"index.html\" target=\"_blank\">index.html</a> has been built.<br>";
}else{
echo "Could not build static.";
}
unset($text);

// Get and Build Categories
$cat_result=mysql_query("select * from categories order by ID asc",$db);
$cat_myrow = mysql_fetch_array($cat_result);
do {
$Category=$cat_myrow[Category];
$URL="$base_url/create.php?Category=".$Category;
if(!$file=fopen("$URL","r")){
echo "Could not open file.";
}else{
while (!feof($file)) {
$buffer = fgets($file,4096);
$text .= $buffer;
}}
if($text){
$cat_build_name=$Category.".html";
$build_static=fopen("$cat_build_name","w");
fputs($build_static,$text);
echo "<a href=\"".$Category.".html\" target=\"_blank\">".$Category.".html</a> has been built.<br>";
}else{
echo "Could not build static.";
}
$text="";
} while ($cat_myrow = mysql_fetch_array($cat_result));

// Build SF.html
if(!$file=fopen("$base_url/create.php?SF=Y","r")){
echo "Could not open file.";
}else{
while (!feof($file)) {
$buffer = fgets($file,4096);
$text .= $buffer;
}}
if($text){
$build_static=fopen("SF.html","w");
fputs($build_static,$text);
echo "<a href=\"SF.html\" target=\"_blank\">SF.html</a> has been built.<br>";
}else{
echo "Could not build static.";
}
$text="";


// Build NB.html
if(!$file=fopen("$base_url/create.php?NB=Y","r")){
echo "Could not open file.";
}else{
while (!feof($file)) {
$buffer = fgets($file,4096);
$text .= $buffer;
}}
if($text){
$build_static=fopen("NB.html","w");
fputs($build_static,$text);
echo "<a href=\"NB.html\" target=\"_blank\">NB.html</a> has been built.<br>";
}else{
echo "Could not build static.";
}
$text="";

// Build MA.html
if(!$file=fopen("$base_url/create.php?MA=Y","r")){
echo "Could not open file.";
}else{
while (!feof($file)) {
$buffer = fgets($file,4096);
$text .= $buffer;
}}
if($text){
$build_static=fopen("MA.html","w");
fputs($build_static,$text);
echo "<a href=\"MA.html\" target=\"_blank\">MA.html</a> has been built.<br>";
}else{
echo "Could not build static.";
}
$text="";
?>
</font></td></tr></table>
</body>
</html>


Why am I getting errors when trying to build these pages?
Can anyone help?

mordred
02-25-2003, 05:45 PM
You have no write permission for these files. You have to change their permissions with chmod via FTP or SSH.

Golden_Eagle
02-25-2003, 05:54 PM
I feel so stupid! LOL

Thanks for your help
It Worked!

:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum