Jump to content

fwrite() not a valid resource


elite_prodigy

Recommended Posts

Okay, below I create all the directories and open all the files needed to run the SiteBuilder.

<?php

//set up the directories and build files


mkdir($site);
mkdir($site."/admin");
 mkdir($site."/admin/style");
  $adm_style_overall = fopen($site."/admin/style/overall.css", "w+"); //written
 $adm_dirt = fopen($site."/admin/dirt.php", "w+"); //written
 $adm_index = fopen($site."/admin/index.php", "w+"); //written
 $adm_login = fopen($site."/admin/login.php", "w+"); //written
 $adm_pass = fopen($site."/admin/change_pass.php", "w+"); //written
 $adm_dish_it = fopen($site."/admin/dish_it.php", "w+"); //written
 $adm_old_posts = fopen($site."/admin/old_posts.php", "w+"); //written
 $adm_profile = fopen($site."/admin/profile.php", "w+"); //written
 $adm_user_admin = fopen($site."/admin/user_admin.php", "w+"); //written
 $adm_temp_request = fopen($site."/admin/temp_request.php", "w+"); //written
 $adm_appearance = fopen($site."/admin/appearance.php", "w+");//written
mkdir($site."/images");
mkdir($site."/staff");
mkdir($site."/style");
 $site_style_overall = fopen($site."/style/overall.css", "w+"); //written
$site_dirt_digger = fopen($site."/dirt_digger.php", "w+"); //written
$site_dirt_digger_archive = fopen($site."/dirt_digger_archive.php", "w+"); //written
$site_do_dirt = fopen($site."/do_dirt.php", "w+"); //written
$site_index = fopen($site."/index.php", "w+"); //written
$site_secrets = fopen($site."/secrets.php", "w+"); //written
$site_staff = fopen($site."/staff.php", "w+"); //written

?>

 

 

Now, here I write staff.php, and get this error:

Warning: fwrite(): 18 is not a valid stream resource in /home/expose/public_html/exposeyourschool.co.cc/register.php on line 972

 

Warning: fclose(): 18 is not a valid stream resource in /home/expose/public_html/exposeyourschool.co.cc/register.php on line 973

 

<?php

/*** Begin staff.php ***/
$page_staff = "
<?php


$"."conn = mysql_connect(\"localhost\", \"********\", \"**********\") or die(mysql_error());
mysql_select_db(\"********\",$conn) or die(mysql_error());


$"."get_pages = \"SELECT * FROM `".$site."_staff`;\";
$"."page_data = mysql_query($"."get_pages,$"."conn);


while($"."pages = mysql_fetch_array($"."page_data)){
$"."name = $"."pages[username];


$"."list .= \"<a href=\\\"$"."namehttp://www.exposeyourschool.co.cc/\".$"."site.\"/staff/\".$\".\"name.\".php\\\">$\".\"name</a><br /><br /><br />\";


}


?>
<html>
<head>
<title>".$district."\'s Dirty Little Secrets</title>


<style type=\"text/css\">
@import url(\"http://www.exposeyourschool.co.cc/{$site}/style/overall.css\");
</style>


</head>


<body>


<table class=\"main\" border=\"0\">


<tr>
 <td colspan=\"2\">


  <table class=\"logo\" border=\"0\">


   <tr valign=\"top\">
    <td>

     <center><img src=\"http://www.exposeyourschool.co.cc/".$site."/images/header.jpg\" /></center>


<br />


    </td>
   </tr>


  </table>


 </td>
</tr>


<tr class=\"mid\" valign=\"top\">
 <td class=\"nav\">


<a href=\"http://www.exposeyourschool.co.cc/".$site."/index.php\">Home</a> <br />
<br />
<a href=\"http://www.exposeyourschool.co.cc/".$site."/secrets.php\">Dirty Little Secrets</a> <br />
<br />
<a href=\"http://www.exposeyourschool.co.cc/".$site."/staff.php\">Staff</a> <br />
<br />
<a href=\"http://www.exposeyourschool.co.cc/".$site."/dirt_digger.php\">Dirt Digger</a> <br />
<br />
<a href=\"http://www.exposeyourschool.co.cc/".$site."/dirt_digger_archive.php\">Dirt Digger Archive</a> <br />


  
 </td>
 <td class=\"body\">
  
<?php


echo $"."list;


?>




 </td>
</tr>


<tr class=\"bot\" valign=\"top\">
 <td class=\"footer\" colspan=\"2\">
  <center>


   <script type=\"text/javascript\" src=\"http://x10hosting.com/adserve.js?corporate\"></script><br />
   Copyright © 2008 ".$site." Secrets and Their Volunteers<br />
   All Outside Links and Articles are © Their Respective Owners<br />




  </center>
 </td>
</tr>


</table>


</body>


</html>
";


//write file
fwrite($site_index, $page_index); //this is the line with the errors
fclose($site_index);                  //This is the line with the errors.
/*** End staff.php ***/

?>

 

Can anyone tell me why this particular error keeps popping up?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.