mikoy and CoZZa:
mikoy> Hi! The script works fine for me except adminlog.php.
mikoy> I'm always getting: "Cannot create logs, cannot show logs."
mikoy> - thou the log is created (slog_200410_log.txt). I've tried
mikoy> to change permissions to *log.txt, but i can't - this is
mikoy> the single file, i cant set permissions.
CoZZa> Hey im having similar problem. The script is Excellant, and
CoZZa> i love it, but the adminlog.php is a problem for me.
CoZZa> I get Cannot Create Logs, Cannot Show logs, but no text file
CoZZa> is being created. I even gave Chmod 777 to the dir and files
CoZZa> and still didnt work.
Hello both of you. I missed this thread. I apologize. I hope my answer is still good for you.
The script, have the option to use a simple text file or a PHP file to store the passwords and usernames. You can set the option in slogin_lib.inc.php, named slogin_canusefopen. The original purpose was to let users with hosting providers with disabled functions, to use the script. However, some users started to use it because using the PHP file offers some extra security (because it cannot be read directly even if someone guess the filename).
The adminlog.php script file was written thinking "if the user is using the PHP file, then fopen function is disabled; if fopen is disabled, then the log files cannot be created; if the log files cannot be created, then we won't even try to show them". Well, my logic thinking was not right. So, if you have the variable slogin_canusefopen set to 0 (then you are using the PHP file for passwords and usernames) then the adminlog.php script will refuse to show the logs even if they are created. If that is your case (I think that's the situation of Mikoy) open the adminlog.php file and around line 32 change the line:
Code:
if ($slogin_canusefopen) {
with
Code:
if (true) {
That will effectively disable the silly verification of the slogin_canusefopen variable and will let you see your log files.
One last note: if you can't change the permissions of the log file, then most probably you are uploading your files as an user but the webserver is running as another. For example, if this is a server from a hosting company, maybe your FTP user is "mikoy", so all files you uploaded are owned by "mikoy". But the web server usually runs as another user, maybe called "nobody" or "www". So, when the script is run, all new files created are owned by the webserver user, not "mikoy". Because of that, you can't change permissions to it.
For CoZZa, if no log file is being created then maybe you have fopen disabled or you are using a server with PHP in safe-mode. How to tell? Create a test.php file containing this:
Code:
<?php
phpinfo();
?>
Upload it to your server, then load the page with your browser. You will see a listing with PHP configuration. Search for the safe_mode setting. If it is on, then you may not be able to create the log files. Safe mode is a security setting to disallow the PHP scripts to do some "potentially unsafe" things (including creating files as one user with scripts from another).
Please let me know how it works or what you discover.
mikoy> thx for script - i was looking for sth. like this.
mikoy> It'l would be nice if u could make an alternative
mikoy> script with pop-up window for loging. Unfortunatelly
mikoy> i'm new to php - cant rewrite yours
Let me think about that. That would require a bit of Javascript to pass the data from the popup to the main page. The problem I can see is with browsers with Javascript disabled and with popup blockers. This is more difficult with browsers that allow you to disable only some functions of Javascript (like Mozilla Firefox) because you cannot be never sure if the user will be able to see the popup or not.
Regards,
Mario A. Valdez-Ramirez.