Jump to content
Jack_mcs

SiteMonitor

Recommended Posts

Please provide file names and line numbers when asking about a problem.

You could try the code change already mentioned.

 

Hi Jack

 

When I run sitemonitor_hacker_cron.php, either by cron or direct I get the following error

 

Warning: array_walk() [function.array-walk]: The argument should be an array in /.../admin/sitemonitor_hacker_cron.php on line 83

 

Warning: array_flip() [function.array-flip]: The argument should be an array in /.../admin/sitemonitor_hacker_cron.php on line 84

 

 

I don't have this line in /includes/functions/sitemonitor_function.php

/********************** END CHECK THE USERNAME *********************/

 

to add this code below? to stop that false .php file in images error

 

 ?> <pre> <?php
print_r(glob(DIR_FS_CATALOG . DIR_WS_IMAGES . '*.php'));
?> </pre> <?php

echo 'cnt = '.count(glob(DIR_FS_CATALOG . DIR_WS_IMAGES . '*.php'));

 

Thanks

PF

Share this post


Link to post
Share on other sites

I know it's odd, but we are hosting another site on ours and that is how our provider set it up.

 

Is there something I can try to tell it not to delete it?

 

Thanks for your help on a great contrib!

Jen

You need to fix that problem. It can also cause problems with other parts of your shop so trying to sidestep it is a mistake.

Share this post


Link to post
Share on other sites

When I run sitemonitor_hacker_cron.php, either by cron or direct I get the following error

 

Warning: array_walk() [function.array-walk]: The argument should be an array in /.../admin/sitemonitor_hacker_cron.php on line 83

 

Warning: array_flip() [function.array-flip]: The argument should be an array in /.../admin/sitemonitor_hacker_cron.php on line 84

You can change

array_walk($refFiles, 'GetOnlyPath');
to
array_walk((array)$refFiles, 'GetOnlyPath');   

But that shouldn't be necessary so my guess is there is a problem somewhere else in the setup.

 

I don't have this line in /includes/functions/sitemonitor_function.php

/********************** END CHECK THE USERNAME *********************/

It's in sitemonitor_admin.php.

Share this post


Link to post
Share on other sites

You can change


array_walk($refFiles, 'GetOnlyPath');

It's in sitemonitor_admin.php.

 

Thanks I will edit that

 

SiteMonitor checks and reports on itself every time it runs because it

creates a few files to start and adds data to logs etc during normal operation

and since those files are located right in the admin folder the only way to it

stop it, is exclude the whole admin folder. which defeats the whole purpose.

 

I created another directory called logs, and edited sitemonitor.php for cron with

the new log paths, sitemonitor_log_0.txt, sitemonitor_reference_0.php and it works

fine.

 

But I am having a problem with setting the new log path for sitemonitor_configure_0.php

in sitemonitor_functions.php

 

I also relixze the new log path needs to work with the delete and create

functions in the admin area thats why I'm asking to make sure I do it right.

 

Can you please let me know what files need to be edited to maunally add a log path

off of the admin folder for all sitemonitor auto generated files?.

 

Thanks

PF

Share this post


Link to post
Share on other sites

Thanks I will edit that

 

SiteMonitor checks and reports on itself every time it runs because it

creates a few files to start and adds data to logs etc during normal operation

and since those files are located right in the admin folder the only way to it

stop it, is exclude the whole admin folder. which defeats the whole purpose.

 

I created another directory called logs, and edited sitemonitor.php for cron with

the new log paths, sitemonitor_log_0.txt, sitemonitor_reference_0.php and it works

fine.

 

But I am having a problem with setting the new log path for sitemonitor_configure_0.php

in sitemonitor_functions.php

 

I also relixze the new log path needs to work with the delete and create

functions in the admin area thats why I'm asking to make sure I do it right.

 

Can you please let me know what files need to be edited to maunally add a log path

off of the admin folder for all sitemonitor auto generated files?.

 

Thanks

PF

The problems with the logs, and a fix, have already been posted. If you want to change the code to work differently, you'll need to trace through and find the places to change. But 90% of the code is in the functions file, to get you started.

Share this post


Link to post
Share on other sites

Ok ive got everything working great! cron set up and running perfectly. I noticed everyday when the script runs in creates a log file for that day. in the admin folder. this is ok if it was only 1 or 2 files. but lets say i run this everyday for a year.. thats 360 log files in the admin folder... my question is. if i create a folder name "logs" where do i change code so that logs are written to this folder? (if they must create a file for each day)

Share this post


Link to post
Share on other sites

Ok ive got everything working great! cron set up and running perfectly. I noticed everyday when the script runs in creates a log file for that day. in the admin folder. this is ok if it was only 1 or 2 files. but lets say i run this everyday for a year.. thats 360 log files in the admin folder... my question is. if i create a folder name "logs" where do i change code so that logs are written to this folder? (if they must create a file for each day)

Log files should not be created each time it is ran. There is a setting for how large the log files are. Maybe you set that toa low value. Or it might be a case of the log file code not checking for the instance of the job being ran, in which case I will need to make a code change to fix that.

Share this post


Link to post
Share on other sites

Log files should not be created each time it is ran. There is a setting for how large the log files are. Maybe you set that toa low value. Or it might be a case of the log file code not checking for the instance of the job being ran, in which case I will need to make a code change to fix that.

 

the log file settings are set to default. 100000 is the setting right now. sitemonitor_log_012_01_2011.txt is the one that is created each day. _012, _013, _014 etc...

sitemonitor_log_0.txt and sitemonitor_hacker_excludes_0.txt are doing ok.

Share this post


Link to post
Share on other sites

the log file settings are set to default. 100000 is the setting right now. sitemonitor_log_012_01_2011.txt is the one that is created each day. _012, _013, _014 etc...

sitemonitor_log_0.txt and sitemonitor_hacker_excludes_0.txt are doing ok.

Hmm, I don't know why that might be. I've had this version running on one of my sites since Sunday and there is still only one log file. Maybe you should delete the sitemonitor_log_0.txt and sitemonitor_reference_0.php files and try starting over.

Share this post


Link to post
Share on other sites

The problems with the logs, and a fix, have already been posted. If you want to change the code to work differently, you'll need to trace through and find the places to change. But 90% of the code is in the functions file, to get you started.

 

I tried them all, those fixes, do not work correctly they even create new problems.

 

I did get SiteMonitor to write to a log folder by adding another entry like DIR_FS_ADMIN2

and editing some files relating to ref, log etc I then exclude logs and I never get false

emails anymore. what a pain in the ... finding those path locations

 

I asked you in a earlier post to simply let me know how to set a manual path for a log folder,

you could have saved me hours by just letting me know where the 4 or 5 quick edits where at.

Common, you knew exactly where they where, as well as a tip to start with DIR_FS_ADMIN paths.

remember the only reason I even asked about that in the first place was because of a bug in

the program code.

 

Whenever you get around to fixing things in the contrib download, its a good idea to give users a

choice to set a folder path for instances of log, ref and config files.

 

You should know more then anybody

Static built in paths that relay on default folder settings are asking to be hacked or rendered

useless. I have removed the admin settings altogether and just use it with cron. to many errors

especially running sitemonitor_hacker_cron.php, I also read some of your replays to posters stating

its server related, I tested on at lest 3 different linux servers with the same results.

 

and that image folder contains .php files, error message, every time the update page displays, is

a problem in the code not, the server.

 

PF

Share this post


Link to post
Share on other sites

Nothing was changed regarding the emails. Whatever email address is set in the setting is the one that is used. All I can suggest is that you be sure you are looking at the correct instance. That is, if you have two instances setup and they have different email addresses, you may be running the wrong one.

 

Jack, on this email situation, just some feedback here in hopes that it helps.

 

After I run some site monitor admin processes, I am also seeing my emails coming in from an email address different than what I set up in site monoitor -> configure.

 

I have my standard me@mydomain.com email set up, but instead the email shows its sent from my_server_account_username@myservername.com. I hope that's not too confusing i.e. it would look something like accountname001@biz23.superhosting.com.

 

for 2.3.1

Operating system linux

Apache version 2.2.16

PHP version 5.2.14

Edited by altoid

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Jack, on this email situation, just some feedback here in hopes that it helps.

 

After I run some site monitor admin processes, I am also seeing my emails coming in from an email address different than what I set up in site monoitor -> configure.

 

I have my standard me@mydomain.com email set up, but instead the email shows its sent from my_server_account_username@myservername.com. I hope that's not too confusing i.e. it would look something like accountname001@biz23.superhosting.com.

If you look in the actual sitemonitor_confiugre.php file, are the email addresses listed there the correct ones?

 

What happens if you go to admin->SiteMonitor->Configure and change the email addresses to something totally different? Does the email you receive have the correct address?

 

How are you running SiteMonitor to see the failure (1st, 2ns or 3rd update button)?

Share this post


Link to post
Share on other sites

I am going to respond with some info now, then work with the sitemonitor_configure_0.php file, and make those changes in emails to see what happens. But for now....

 

If you look in the actual sitemonitor_confiugre.php file, are the email addresses listed there the correct ones?

 

I found a sitemonitor_configure_0.php file and if I understand what you are looking for here's what I see

 

$to = 'some_address@your_domain.com'; //where email is sent to
$from = 'From: some_address@your_domain.com'; //where email is sent from

$start_dir = '/home/username/public_html'; //your shops root
$admin_dir = 'http://www.yourdomain.com/admin'; //your shops admin
$admin_username = 'username'; //your admin username
$admin_password = 'password'; //your admin password

 

What happens if you go to admin->SiteMonitor->Configure and change the email addresses to something totally different? Does the email you receive have the correct address?

I will test that out shortly

 

How are you running SiteMonitor to see the failure (1st, 2ns or 3rd update button)?

What I did when I ran Site Monitor was the third buton "Manually Execute Site Monitor" and then the first button, "Delete Reference File"


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I am going to respond with some info now, then work with the sitemonitor_configure_0.php file, and make those changes in emails to see what happens. But for now....

 

OK...here's that follow up.

 

First, by using the Configuration Control panel "http://myshop.com/admin/sitemonitor_configure_setup.php" I changed the "from" email to something different (to a yahoo address) and updated that setting. Then over in the sitemonitor admin side "http://myshop.com/admin/sitemonitor_admin.php" I ran the process with the third, then first buttons. Result: the email received is the one with "myusername@myhost.com" address. Meaning literally the from email address is my username on my host with the domain being my host's domain....

 

So with sitemonitor_configure_0.php still showing:

$to = 'some_address@your_domain.com'; //where email is sent to 
$from = 'From: some_address@your_domain.com'; //where email is sent from 

$start_dir = '/home/username/public_html'; //your shops root 
$admin_dir = 'http://www.yourdomain.com/admin'; //your shops admin 
$admin_username = 'username'; //your admin username 
$admin_password = 'password'; //your admin password

 

I hard coded these lines:

 

$to = 'some_address@your_domain.com'; //where email is sent to 
$from = 'From: some_address@your_domain.com'; //where email is sent from 

$start_dir = '/home/username/public_html'; //your shops root 

 

to what I wanted.

 

Then testing in the sitemonitor admin side "http://myshop.com/admin/sitemonitor_admin.php", using button 3 [Manually Execute Sitemonitor] and 1 [Delete Reference File] my emails came in with the correct "from" address. So the hard coding seemed to fix things up.

 

Hope that helps......


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I hard coded these lines:

 

$to = 'some_address@your_domain.com'; //where email is sent to 
$from = 'From: some_address@your_domain.com'; //where email is sent from 

$start_dir = '/home/username/public_html'; //your shops root 

 

to what I wanted.

I don't understand what you mean by hard-coded. Are you saying you changed the functions file?

Share this post


Link to post
Share on other sites

OK...here's that follow up.

 

First, by using the Configuration Control panel "http://myshop.com/admin/sitemonitor_configure_setup.php" I changed the "from" email to something different (to a yahoo address) and updated that setting. Then over in the sitemonitor admin side "http://myshop.com/admin/sitemonitor_admin.php" I ran the process with the third, then first buttons. Result: the email received is the one with "myusername@myhost.com" address. Meaning literally the from email address is my username on my host with the domain being my host's domain....

 

So with sitemonitor_configure_0.php still showing:

$to = 'some_address@your_domain.com'; //where email is sent to 
$from = 'From: some_address@your_domain.com'; //where email is sent from 

$start_dir = '/home/username/public_html'; //your shops root 
$admin_dir = 'http://www.yourdomain.com/admin'; //your shops admin 
$admin_username = 'username'; //your admin username 
$admin_password = 'password'; //your admin password

 

I hard coded these lines:

 

$to = 'some_address@your_domain.com'; //where email is sent to 
$from = 'From: some_address@your_domain.com'; //where email is sent from 

$start_dir = '/home/username/public_html'; //your shops root 

 

to what I wanted.

 

Then testing in the sitemonitor admin side "http://myshop.com/admin/sitemonitor_admin.php", using button 3 [Manually Execute Sitemonitor] and 1 [Delete Reference File] my emails came in with the correct "from" address. So the hard coding seemed to fix things up.

 

Hope that helps......

 

 

Hi I spent a great deal of time looking into files for

something else trust me.

 

There are only 2 files in the sitemonitor program

that you can hard code a default email address into.

other then using the admin panel of course.

 

sitemonitor_configure_setup.php

includes/functions/sitemonitor_functions.php

 

Its possible if someone worked on your site at one time

or another, they may have hard coded an old email address

into one of these files to make things easy for you in the

future. I know because that's what I did, should I ever need

to delete the config file.

 

PF

 

PS Jack I got everything to function correctly including the

admin panel using a option folder for all generated logs.

Thank you for making it available, if you like I can post exactly

how I did it, just let me know.

Edited by phpfan

Share this post


Link to post
Share on other sites

I finally found out the solution to the email issue.

In the configure page, under the from email address field, you HAVE TO put in From: then your email address.

If you just put in your email address without the From: then it won't work. It will go to the server default address whatever that is.

 

Hope this helps. Cheers.

Share this post


Link to post
Share on other sites

I don't understand what you mean by hard-coded. Are you saying you changed the functions file?

 

Sorry, I apparently used the incorrect terminology. What I meant was in sitemonitor_configure_0.php I manually changed these lines:

 

$to = 'some_address@your_domain.com'; //where email is sent to  
$from = 'From: some_address@your_domain.com'; //where email is sent from  

$start_dir = '/home/username/public_html'; //your shops root 

 

Whaterver was within the single quotes, I manually changed to what I was changing by using the configuration page on the admin side.

 

So for example I changed 'some_address@your_domain.com' to 'me@mydomain.com', etc, then uploaded the sitemonitor_configure_0.php file.

 

Anyway, after doing that the "from" email is showing up correctly now as before it was showing up as originating from my server's domain.

 

Hope that's clearer.


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

Its possible if someone worked on your site at one time

or another, they may have hard coded an old email address

into one of these files to make things easy for you in the

future. I know because that's what I did, should I ever need

to delete the config file.

 

Hi there, all this is taking place on a relatively out of the box 2.3.1 version. I am the only one working on it.

 

As noted in my previous post, it was only in the sitemonitor_configure_0.php that I manually changed the email address which got the incoming email "from" address to work for me.

 

Thanks


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I finally found out the solution to the email issue.

In the configure page, under the from email address field, you HAVE TO put in From: then your email address.

If you just put in your email address without the From: then it won't work. It will go to the server default address whatever that is.

 

Hope this helps. Cheers.

 

That seems to be the ticket.

 

By including the "From:" in the area on the admin->sitemonitor->configure page, that not only has my incoming emails showing the correct "from" address, but the sitemonitor_configure_0.php file now updates correctly on the server.

 

In my case, when I let out the "From:" in the email address area next to where it says "Email address that the SiteMonitor email is sent from (useful for multiple shops)." not only did the server default email address show up, but the sitemonitor_configure_0.php was not updated correctly either.

 

After a couple test runs, all seems to be operating fine now. Thanks


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

I've installed the latest version of Site Monitor on my 2.3.1 site as per the instructions but get the following when I try to configure:

 

 

*****************

 

Internal Server Error

 

The server encountered an internal error or misconfiguration and was unable to complete your request.

 

Please contact the server administrator, webmaster@xxx.xxx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

 

More information about this error may be available in the server error log.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

 

******************

 

Any ideas? I'm running a fairly clean site. Very few contributions/modules aside from Security Pro, PayPal IPN, CDN Tax Order and Store Pickup.

 

Cheers,

Michael Ripley

Edited by oscarfellini

Share this post


Link to post
Share on other sites

I've installed the latest version of Site Monitor on my 2.3.1 site as per the instructions but get the following when I try to configure:

 

Internal Server Error

Any ideas? I'm running a fairly clean site. Very few contributions/modules aside from Security Pro, PayPal IPN, CDN Tax Order and Store Pickup.

That's a general error that can be caused by many things. If everything else is working, then it is probably either a mistake in the installation or you are trying to monitor too many files. The quickest way to find the problem is to see what the actual failure is. If you have an error_log file in your admin directory, that should list it. If not, ask your host to look at the problem to see what the actual error is.

Share this post


Link to post
Share on other sites

Hi everybody.

 

First of all, my congratulations for this very useful contribution.

After quite some CHMOD tweaking on my server I managed to have it working almost 100%.

 

There is ONE main thing I still cannot understand, though.

 

When I click on the fourth button "manually check for hacked files", I get a list of suspected files: within this list I found what I am sure to be a hacker's file, therefore, I click on the main "exclude" tick box to select all of the suspected files for exclusion, then deselect the hacker's file.

Finally, I tick the "overwrite exclude file" box and click update button.

 

As a result, all the scheduled files for exclusion get actually excluded and the only file that is left is the hacker's file.

 

At this point, should I immediately run a second "manual check for hacked files" and tick "use exclude file" box, I would expect the only hacker's file to show up, HOWEVER, that does not happen at all!

What I get is once again the full list of suspected files INCLUDING the hacker's file...something which tells me the "exclude file option" is not working as it should.

 

The funniest thing is that I checked the file "sitemonitor_hacker_excludes_0.txt" (which I previously CHMODed 666) at server level while all the above happens and it gets updated with all the changes!

 

Anyone has got any idea of what is actually wrong?

 

Thanks a lot in advance!

 

Mendoh

Share this post


Link to post
Share on other sites

First of all, my congratulations for this very useful contribution.

After quite some CHMOD tweaking on my server I managed to have it working almost 100%.

 

There is ONE main thing I still cannot understand, though.

 

When I click on the fourth button "manually check for hacked files", I get a list of suspected files: within this list I found what I am sure to be a hacker's file, therefore, I click on the main "exclude" tick box to select all of the suspected files for exclusion, then deselect the hacker's file.

Finally, I tick the "overwrite exclude file" box and click update button.

 

As a result, all the scheduled files for exclusion get actually excluded and the only file that is left is the hacker's file.

 

At this point, should I immediately run a second "manual check for hacked files" and tick "use exclude file" box, I would expect the only hacker's file to show up, HOWEVER, that does not happen at all!

What I get is once again the full list of suspected files INCLUDING the hacker's file...something which tells me the "exclude file option" is not working as it should.

 

The funniest thing is that I checked the file "sitemonitor_hacker_excludes_0.txt" (which I previously CHMODed 666) at server level while all the above happens and it gets updated with all the changes!

 

Anyone has got any idea of what is actually wrong?

It sounds like you are doing everything correctly but I just tried it here and it works as expected so there is something different. You mention having to set the permissions, which isn't normally necessary, so that may be causing a problem. Although since the hacker txt file has the names you excluded, that seems unlikely. If you click out of SiteMonitor and then back again,check the use exclude box and run the hacker test again does it work properly? What version of oscommerce is this for?

Share this post


Link to post
Share on other sites

Dear Jack,

 

thanks for your super-fast reply!

 

The permission settings actually had me gone crazy when trying to have Sitemonitor working properly...I was getting a lot of timeouts errors and writing permission errors.

The only way I could solve them was to CHMOD 666 most of the contribution files including reference file and text files, besides, I have to CHMOD777 the admin directory whenever Sitemonitor has to create the reference file from scratch and create the daily log .txt file, otherwise it is surefire error.

 

I really believe my host is to blame for all the above...

 

I tried exactly what you suggested: no way, situation stays just as I described in my previous posting.

There is, however, another very weird thing I have noticed, showing there is definitely something which does not work correctly: if, after getting 128 suspected files listed by the "manually check for hacked files" function, I exclude them all by ticking the main "exclude" box, then deselect the only hacker's file from exclusion list and update the exclude file, here is what happens

 

1) the hacker's file grows fairly big in dimensions and if verified it shows the update with all the 127 excluded files has happened correctly

 

2) when I run the manual check for hacked files again and tick "use exclude file" the ONLY file which gets actually excluded is just the one that should not (the hacker's file), whereas I still am presented with all the remaining 127 files I previously excluded!!

 

The version I am running is a highly modified 2.2 RC2A

 

Thanks again for your support, much appreciated

 

Mendoh

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×