Jack_mcs 1,020 Posted October 9, 2010 On the shop of a partner he installed SiteMonito also. But he got a error now Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in /www/htdocs__///__includes/functions/sitemonitor_functions.php on line 148 That error is most likely due to some invalid or non-standard name for one of your files. You would need to isolate it to find the problem. The easiest way is to exclude all directories and run the script to make sure it works without that error. Then start adding them back in and testing each time. When you find one that fails, look at the reference file for a file name that is different. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
Motive 0 Posted October 9, 2010 (edited) Hey Im getting access denied "No Right Permission Access" when I try to click on Site Monitor Admin or configure. I am using osCMax 2.025 Edited October 9, 2010 by Motive Share this post Link to post Share on other sites
Motive 0 Posted October 9, 2010 (edited) Hey Im getting access denied "No Right Permission Access" when I try to click on Site Monitor Admin or configure. I am using osCMax 2.025 And I know to ask my host admin but I don't really know what to ask for? What "write or right" permission do I need and where or on what file? What is the root of the problem? Edited October 9, 2010 by Motive Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted October 9, 2010 And I know to ask my host admin but I don't really know what to ask for? What "write or right" permission do I need and where or on what file? What is the root of the problem? Unfortunately, it is against forum rules to support oscommerce forks. You'll need to ask in the oscMax forums. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
jps001 0 Posted October 10, 2010 Solved both problems, Thanks Share this post Link to post Share on other sites
Dj-Viper 18 Posted October 10, 2010 Hi, Also solved my problem. Was not the file or server permissions that were wrong, but the startline in the configuration file, had put there also /index.php behind it, but that was wrong, after deleting that it worked like a charme. Greetings, Anne Share this post Link to post Share on other sites
kenboon 0 Posted October 12, 2010 Hi, I keep getting this error. Warning: opendir(/home/username/public_html/) [function.opendir]: failed to open dir: No such file or directory in /home/******/public_html/catalog/*****/includes/functions/sitemonitor_functions.php on line 419 I'v stared out the admin ect for obvious reasons. Can anyone pleasse help me resolve this? Regards, Ken Share this post Link to post Share on other sites
kenboon 0 Posted October 12, 2010 Just noticed something very odd. In the top left hand corner in the Sitemonitor part of the Admin Control, it says "Logged in as: c (Logoff)" But that is not my log in name? It seems to log me in as C for some reason each time I then Go on to the Site Monitor bit. Regards, Ken Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted October 12, 2010 Just noticed something very odd. In the top left hand corner in the Sitemonitor part of the Admin Control, it says "Logged in as: c (Logoff)" But that is not my log in name? It seems to log me in as C for some reason each time I then Go on to the Site Monitor bit. Both problems covered here recently. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
kenboon 0 Posted October 12, 2010 Jack, thank you. I did search before I asked, ut was unable to find an answer. I missed a letter when typing my username in the Start Directory part. I'v had a little play with theis and it really is a very good contribution :) Thanks Ken Share this post Link to post Share on other sites
thefragfarmer 0 Posted October 13, 2010 I know this issue has been covered previously but i dont quite understand how the person was able to fix it.... Every time i click on SiteMonitor (Admin or Config) I get: Warning: opendir(public_html/my_directory/) [function.opendir]: failed to open dir: No such file or directory in /home1/thegoods/public_html/my_directory/admin/includes/functions/sitemonitor_functions.php on line 419 Your username is invalid. Please change it and try again. Any help would be greatly appreciate it as I have been hacked twice and want to get all these security strategies implemented. Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted October 13, 2010 Warning: opendir(public_html/my_directory/) [function.opendir]: failed to open dir: No such file or directory in /home1/thegoods/public_html/my_directory/admin/includes/functions/sitemonitor_functions.php on line 419 Your username is invalid. Please change it and try again. Verify the username is correct with the steps previously mentioned. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
kenboon 0 Posted October 13, 2010 Fragfarmer. Go to File manager to confirm the name it is correct. Share this post Link to post Share on other sites
Ausgirl 3 Posted October 14, 2010 I know this issue has been covered previously but i dont quite understand how the person was able to fix it.... Every time i click on SiteMonitor (Admin or Config) I get: Warning: opendir(public_html/my_directory/) [function.opendir]: failed to open dir: No such file or directory in /home1/thegoods/public_html/my_directory/admin/includes/functions/sitemonitor_functions.php on line 419 Your username is invalid. Please change it and try again. Any help would be greatly appreciate it as I have been hacked twice and want to get all these security strategies implemented. The answer to these is on the previous pages. Pages 60 to 65 so not so far to look over. "Logged in as: c (Logoff)" the answer to that is on the page before this one. Jack has stated the code change & where to change it. Your username is invalid. Please change it and try again. In SiteMonitor under the configuration heading in your Admin it says... Start Directory: /home1/thegoods/public_html (The root of the shop). Check that yours states /home1/thegoods/public_html & not /home/thegoods/public_html As for the Warning: opendir(public_html/my_directory/) [function.opendir]: failed to open dir: No such file or directory in /home1/thegoods/public_html/my_directory/admin/includes/functions/sitemonitor_functions.php on line 419 The suggestions didnt fix mine so I thought I'd worry about it later, I went & had coffee & when I came back I loaded my site back up & the error was gone, looks all good now. Sometimes you have to close the browser & reload rather than refresh to see things working. Share this post Link to post Share on other sites
rocaholic 0 Posted October 20, 2010 Does SiteMonitor conflict with .htaccess functionality? Share this post Link to post Share on other sites
Dj-Viper 18 Posted October 20, 2010 Hi, Rocaholic Does SiteMonitor conflict with .htaccess functionality? My enginering of php etc is not very good, but no it doesn't conflict. Sitemonitor is direct on the server of the website, htaccess is only access to the website outsite the admin. Greetings, Dj Viper Share this post Link to post Share on other sites
Andrew Cargill 0 Posted October 21, 2010 Hi there, This looks like a fantastic contribution but I have just installed it and am receiving the following error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 20 bytes) in /home/***/public_html/***/sitemonitor_configure_setup.php on line 116 Does anybody have an idea on what I am doing wrong? Cheers, Andy 0 Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted October 21, 2010 This looks like a fantastic contribution but I have just installed it and am receiving the following error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 20 bytes) in /home/***/public_html/***/sitemonitor_configure_setup.php on line 116 Does anybody have an idea on what I am doing wrong? If it is failing when first installed, then it is probably due to trying to load too may files. You will need to edit the sitemonitor_configure.php file to exclude some of the directories. Several examples of how to do this are in this thread. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
lybrary 0 Posted October 27, 2010 Site Monitor is a great contribution, however it obviously was not tested on sites with lots of files. My site has close to half a million files. There are a couple of bugs I have found. The out of memory error is easy to fix, but for others I had to debug for hours. Here are my findings: - function ExcludeDirectory: Why do you pass a start_dir variable? It is never used for anything even though you run some string operations on it but then never use it. So I removed that one. (This was not really a bug but unnecessary code.) - file: sitemonitor_configure_setup.php: You are missing a "require('sitemonitor_configure_setup.php');" right at the beginning and you need to get rid of "$excludeList = array();" /****************** BUILD THE HACKED FILE LIST *********************/ $excludeList = array(); Because otherwise the excluded directories are still being processed which on big sites leads to a failing script. With these changes I can at least run the site monitor, however not the check for hacked files. There again we have a function rglob() which tries to traverse all subdirectories ignoring the excluded ones. On big sites this is simply not possible. rglob should also obey the exclusions or if you want have another set of exclusions for this operation. What I did is add a if (ExcludeDirectory($sSubDir, $sDir)) continue; Inside the foreach of the rglob() function plus adding the necessary "require('sitemonitor_configure.php');" in sitemonitor_admin.php. It seems to be running even though I have not fully thought this through. In general I have to note that some of the coding techniques used in this contribution is pretty strange or awkward if you will. I like the idea of the contribution but execution is a bit shaky. Share this post Link to post Share on other sites
lybrary 0 Posted October 27, 2010 Oh my oh my, the algorithms used in function runSitemonitor are really bad. Any site with more than a few hundred files will not be able to run this function because it most likely will time out with a server error. SiteMontior uses nested for loops, the same 3 times in a row! And the logic of file comparison is incorrect. I think SiteMonitor would need a complete overhaul but I don't have the time to do this. But I will show what I did with runSitemonitor to make it lightning fast even for large sites and allow file comparison even if files where deleted (of course comparing those that are still there, not the deleted ones). First you need to store refFiles in an associative array where the file name is the index rather than a numeric index. Once you have done that you can simply use array_key_exists() to check if the file is there and do your comparisons. And we fold the three loops into one. Here is the key part that I changed in runSitemonitor /************** SEE IF THE FILE SIZES ARE DIFFERENT ****************/ /************** SEE IF THE TIMESTAMPS ARE DIFFERENT ****************/ /************** SEE IF THE PERMISSIONS ARE DIFFERENT ***************/ $msg .= "\nSIZE MISMATCH:\n"; $error = 0; $msg_time = ''; $error_time = 0; $msg_perm = ''; $error_perm = 0; $size = count($files); $refFiles = GetReferenceFilesAssoc($referenceFile); //reload for all checks below for ($i = 0; $i < $size; ++$i) { if (array_key_exists($files[$i], $refFiles)) { // check file size $newSize = GetSize($files[$i]); $oldSize = GetPart(SIZE - 1, $refFiles[$files[$i]]); // -1 because in associative version the first element is missing if ($newSize != $oldSize) { $msg .= DisplayMessage($verbose, ('Difference found: New-> '. GetFileName($files[$i]) . ' '. $newSize . ' Original-> ' . $oldSize)); $logEntry['Size Changed'][] = $files[$i]; $error++; $ttlErrors++; } // check timestamp $r = @stat($files[$i]); if ($r[9] != GetPart(TIME - 1, $refFiles[$files[$i]])) { $msg_time .= DisplayMessage($verbose, ('Time Mismatch on '. GetFileName($files[$i]). ' Last Changed on ' . gmstrftime ("%A, %d %b %Y %T %Z", $r[9]))); $logEntry['Time Changed'][] = $files[$i]; $error_time++; $ttlErrors++; } // check permissions $pCurrent = substr(sprintf('%o', @fileperms($files[$i])), -3); $pLast = GetPart(PERM - 1, $refFiles[$files[$i]]); if ($pCurrent != $pLast) { $msg_perm .= DisplayMessage($verbose, ('permissions Mismatch on '. GetFileName($files[$i]). ' Currently set to "' . $pCurrent . '" was set to "' . $pLast .'"')); $logEntry['Permissions Change'][] = $files[$i]; $error_perm++; $ttlErrors++; } } } if (! $error) $msg .= DisplayMessage($verbose, 'No size differences found...'); $msg .= "\nTIME MISMATCH:\n" . $msg_time; if (! $error_time) $msg .= DisplayMessage($verbose, 'No time mismatches found...'); $msg .= "\nPERMISSIONS MISMATCH:\n" . $msg_perm; if (! $error_perm) $msg .= DisplayMessage($verbose, 'No permissions mismatches found...'); And GetReferenceFilesAssoc() is the same as GetReferenceFiles() but it has a little addition at the bottom where the associative array is built. Hope this helps others on larger sites. Again, the idea of SiteMonitor is brilliant, the programming is subpar and fails for larger websites. function GetReferenceFilesAssoc($path) //use curl if possible to read in site information { global $username, $password, $admin_dir; $lines = array(); if (! empty($admin_dir) && ! empty($username) && ! empty($password) && function_exists('curl_init')) { $path = $admin_dir . '/' . $path; $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $path); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERPWD, $username.':'.$password); $file_contents = curl_exec($ch); curl_close($ch); $lines = explode("\n", $file_contents); } else { $fd = fopen ($path, "r"); while (!feof ($fd)) { $buffer = fgets($fd, 4096); $lines[] = $buffer; } fclose ($fd); } if (empty($lines)) { echo 'Failed to read Reference File'; exit; } $return_array = array(); for ($i=0; $i<count($lines); $i++) { $pos = strpos($lines[$i], ","); $return_array[substr($lines[$i], 0, $pos)] = substr($lines[$i], $pos+1); } return $return_array; } Share this post Link to post Share on other sites
spear 1 Posted October 28, 2010 @lybrary we all will be happy if you tune little bit the script!!! Please do this, but in understandable way, idiot guide model, mean "open file, find line, replase with,,,", hope you understand me what I mean. Share this post Link to post Share on other sites
tschmid 0 Posted October 31, 2010 I installed v 2.6 and when I got to Step 6, Click on the top button, I received the following message: 1801 mismatches were found. Run the script manually or see the email for the actual mismatches. What? It found all my files? I did NOT get the "run for the first time" message. I went back over the install and setting several times and can't get a different outcome. I have the same Problem as DESROG, but in my case the sitemonitor_reference.php-file is keeping empty (0 Bytes). The rights on this file are 777 but i can press "Delete the reference file and create a new one" using the TOP-button. The file keeps empty again. What can be the problem? Thanks for your help Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted November 1, 2010 I have the same Problem as DESROG, but in my case the sitemonitor_reference.php-file is keeping empty (0 Bytes). The rights on this file are 777 but i can press "Delete the reference file and create a new one" using the TOP-button. The file keeps empty again. What can be the problem? The writing to disk code is fairly simple, common code so that is probably not the problem. It might be that the reference data is not being created in the first place. maybe your start directory is not correct? Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites
tschmid 0 Posted November 1, 2010 Thanks for your reply, My installation of Oscommerce is in a subdirectory on the Webserver. The Mismatches are written in the Log-files, but the reference-file has made no changes. If I change the startdirectory-entry I will get the "invalid username"-failure. Do the startdirectory have to point to the catalog-directory or what do you mean with the shop-root? Share this post Link to post Share on other sites
Jack_mcs 1,020 Posted November 1, 2010 Thanks for your reply, My installation of Oscommerce is in a subdirectory on the Webserver. The Mismatches are written in the Log-files, but the reference-file has made no changes. If I change the startdirectory-entry I will get the "invalid username"-failure. Do the startdirectory have to point to the catalog-directory or what do you mean with the shop-root? The shop root is the directory where your shop is located at. In your case it is the subdirectory you mention. The start directory is where the search will start. Any file below it will be checked, unless the settings tell it not to. Support Links: Need Help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here. How to Upgrade to the latest version Recommended SEO Addons Share this post Link to post Share on other sites