Thanks for your reply. I tried the code on the first link you mentioned, but it didn't work. It gives this error:
Fatal error: Call to a member function getCfg() on a non-object in [php page] on line 13
Here is line 13:
if ( ! file_exists( $mainframe->getCfg( 'absolute_path' ) . '/administrator/components/com_comprofiler/plugin.foundation.php' ) ) {
My test page contains exactly the code shown on your first link, and nothing more (well, except for the opening and closing PHP tags).