Jump to content
Jack_mcs

SiteMonitor

Recommended Posts

The original code did check the directories but I changed it for speed. My thinking was that there isn't any reason to check directories since, if someone hacked into your site, it would be a waste of time for them to just change the directory settings. Is there another reason you would want those monitored?

 

Jack

Share this post


Link to post
Share on other sites

In case any body is interested: try the following to get the manual way to run in admin area.

 

 

1 In sitemonitor.php find line 29 ish and make sure:

 

define('VERBOSE', 1);

 

2 Edit admin/includes/boxes/tools.php

 

Add the following line to the end of ' $contents[] = array( ' after last '<a href'

 

'<a href="' . tep_href_link(sitemonitor.php) . '" class="menuBoxContentLink">' . BOX_TOOLS_SITEMONITOR . '</a>');

 

Remember to replace '</a>'); on previous line with '</a><br>' . or you will get an error

 

3 Edit admin/includes/languages/english.php

 

Add the following:

 

define('BOX_TOOLS_SITEMONITOR', 'Site Monitor');

 

 

 

Under tools section in admin should be site monitor. This will manually run the check and display the results.

 

Once finished click back button.

 

Chris

Share this post


Link to post
Share on other sites
chmod your admin directory with 777 but DON'T chmod the files within! just the directory!

 

 

Is this safe? Without doing this I get an openbase dir error, but I'm a bit concerned about 777ing the admin directory.

 

Thanks... very nice and simple contrib.

Share this post


Link to post
Share on other sites

I wouldn't recommend it but your host might require such a setting.

 

Jack

Share this post


Link to post
Share on other sites

I can manually run site monitor with great results, I am new to cron jobs but I tried to set it up and this was the result I got.

 

Status: 404

X-Powered-By: PHP/4.4.2

Content-type: text/html

 

No input file specified.

 

This is the command I used

php /home/xxxx/public_html/catalog/xxxx/sitemonitor.php

 

Since I am unfamiliar with cronjobs I am not sure this error No input file specified is on my side in the cron job or I need to set something in the php files.

 

Thank you

Wendy

Share this post


Link to post
Share on other sites

The syntax for cron jobs vary with hosts. You may have to cd into your admin directory for it to work. Your host should be able to provide you with the proper syntax but you could try

cd /home/xxxx/public_html/catalog/xxxx/; php sitemonitor.php

 

Jack

Share this post


Link to post
Share on other sites
I can manually run site monitor with great results, I am new to cron jobs but I tried to set it up and this was the result I got.

 

Status: 404

X-Powered-By: PHP/4.4.2

Content-type: text/html

 

No input file specified.

 

This is the command I used

php /home/xxxx/public_html/catalog/xxxx/sitemonitor.php

 

Since I am unfamiliar with cronjobs I am not sure this error No input file specified is on my side in the cron job or I need to set something in the php files.

 

Thank you

Wendy

I received a similar error 404 when setting up cron... removed the bit that Jack mentions in the path as USERNAME and it worked perfectly. :thumbsup:

 

Cheers Jack, great contribution!

 

----------

Dave


one-click installation..

Dave's info

Share this post


Link to post
Share on other sites

This is the results Im getting when I run SiteMonitor manualy.........

 

What am I doing wrong ?

 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/18/d174507728/htdocs/rivercityweb/admin/sitemonitor.php:1) in /homepages/18/d174507728/htdocs/rivercityweb/admin/includes/functions/sessions.php on line 67

No new files found...

No deleted files found...

No size differences found...

No time mismatches found...

No permissions mismatches found...

Email sent to shop owner.


Toby Wilson

Share this post


Link to post
Share on other sites

A new version has been uploded. Here are the major changes:

 

- Added error_log to the excluded files code (works now).

- Added admin control section.

- Added code to allow sub-directories to be excluded.

- Added log function (creates a log of all changes if option is set).

- Fixed bug in functions file.

 

I didn't provide any update instructions since all of the files were changed. Just follow the install instructions in the readme. You can delete the sitemonitor_functions.php file from the admin directory since that has been moved to the functions directory.

 

Jack

Share this post


Link to post
Share on other sites

awesome!

Thanks for the reply!

installing it now


Toby Wilson

Share this post


Link to post
Share on other sites

Jack,

 

This is a superb contribution. Thanks for updating it.

 

Do you think this contribution will work on older versions of OSC?

 

Thanks

Joe


Evil will always triumph over good...

Because good is dumb.

- D.H.

Share this post


Link to post
Share on other sites

Yes, it doesn't use change any existing code except for common files like english.php.

 

Jack

Share this post


Link to post
Share on other sites

I had to comment out these two lines in sitemonitor_functions.php in order to make the script run without giving me error messages:

 

$dp=opendir($dir);

 

while (false!=($file=readdir($dp)) && $level == $last)

 

If I leave those two lines in, I get these error messages:

 

Warning: opendir(/home/public_html/osCommerce/catalog/): failed to open dir: No such file or directory in /home/[username]/public_html/osCommerce/catalog/[admin]/includes/functions/sitemonitor_functions.php on line 56

 

Warning: readdir(): supplied argument is not a valid Directory resource in /home/[username]/public_html/osCommerce/catalog/[admin]/includes/functions/sitemonitor_functions.php on line 58

Reference file creation failed.

 

Any suggestions?

Share this post


Link to post
Share on other sites
I had to comment out these two lines in sitemonitor_functions.php in order to make the script run without giving me error messages:

 

$dp=opendir($dir);

 

while (false!=($file=readdir($dp)) && $level == $last)

 

If I leave those two lines in, I get these error messages:

 

Warning: opendir(/home/public_html/osCommerce/catalog/): failed to open dir: No such file or directory in /home/[username]/public_html/osCommerce/catalog/[admin]/includes/functions/sitemonitor_functions.php on line 56

 

Warning: readdir(): supplied argument is not a valid Directory resource in /home/[username]/public_html/osCommerce/catalog/[admin]/includes/functions/sitemonitor_functions.php on line 58

Reference file creation failed.

 

OK, I think I have it working now. I had to use Control Panel to CHMOD the configuration file to get it to take the changes I made, then everything started to work.

Share this post


Link to post
Share on other sites

Hi, Jack,

 

I installed your newest contribution and I have one issue. I don't have a problem in creating the reference file, however, whenever I try to use Execute Sitemonitor, a blank page ultimately appears after about 60 seconds and there is no email sent to my email address.

 

Any help will be appreciated!

 

Ken

Share this post


Link to post
Share on other sites

Hi, Jack,

 

Sorry about the previous post. I logged out and logged back on and the problem went away!!

 

Please ignore my previous post. Thanks!

 

Ken

Share this post


Link to post
Share on other sites

There's a timeout limit on servers (60 seconds is quite long). If you reach that limit, that might happen. Try excluding some directories from the search (be sure to regenerate the reference file afterwards).

 

Jack

Share this post


Link to post
Share on other sites

My cron job is not working here is what i get. I tried both ways to run the job.

 

Status: 302

X-Powered-By: PHP/4.4.1

Set-Cookie: osCAdminID=54a2be68ad897cf711891d1e789d3cec; path=/catalog/; domain=www.mywebsite.com

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-catalog, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Location: https://www.mywebsite.com/catalog/admin/log...1891d1e789d3cec

Content-type: text/html

 

<br />

<b>Warning</b>: main(includes/languages/english/): failed to open stream: No such file or directory in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br /> <br />

<b>Warning</b>: main(includes/languages/english/): failed to open stream: No such file or directory in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br /> <br />

<b>Warning</b>: main(): Failed opening 'includes/languages/english/' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br />

Share this post


Link to post
Share on other sites

The standard cron syntax won't work for all servers. You will need to contact your host to get the proper syntax.

 

Jack

Share this post


Link to post
Share on other sites
The standard cron syntax won't work for all servers. You will need to contact your host to get the proper syntax.

 

Jack

I sent them an email and will let you know what happens. Thanks

Share this post


Link to post
Share on other sites
My cron job is not working here is what i get. I tried both ways to run the job.

 

Status: 302

X-Powered-By: PHP/4.4.1

Set-Cookie: osCAdminID=54a2be68ad897cf711891d1e789d3cec; path=/catalog/; domain=www.mywebsite.com

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Cache-Control: no-catalog, no-cache, must-revalidate, post-check=0, pre-check=0

Pragma: no-cache

Location: https://www.mywebsite.com/catalog/admin/log...1891d1e789d3cec

Content-type: text/html

 

<br />

<b>Warning</b>: main(includes/languages/english/): failed to open stream: No such file or directory in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br /> <br />

<b>Warning</b>: main(includes/languages/english/): failed to open stream: No such file or directory in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br /> <br />

<b>Warning</b>: main(): Failed opening 'includes/languages/english/' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in <b>/home/xxxx/public_html/catalog/admin/includes/application_top.php</b> on line <b>202</b><br />

My Hosting said that syntax I put in is correct. This is what is in line 202 in the application_top.php

 

include(DIR_WS_LANGUAGES . $language . '/' . $current_page);

 

Any ideas

Share this post


Link to post
Share on other sites

Assuming you can run the script manually, the problem is with cron. Although convincing your host of that may not be so easy. Try this command

cd /home/USERNAME/public_html/admin; /usr/local/bin/php /home/USERNAME/public_html/admin/sitemonitor.php

You will need to change USERNAME as well as correct the paths if they are not correct. If that doesn't work, go back to your host and explain that the script can be ran manually so it has to be cron related.

 

Jack

Share this post


Link to post
Share on other sites
Assuming you can run the script manually, the problem is with cron. Although convincing your host of that may not be so easy. Try this command
cd /home/USERNAME/public_html/admin; /usr/local/bin/php /home/USERNAME/public_html/admin/sitemonitor.php

You will need to change USERNAME as well as correct the paths if they are not correct. If that doesn't work, go back to your host and explain that the script can be ran manually so it has to be cron related.

 

Jack

Will tray and let you know thanks for a quick response.

Share this post


Link to post
Share on other sites
Will tray and let you know thanks for a quick response.

I also tried that but get the same error. This is what support told me

 

Hello:

The errors you are seeing are just warnings so running it manually may be suppressing the warnings. If you have the PHP reporting mode set so that it reports Warnings also, you may receive the warnings as well.

 

Any Ideas?

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

×