Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is wrong with this piece of code?

    This is the result I'm getting

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

    this is the code in build.php

    Code:
    <?
    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?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have no write permission for these files. You have to change their permissions with chmod via FTP or SSH.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I feel so stupid! LOL

    Thanks for your help
    It Worked!



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •