Jump to content

fopen errors...Anyone please help...


huntersj78

Recommended Posts

Ok this might be a little difficult for me to explain.  I have a sight (not trying to sell anything) www(dot)discoverysound(dot)com/en for English and /jp for Japanese.

 

I made a control panel for this site so that it would be faster to edit things that get updated often.  Usually the ranking on the lefthand side. 

 

But today for some reason I went to update the ranking in the control panel and got an error I have never gotten before.

 

Warning: fopen(/home/jp/index.html): failed to open stream: Permission denied in /home/ControlPanel/mkfile/makeindex_jp.php on line 43

OPENエラー /home/jp/index.html

 

So I went to check in my makeindex_jp.php file along with the index.  Can some see if they can spot an error and even more tell me why this just now happened when I have been updating the rankings for years now and never ran into this problem.  Below is the code:

 

First /home/ControlPanel/mkfile/makeindex_jp.php on line 43

 

<?php

header('Content-Type: text/html; charset=UTF-8');

header('Content-Language: ja');



class MAKE_INDEX_JP

{

function MAKE_INDEX_JP()

{//コンストラクタからフォルダ作成

  if(is_dir("/home/jp/")){ $this -> FILE_CREATE();  }

      else

      {//フォルダが無い場合作成

         if(mkdir("/home/jp/",0777)){ $this -> FILE_CREATE(); }

         else                                 {  die("フォルダを作成できません"); }

      }

}



function FILE_CREATE()

{//トップ index.html作成

        $filename     = "/home/jp/index.html";

      include_once "/home/ControlPanel/SEARCH_FORM_func.php";

      

      if(file_exists($filename)){  $file  = fopen($filename,'w')  or die("OPENエラー $filename");  chmod($filename, 0766); }

      else                      {  $file  = fopen($filename,'w+') or die("作成エラー $filename");  chmod($filename, 0766); }



      flock($file,    LOCK_EX);      //ファイルロック



      $SQL_H = "SELECT * FROM MainHTML WHERE No = 1";

      $RST_H = mysql_query($SQL_H);

      $DATA_H= mysql_fetch_assoc($RST_H);

      

      $msg .= "<?php \n";

      $msg .= "header('Content-Type: text/html; charset=UTF-8');\n";

      $msg .= "header('Content-Language: ja');\n\n";

      

      $msg .= " session_start();\n\n";

      

      $msg .= "if(\$_SESSION[aid_SE] && !\$_GET[ch]){";

      $msg .= "  require_once('/home/jp/url/url_top2_jp.php');  ";

      $msg .= "}\n\n";

      

      $msg .= "?>\n";

      

      $fp = @fopen('/home/jp/incmeta/'.$TYPE.'.txt','r');

	 if(!$fp){  $fp = fopen('/home/jp/incmeta/default.txt','r'); 	 }



	 if($fp)

	 {

          flock($fp,LOCK_SH);



      	  $k=0;

      	  while(!feof($fp))

      	  {

      	  	 if(!$fp) break;

      	     $line[$k] = @trim(fgets($fp));

      	     

      	     $k++;

      	  }

      	  flock($fp,LOCK_UN);

      	  fclose($fp);

	 }



      $HEAD1 = mb_ereg_replace('\$LINE0',$line[0]."【DISCOVERY SOUND】",$DATA_H[Header]);

      $HEAD1 = mb_ereg_replace('\$LINE1',$line[1],$HEAD1);

      $HEAD1 = mb_ereg_replace('\$LINE2',$line[2],$HEAD1);

      

      $msg .= $HEAD1."\n\n";

      

      $BODY1 = mb_ereg_replace('\$LINE3',$line[3],$DATA_H[body1]);

      

      $msg .= $BODY1."\n\n";

      $msg .= SEARCH_FORM(); //フォーム

      



      $msg .= $DATA_H[body2]."\n\n";





          $msg .=  "<table width=\"170\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"c2px\">\n";

          $msg .=  "<tr>\n";

          $msg .=  "<td>\n";

          $msg .=  "<img src=\"/jp/imgs/maintitle_rank.gif\" alt=\"ランキング\" width=\"170\" height=\"20\" border=\"0\" class=\"imgsSpace\" /><div class=\"memuBack3\"><table width=\"168\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";



          $SQL_RANK = "SELECT * FROM ranking ORDER BY No ASC";

          $RST_RANK = mysql_query($SQL_RANK);

          

          $i=1;

          while($DATA_RANK = mysql_fetch_array($RST_RANK))

          {



            $SQL_D = "SELECT * FROM cd_data WHERE no='$DATA_RANK[goods_No]'";

            $RST_D = mysql_query($SQL_D);



             $DATA_D = mysql_fetch_array($RST_D);



             $msg .=  "<tr>\n";

             $msg .=  "<td align=\"left\" valign=\"top\" class=\"ranktop\"> ".$i.". </td><td valign=\"top\" class=\"ranktop\"><b><a href=\"/jp/$DATA_RANK[type]/\">".$DATA_D[e_name]."</a></b></td>\n";

             $msg .=  "<td width=\"55\" align=\"center\" class=\"ranktop\">\n";

             $msg .=  "<a href=\"/jp/$DATA_RANK[type]/\">";



                  if($DATA_D[cd_type] == "AUDIO CD"){ $SEO_CD = "サンプリングCD「$DATA_D[e_name]」";      }

              elseif($DATA_D[cd_type] == "CD-ROM")  { $SEO_CD = "サンプリングCD-ROM「$DATA_D[e_name]」";  }

              else                                  { $SEO_CD = "サンプリングCD/CD-ROM「$DATA_D[e_name]」";  }



             $msg .=   "<img src=\"/image/jp/title/$DATA_D[kensaku_image]\" width=\"50\" height=\"50\" border=\"0\" alt=\"$SEO_CD\" /></a></td>\n";

             $msg .=   "</tr>\n";



             $i++;

             $data_co = $DATA_RANK[date_s_ja];

           }



             $s_date_y = substr($data_co,0,4);

             $s_date_m = substr($data_co,4,2);

             $s_date_d = substr($data_co,6,2);



           $msg .=  "<tr><td colspan=\"3\" align=\"center\" class=\"ranktop\" >\n";

           $msg .=  $s_date_y."年";



           $msg .= sprintf('%01d',$s_date_m);

           $msg .=  "月度";

           $msg .=  "</td></tr>";

           $msg .=  "</table></div>\n";

           $msg .=  "</td></tr>";

           $msg .=  "</table>";

           $msg .= $DATA_H[body3]."";



           // # # # # # # # #ここから # # # # # # # # # # # # # # # # 

           $msg .=  "<?php \n";

           $msg .=  "    if(\$_SESSION[image]==1){ readfile(\"/home/jp/common/top2.html\") ; \$_SESSION[image]=2; }\n";

           $msg .=  "elseif(\$_SESSION[image]==2){ readfile(\"/home/jp/common/top3.html\") ; \$_SESSION[image]=1; }\n";

           $msg .=  "else                        { readfile(\"/home/jp/common/top2.html\") ; \$_SESSION[image]=2; }\n";

           $msg .=  "?> \n";

           





           $msg .=  "<img src=\"/jp/imgs/maintitle_whatsnew.gif\" alt=\"What's New\" width=\"600\" height=\"20\" border=\"0\" style=\"margin-top:15px;\" />";

           $msg .=  "<table width=\"600\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"memuBack6\">";

           $msg .=  "<td width=\"150\" align=\"center\" valign=\"middle\">";

           

           $SQL_WHAT = "SELECT * FROM whatnew_jp ORDER BY No DESC LIMIT 4";

           $RST_WHAT = mysql_query($SQL_WHAT);



           $Y = 0;



           while($DATA_WHAT = mysql_fetch_assoc($RST_WHAT))

           {//what's new

              list($F_width, $F_height) = @GetImageSize("/home/jp/images/".$DATA_WHAT[File_Image]);

              list($T_width, $T_height) = @GetImageSize("/home/jp/images/".$DATA_WHAT[Title_Image]);



              if($Y != 0){ $msg .=  "<table width=\"600\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"memuBack6\"><td width=\"150\" align=\"center\" valign=\"middle\">\n"; }



              $msg .=   "<a href=\"$DATA_WHAT[url]\">";

              $msg .=   "<img src=\"/jp/images/$DATA_WHAT[File_Image]\" alt=\"$DATA_WHAT[Title]\" width=\"$F_width\" height=\"$F_height\" vspace=\"5\" /></a>";

              $msg .=   "</td>\n";

              $msg .=   "<td valign=\"top\" class=\"whatsnewmoji\">\n";

              $msg .=   "<a href=\"$DATA_WHAT[url]\">\n";

              $msg .=   "<img src=\"/jp/images/$DATA_WHAT[Title_Image]\" alt=\"$DATA_WHAT[Title]\" width=\"$T_width\" height=\"$T_height\" border=\"0\" class=\"tuvatop\" />\n";

              $msg .=   "</a><br />\n";

              $msg .=   "$DATA_WHAT[Discription]";

              $msg .=   "</td>\n";

              $msg .=   "</tr>\n";

              $msg .=   "</table>\n";



              $Y++;

            }





              //ここからトピックス&NEWS

           	  $SQL_TOPICS = "SELECT * FROM topics ORDER BY row_No DESC limit 2";

          $RST_TOPICS = mysql_query($SQL_TOPICS); 



          $ui=0;

          

              //$msg .=  "<br />\n";



              $msg .=  "<div class=\"wnsp\"> </div>";

              $msg .=  "<img src=\"/jp/images/maintitle_review.gif\" alt=\"Special Review\" width=\"600\" height=\"20\" border=\"0\" /><div class=\"memuBack7\"><table width=\"578\" align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>";



          while($top_info=mysql_fetch_array($RST_TOPICS))

          {

            $msg .=  "<td width=\"274\" valign=\"top\"><div class=\"topreviewtitle\"><strong><a href=\"$top_info[title_link]\" target=\"_self\">$top_info[title]</a></strong></div><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>";



                 if($top_info[imagepass])

             {//画像がある場合

                    

                    $msg .=  "<td width=\"100\" valign=\"top\">\n";

                    $msg .=  "<a href=\"$top_info[title_link]\" target=\"_self\">";

                    $msg .=  "<img src=\"/jp/images/topicsimage/$top_info[imagepass]\" alt=\"\" border=\"0\" /></a>";

                    $msg .=  "</td>\n";



                    $msg .=  "<td width=\"10\"> </td>\n";



                    $msg .=  "<td align=\"left\" valign=\"top\" class=\"newsr\">\n";

                    $msg .=  $top_info[contents];

                    $msg .=  "</td>\n";

                    $msg .=  "</tr>\n";

                    $msg .=  "</table></td>\n";

            }

            else

            {//画像が無い場合

                    $msg .=  "<td valign=\"top\" class=\"newsr\">\n";

                    $msg .=  "<a href=\"$top_info[title_link]\" target=\"_self\"><img src=\"/jp/images/topicsimage/$top_info[imagepass]\" /></a>\n";

                    $msg .=  "</td>\n";



                    $msg .=  "<td width=\"10\"> </td>\n";



                    $msg .=  "<td align=\"left\" valign=\"top\" >\n";

                    $msg .=  $top_info[contents];

                    $msg .=  "</td>\n";

                    $msg .=  "</tr>\n";

                    $msg .=  "</table></td>\n";

            }



               if($ui == 0)

               {//ループ一回目のみ表示

                 $msg .=  "<td width=\"30\"> </td>\n";

               }

               

               $ui++;

          }

          $msg .=  "</tr>\n";

              $msg .=  "</table>\n";



                $msg .=  " <div align=\"right\" style=\"margin-top:10px; \">";

                $msg .=  " <a href=\"/jp/review/\" target=\"_self\">";

                $msg .=  " <img src=\"/jp/images/more_review.gif\" width=\"140\" height=\"18\" border=\"0\" alt=\"\" /></a>";

                $msg .=  "</div>\n\n";

                

                $msg .=  "</div>\n";

                

                $msg .=  "</td>\n";

                $msg .=  "</tr>\n";

                $msg .=  "</table>\n";





//////////////////////////////////////////////



/*

              $msg .=  "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";

              $msg .=  "<tr>\n";

              $msg .=  "<td valign=\"top\" width=\"295\">\n";

              $msg .=  "<a href=\"/jp/review/\">\n";

              $msg .=  "<img src=\"http://www.discoverysound.com/jp/imgs/specialreview.gif\" alt=\"REVIEW\" width=\"295\" height=\"20\" border=\"0\" class=\"imgsSpace\"></a></td>\n";

              $msg .=  "<td width=\"10\"> </td>\n";

              $msg .=  "<td valign=\"top\" width=\"295\">\n";

              $msg .=  "<a href=\"/jp/all_news/\"><img src=\"http://www.discoverysound.com/jp/imgs/latestnews.gif\" alt=\"NEWS\" width=\"295\" height=\"20\" border=\"0\" class=\"imgsSpace\"></a></td>\n";

              $msg .=  "</tr></table>\n";

              

                

              $msg .=  "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\" width=\"295\" class=\"memuBack4\">\n";

              $msg .=  "\n";

              $msg .=  "\n";



               //$url = "html/top_review.html";

               //INC_Top_Info($url);



          $SQL_TOPICS = "SELECT * FROM topics ORDER BY row_No DESC limit 3";

          $RST_TOPICS = mysql_query($SQL_TOPICS); 



          $ui=0;



          while($top_info=mysql_fetch_array($RST_TOPICS))

          {



           $msg .=  "<div class=\"topreviewtitle\"><strong>\n";

        

                    if($top_info[No] != 10){ $msg .=  "<a href=".$top_info[title_link]." target=\"_self\">".$top_info[title]."</a>\n"; }

                elseif($top_info[No] == 10){ $msg .=  "<a href=".$top_info[title_link]." target=\"_blank\">".$top_info[title]."</a>\n"; }



               $msg .=  "</strong></div>\n";



           $msg .=  "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";

           $msg .=  "<tr>\n";



           if($top_info[imagepass])

           { 

              $msg .=  "<td width=\"10\"> </td>\n";

              $msg .=  "<td width=\"100\" valign=\"top\">\n";



                       if($top_info[No] != 10){ $msg .=  "<a href=\"$top_info[title_link]\" target=\"_self\"><img src=\"http://www.discoverysound.com/jp/images/topicsimage/$top_info[imagepass]\" border=\"0\"></a>\n"; }

                   elseif($top_info[No] == 10){ $msg .=  "<a href=\"$top_info[title_link]\" target=\"_blank\"><img src=\"http://www.discoverysound.com/jp/images/topicsimage/$top_info[imagepass]\" border=\"0\"></a>\n"; }



                  $msg .=  "</td>\n";

              $msg .=  "<td width=\"10\"> </td><td align=\"left\" valign=\"top\" class=\"newsr\">\n";	}



           else

           {

              $msg .=  "<td width=\"10\"> </td><td align=\"left\" valign=\"top\" class=\"newsr\">\n";

           }



              $msg .=  $top_info[contents]."\n";



              $msg .=  "</td><td width=\"10\"> </td>\n";

              $msg .=  "</tr>\n";

              $msg .=  "</table>\n";



              $ui++;

     }

                  

                  

                  $msg .=  "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";

              $msg .=  "<tr>\n";

              $msg .=  "<td width=\"10\" height=\"45\"> </td>\n";

              $msg .=  "<td width=\"100\"> </td>\n";

              $msg .=  "<td width=\"10\"> </td>\n";

              $msg .=  "<td align=\"right\" valign=\"middle\">\n";

              $msg .=  "<a href=\"/jp/review/\" target=\"_self\"><img src=\"/jp/images/more_review.gif\" width=\"140\" height=\"18\" border=\"0\"></a>";

              $msg .=  "</td>";

              $msg .=  "<td width=\"10\"> </td>\n";

              $msg .=  "</tr>\n";

              $msg .=  "</table>";

          

          

              $msg .=  "</td>\n";

              $msg .=  "<td width=\"10\"> </td>\n";

              $msg .=  "<td valign=\"top\" width=\"295\" class=\"memuBack4\">\n";

              $msg .=  "<table width=\"293\" border=\"0\" cellspacing=\"0\" cellpadding=\"5\">\n";

              $msg .=  "<tr>\n";

              $msg .=  "<td valign=\"top\">\n";



              $SQL_NEWS = "SELECT * FROM news ORDER BY No DESC LIMIT 9";

              $RST_NEWS = mysql_query($SQL_NEWS);

              

            while($news = mysql_fetch_array($RST_NEWS))

            {

              $msg .=  "<div class=\"news\" align=\"left\">".$news[s_date]."<br />\n";

              $msg .=  "<a href=\"/jp/news_detail/$news[No]/\">".$news[title_ja]."</a></div>\n";

            }



              $msg .=  "</td>\n";

              $msg .=  "</tr>\n";

              $msg .=  "</table>\n";

              $msg .=  "</td>\n";

              $msg .=  "</tr>\n";

              $msg .=  "</table>\n";

*/

        //# # # # # # # # # # # # # #  ここまで # # # # # # # # # # # # # # # # 



           $msg .= "</td>\n";

           $msg .= "</tr>\n";

           $msg .= "</table>\n";



           $msg .= "<div align=\"center\">\n";

           $msg .= $DATA_H[bottom];

           $msg .= " </div>\n";



           $msg .= "<script language=\"JavaScript\" type=\"text/javascript\">\n";

           $msg .= "<!-- Overture K.K.\n";

           $msg .= "window.ysm_customData = new Object();\n";

           $msg .= "window.ysm_customData.conversion = \"transId=,currency=,amount=\";";

           $msg .= "var ysm_accountid  = \"19PGUJ064JUPAB9MKE1OFEL0FO8\";";

           $msg .= "document.write(\"<SCR\" + \"IPT language='JavaScript' type='text/javascript' \" \n";

           $msg .= "+ \"SRC=//\" + \"srv3.wa.marketingsolutions.yahoo.com\" + \"/script/ScriptServlet\" + \"?aid=\" + ysm_accountid \n";

           $msg .= "+ \"></SCR\" + \"IPT>\");\n";

           $msg .= "// -->\n";

           $msg .= "</script>\n";

           

           $msg .= " </body>\n";

           $msg .= "</html>\n";



         fputs($file, $msg);         //書き出し

         flock($file, LOCK_UN);      //ロック解除

         fclose($file);              //ファイルポインタクローズ

}

}



?>

 

 

 

Next the OPENエラー /home/jp/index.html:

 

Sorry the html wont fit....

Link to comment
https://forums.phpfreaks.com/topic/191317-fopen-errorsanyone-please-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.