Jump to content


Photo

how to open and write to a zone file


  • Please log in to reply
1 reply to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 10 July 2006 - 01:47 PM

I have tried to open a zone file but I keep getting the error

Parse error: parse error, unexpected T_STRING in test_open.php on line 3

here is the simple fopen() script

<?php
$filename ="mysite.com.zone"
fopen("C:\\windows\\system32\\dns\\etc\\$filename", "r")
?>

In this example I am just trying to open the zone file with the read permissions.
Also, which would be the best way to reload bind in a windows environment? Would that be some sort of socket or?

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 10 July 2006 - 02:33 PM

Use this:
<?php
$filename ="mysite.com.zone";
$file = "C:\\windows\\system32\\dns\\etc\\$filename";
$fp = fopen($file, "r");
$contents = fread($fp,filesize($file));
fclose($fp);
?>
or this:
<?php
$filename ="mysite.com.zone";
$contents = file_get_contents("C:\\windows\\system32\\dns\\etc\\$filename");
?>
to get the contents of the file.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users