"; $red2 = ''; echo "PHProjekt SYSTEM test
"; echo "

PHProjekt environment test

"; echo "Thank you for taking the time to check whether your
environment meets to the needs of a PHProjekt installation

"; // PHP Version - exclude PHP3 echo "
**********************"; echo "

PHP Parser test

"; if (!$_REQUEST['parser_test']) { echo "
\n"; echo "\n"; echo "First we have a look on the used PHP version

\n"; echo "
"; } else if ($_REQUEST['parser_test'] == 1) { // PHP Version - exclude PHP3 if (substr(phpversion(),0,1) == "3") { ("sorry, PHP 4 required!

Please download the current version at www.php.net. (exit)\n"); $_REQUEST['parser_test'] = "failed"; } else if (substr(phpversion(),0,3) == "4.0") { echo "The used PHP version is 4.0 - we strongly recommend you to update to a newer version.

"; $_REQUEST['parser_test'] = "update recommended"; } else { echo "The version of the used PHP parser is valid!"; $parser_test = "o.k."; } $_SESSION['parser_test'] =& $parser_test; } else echo "PHP version test done, result: ".$_REQUEST['parser_test'].""; // end parser test // begin environment test echo "
**********************"; echo "

PHP environment test

"; // offer env test if (!$_REQUEST['env_test']) { echo "
\n"; echo "\n"; echo "Now we check whether how the configuration of PHP is set.

\n"; echo "
"; } // env_test submitted, start test else if ($_REQUEST['env_test'] == 1) { echo ''; // if none of the above test has written an error message into the variable -> "o.k."! :-) if ($_REQUEST['env_test'] == 1) $_REQUEST['env_test'] = "o.k."; // write variable into session $_SESSION['env_test'] =& $env_test; } // env_test done, show result else echo "PHP environment test done, result: ".$_REQUEST['env_test'].""; // session test echo "
**********************"; echo "

Session Test

"; if (!$_REQUEST['session_test']) { echo "
\n"; echo "\n"; echo "PHProjekt uses sessions to store information
Now we check whether the server has a working session management.

\n"; echo "
"; $session_ok = 1; $_SESSION['session_ok'] =& $session_ok; } else if ($_REQUEST['session_test'] == 1) { // check whether session are enabled at all!! if (!extension_loaded('session')) { echo "

Panic - the php parser has been compiled without session support!


"; $_REQUEST['session_test'] = "failed"; } if ($session_ok == 1) { echo "Session management works!"; $_REQUEST['session_test'] = "o.k."; } else { echo "oops - can't find my session!"; $_REQUEST['session_test'] = "failed"; } $_SESSION['session_test'] =& $session_test; } else echo "Session management test done, result: ".$_REQUEST['session_test'].""; // sql test echo "
**********************"; echo "

Database Access

"; if (!$_REQUEST['db_test']) { echo "Please enter your db access parameters, the script will try to connect to the database:\n"; echo "
\n"; echo "\n"; echo "\n"; // select database echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
db_type:
Host:
Username:
Password:
Database name:
 
\n"; } else if($_REQUEST['db_test'] == 1) { // well ;-) $db_host = $_REQUEST['db_host']; $db_user = $_REQUEST['db_user']; $db_pass = $_REQUEST['db_pass']; $db_host2 = $_REQUEST['db_host2']; $db_name = $_REQUEST['db_name']; $db_type = $_REQUEST['db_type']; // *** db test *** // test mysql access if ($db_type == "mysql") { $link = mysql_connect($db_host,$db_user,$db_pass) or $_REQUEST['db_test'] = "failed"; } // test interbase access else if ($db_type == "interbase") { $db_host2 = "$db_host:$db_name"; $link = ibase_connect($db_host2, $db_user, $db_pass) or $_REQUEST['db_test'] = "failed"; } // test ms_sql else if ($db_type == "ms_sql") { $link = mssql_connect($db_host, $db_user, $db_pass) or $_REQUEST['db_test'] = "failed"; } // test oracle else if ($db_type == "oracle") { $link = OCILogon($db_user, $db_pass, $db_name) or $_REQUEST['db_test'] = "failed"; $datestmt = OCIParse($link, "alter session set NLS_DATE_FORMAT='YYYY-MM-DD HH:MI:SS'"); OCIExecute($datestmt); } // test informix else if ($db_type == "informix") { if ($db_host == "") $db = $db_name; else $db = $db_name."@".$db_host; $link = ifx_connect($db, $db_user, $db_pass) or $_REQUEST['db_test'] = "failed"; } // test postgres else if ( $db_type == "postgresql" ) { echo "
Trying to connect to $db_name"; $link = pg_connect((($db_host == "") ? "" : "host = $db_host ").(($db_pass == "") ? "" : "password=$db_pass ")."dbname=$db_name user=$db_user"); echo "
$link"; if (!$link) { echo "
Trying to connect to template1"; $link = pg_connect((($db_host == "") ? "" : "host = $db_host ").(($db_pass == "") ? "" : "password=$db_pass ")."dbname=template1 user=$db_user") or $_REQUEST['db_test'] = "failed"; echo "
Trying to create database $db_name"; $result = pg_exec($link, "CREATE DATABASE $db_name") or $_REQUEST['db_test'] = "failed"; echo "
Database create, closing connection to template1"; $link = pg_close($link) or die("Can't close database connection"); echo "
Opening new connection to db $db_name"; $link = pg_connect((($db_host == "") ? "" : "host = $db_host ").(($db_pass == "") ? "" : "password=$db_pass ")."dbname=$db_name user=$db_user") or $_REQUEST['db_test'] = "failed"; } } // *** end test db access *** // output error message if ($db_error == 1 or !$link or (isset($conn) and !$conn)) { echo "oops - no connection to the dataase!
Reasons could be:Please fix it and try it again ...

"; $_REQUEST['db_test'] = "failed"; } else { echo "Seems that connecting the database has been successful :-)"; $_REQUEST['db_test'] = "o.k."; } $_SESSION['db_test'] =& $db_test; } else echo "Database access test done, result: ".$_REQUEST['db_test'].""; // end db test // ********** // mail check echo "
**********************"; echo "

Mail Test

\n"; if (!$_REQUEST['email']) { echo "Here you can test whether you are able to send and receive mails with PHProjekt.
Enter your email adress here, the script will send you an email:
\n"; echo "
\n"; echo "\n"; echo "
\n"; } else if ($_REQUEST['email'] <> 2) { mail(urldecode($_REQUEST['email']),"PHProjekt Mail Test","Congratulations!\n Now you know that you can use PHProjekt to send mails\n","From:$user_email\nReply-To:$user_email\nSender:$user_email\nReturn-Path:$user_email"); echo "Please check your mailbox whether you got a mail from PHProjekt. If not, you should examine the mail settings in your php.ini"; // imap extensions test if (function_exists('imap_open')) { echo "
Checking your mail configuration ... the IMAP library is active, therefore you can use the full mail client"; $email_receive_test = "o.k."; } else { echo "
oh, the imap library from PHP is missing, at the moment you cannot install the full email client :-(
please tell your sysadmin or provider to install the imap library of php (not to be mixed with the imap server)."; $email_receive_test = "failed"; } $_SESSION['email_receive_test'] =& $email_receive_test; } else echo "Email test done, result: receive email $email_receive_test"; // ********* // file test echo "
**********************"; echo "

File writing Test

"; if (!$_REQUEST['file_test']) { echo "
\n"; echo "\n"; echo "Now the script proofs whether it is able to write
a test file in the PHProjekt root diretory.

\n"; echo "\n"; echo "

\n"; } else if ($_REQUEST['file_test'] == 1) { $fp = fopen("test_phprojekt.txt", 'w'); if (!$fp or $fp == "FALSE") { echo "I couldn't write this file!
Please give the webserver read and write permission for this directory!\n"; $_REQUEST['file_test'] = "failed"; } else { $fw = fwrite($fp,"This file was created for testing reasons. You can delete it."); echo "test file successfully written! Now it will be deleted again ...
\n"; $_REQUEST['file_test'] = "o.k."; fclose($fp); $delete = unlink("test_phprojekt.txt"); if (!$delete) { echo ".. but it failed to erase this file!"; $_REQUEST['file_test'] = "failed"; } } // additional test - check whether file_uploads is set to "on" if (ini_get("file_uploads") <> "1") { echo "Please change the value of 'file_uploads' in the php.ini to 'on', otherwise you can't use the file or mail module!"; if ($_REQUEST['file_test'] == "o.k.") $_REQUEST['file_test'] .= " but please change 'file_uploads' in the php.ini to 'on'."; } $_SESSION['file_test'] =& $file_test; } else echo "file management test done, result: ".$_REQUEST['file_test'].""; echo "
**********************"; echo "

If you want to run this test another time, please follow this link here\n"; echo "


"; // read and write permissions for root, attach, chat and upload directory // blank screen problem! -> include of en.inc.php possible? // next proof: file_uploads in the php.ini must be set to on .. ?>