Cory94bailly Posted February 17, 2009 Share Posted February 17, 2009 Error: TotalLogFolder:/home/cory/logs/MASSattack/2009/February Log_Write: LogFolder:MASSattack Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/cory/htdocs/massattack/includes/log.php:18) in /home/cory/htdocs/massattack/includes/log.php on line 25 Warning: chmod() [function.chmod]: No such file or directory in /home/cory/htdocs/massattack/includes/log.php on line 29 Cant open log file! Code: <?php if (!defined('admin')) { die("Hacking Attempt."); } if(!is_dir("/home/cory/logs/".LogFolder."/".date("Y"))) { mkdir("/home/cory/logs/".LogFolder."/".date("Y"), 0777); } if(!is_dir("/home/cory/logs/".LogFolder."/".date("Y")."/".date("F"))) { mkdir("/home/cory/logs/".LogFolder."/".date("Y")."/".date("F"), 0777); } define("TotalLogFolder","/home/cory/logs/".LogFolder."/".date("Y")."/".date("F")); if (file_exists(TotalLogFolder."/".date("j").".txt")) { define("Log_Write",fopen($file, "a")); //If the file exists, writing will just use the same file. } else { define("Log_Write",fopen($file, "x")); //If the file does not exist, create the file and add the line. } echo "TotalLogFolder:" . TotalLogFolder; echo "<br />"; echo "Log_Write:" . Log_Write; echo "<br />"; echo "LogFolder:" . LogFolder; echo "<br />"; session_start(); //Everything connected, GOOD! //Now time to log everything they do >:] $file = TotalLogFolder."/".date("j").".txt"; //The file you are targeting.. $open = Log_Write or chmod($file, 0777); //Opening the file. $info = "$date | $time | $page | $ip | $hostname \n"; //What to write. if(!$open){ die('Cant open log file!'); } $t = fwrite($open, $info); //Write to file.. fclose($open); //Close file.. ?> That is the WHOLE script so please don't say "What is line ...?" It is saying those lines at the top because I was echoing to check and it seems that "Log_Write" is not working. I think that "Log_Write" is the only problem.. Any fixes possibly? (Also: Ignore the header errors, I know it's because I echoed) Link to comment https://forums.phpfreaks.com/topic/145603-solved-problem-with-a-constant/ Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 Headers errrors have their own sticky Yeah.... my fault. You can't define a handle to file as constant. It has to be a variable. Link to comment https://forums.phpfreaks.com/topic/145603-solved-problem-with-a-constant/#findComment-764430 Share on other sites More sharing options...
Cory94bailly Posted February 17, 2009 Author Share Posted February 17, 2009 Yeah.... my fault. No problem It's just that one constant "Log_Write" I think. Link to comment https://forums.phpfreaks.com/topic/145603-solved-problem-with-a-constant/#findComment-764433 Share on other sites More sharing options...
Mchl Posted February 17, 2009 Share Posted February 17, 2009 value The value of the constant; only scalar and null values are allowed. Scalar values are integer, float, string or boolean values. Link to comment https://forums.phpfreaks.com/topic/145603-solved-problem-with-a-constant/#findComment-764434 Share on other sites More sharing options...
Cory94bailly Posted February 17, 2009 Author Share Posted February 17, 2009 So could I do this? if (file_exists(TotalLogFolder."/".date("j").".txt")) { $Log_Write = fopen($file, "a"); //If the file exists, writing will just use the same file. } else { $Log_Write = fopen($file, "x"); //If the file does not exist, create the file and add the line. } I did that, echoed it and still get a blank. Link to comment https://forums.phpfreaks.com/topic/145603-solved-problem-with-a-constant/#findComment-764441 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.