mariovaldez.net
http://www.mariovaldez.net/webapps/forums/

adminlog.php
http://www.mariovaldez.net/webapps/forums/viewtopic.php?f=11&t=151
Page 1 of 1

Author:  mikoy [ 27 Oct 2004, 09:37 ]
Post subject:  adminlog.php

Hi!

The script works fine for me except adminlog.php. I'm always getting:
"Cannot create logs, cannot show logs." - thou the log is created (slog_200410_log.txt). I've tried to change permissions to *log.txt, but i can't - this is the single file, i cant set permissions.

Did anyone have the same problems like i do? How can i solve tihis problem?

Thanks in a dvance,

mikoy

p.s. thx for script - i was looking for sth. like this. It'l would be nice if u could make an alternative script with pop-up window for loging. Unfortunatelly i'm new to php - cant rewrite yours :(

Author:  -CoZZa- [ 12 Nov 2004, 05:20 ]
Post subject: 

Hey im having similar problem.

The script is Excellant, and i love it, but the adminlog.php is a problem for me.

I get Cannot Create Logs, Cannot Show logs, but no text file is being created.

I even gave Chmod 777 to the dir and files and still didnt work.

I think i might of missed something....

CoZZa

Author:  mvaldez [ 06 Dec 2004, 23:40 ]
Post subject:  Problems viewing the logs and popup login...

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. :oops:

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.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/