Allow different folder for logfiles
This commit is contained in:
parent
ba5c9fbd72
commit
a1a4c1ec7f
2 changed files with 16 additions and 7 deletions
|
@ -64,6 +64,7 @@ define("MIN_PASS_LENGTH", 8);
|
|||
* Default: Do not write logfile
|
||||
*/
|
||||
|
||||
// define("WRITE_LOG", true);
|
||||
# define("WRITE_LOG", true);
|
||||
# define("WRITE_LOG_PATH","/var/log/webmum/");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -94,14 +94,22 @@ function write_pass_hash_to_db($pass_hash, $uid){
|
|||
* Add message to logfile
|
||||
*/
|
||||
function writeLog($text){
|
||||
if(defined('WRITE_LOG')){
|
||||
$logfile = fopen("log/log.txt", "a") or die("Unable to create / open logfile \"log/log.txt\" in root directory!");
|
||||
fwrite($logfile, $text."\n");
|
||||
fclose($logfile);
|
||||
if(defined('WRITE_LOG') && defined('WRITE_LOG_PATH')){
|
||||
echo WRITE_LOG_PATH;
|
||||
$logdestination = realpath(WRITE_LOG_PATH).DIRECTORY_SEPARATOR."log";
|
||||
echo $logdestination;
|
||||
if(is_writable(WRITE_LOG_PATH)){
|
||||
$logfile = fopen($logdestination, "a") or die("Unable to create or open logfile \"$logdestination\" in root directory!");
|
||||
fwrite($logfile, $text."\n");
|
||||
fclose($logfile);
|
||||
}
|
||||
else{
|
||||
die("Directory \"WRITE_LOG_PATH\" is not writable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue