Newer
Older
ubixos-web / docroot / taskmanager / autotest.php
@reddawg reddawg on 29 Jun 2004 1 KB UbixOS Web Site
<?PHP
/*-----------------------------------------------------------------------**
---------------------------------------------------------------------------
IPM (Incyte Project Manager)
PHP based project tracking tool 
Copyright (c) 2001 by phlux

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
---------------------------------------------------------------------------
**-----------------------------------------------------------------------*/

connection_test();
query_test();

function connection_test() {
	include "config.php";
	echo "Running Connection Tests:<br><br>";
	echo "Connecting to MySQL server <b>$db_servername</b> as user <b>$db_username</b>: ";
	if (@mysql_connect($db_servername, $db_username, $db_password)) {
		 echo "[OK]<br>";
	} else {
		 echo "[FAILED]<br>";
		 echo "REASON: ".mysql_error().mysql_errno();
	}
	echo "Selecting database <b>$db_dbname</b> from <b>$db_servername</b>: ";
	if (@mysql_select_db($db_dbname)) {
		 echo "[OK]<br>";
	} else {
		 echo "[FAILED]<br>";
		 echo "REASON: ".mysql_error().mysql_errno();
	}
}

function query_test() {
	include "config.php";
	echo "Running Extensive Query Tests:<br><br>";
	$result=mysql_query("SELECT id,firstname,lastname,username,email,role,password FROM IPM_users");
	while ($row=mysql_fetch_array($result)) {
				echo $row["username"];
	}
	echo "Adding a User:<br><br>";
}

?>