Jump to content

Fwrite help


cry of war

Recommended Posts

I have a file I call My brain (Logs stuff so i can review it at a later time) but in this file i have a fwrite function and I was wondering is there a way i can store the files it makes into a different folder so it doesnt cluder my php file area for example

 

C:\apache2triad\htdocs\php\logger.php  is where the php file is located

C:\apache2triad\htdocs\php\logs\log.txt is where i would like the txt file to be

C:\apache2triad\htdocs\php\log.txt but this is where it is ATM

 

if (!isset($UserID)){
$UserID="0";
}
$Date=date('D, d M Y H:i:s T');
$IP=$_SERVER['REMOTE_ADDR'];
$Domain =$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$myFile = "log.txt";
$queryinfo = fopen($myFile, 'a') or die("can't open file");
$stringData = "Date:=>\"".$Date ."\"\nInvalid Input:=>\"".$nameofvar."\"=>\"".$value."\"\n\\\\\\\\\\Domain:=>\"".$Domain ."\"\n\\\\\\\\\\UserID:=>\"".$UserID ."\"\n\\\\\\\\\\IP:=>\"".$IP ."\"\n\n";
fwrite($queryinfo, $stringData);
fclose($queryinfo);

Link to comment
https://forums.phpfreaks.com/topic/81343-fwrite-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.