help with code
Posted: Fri Jan 07, 2005 8:54 am
what I am trying to do here is to create a folder which
is named after a persons ip address and then write to a file in that folder
This code is successful at creating the folder and writes to
a file , however the file sits outside the persons folder
Thanks in advance for your help!!
feyd | Help us, help you. Please use
is named after a persons ip address and then write to a file in that folder
This code is successful at creating the folder and writes to
a file , however the file sits outside the persons folder
Code: Select all
<?php
$file= $_ENV['REMOTE_ADDR'];
mkdir("./$file", 0777);
function WriteToFile($strFilename, $strText)
{
if($fp = @fopen($strFilename,"w "))
{
$contents = fwrite($fp, $strText);
fclose($fp);
return true;
}else{
return false;
}
}
WriteToFile('test.txt','test 123');
?>feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]