Location: PHPKode > projects > Bible SuperSearch > bible_test.php
<title>Bible SuperSearch Tester Version 0.5</title>
This tests to see if you have Bible SuperSearch properly installed.<br><BR>


//echo" => found<br><BR>";

//echo"Looking for bible_display.php";


echo("<a href='bible_inst_manager.php'>RETURN TO MANAGER</A> <A HREF=''>RETURN TO BIBLE SUPERSEARCH TESTER</A><BR><br>");




function testFile($file, $required=true){

echo("Looking for \"$file\" ==> ");
if (is_file($file)){

return 0;

}// end if

if ($required){echo("<br><b>ERROR: \"$file\" NOT FOUND.  Please upload this file, or Bible SuperSearch will not work!!</b><br><BR>");}
else{echo("<BR><b>Warning: \"$file\" NOT FOUND.</b><br><BR>");}

return 1;
}// end else

}// end testFile


// are you using the correct php version?
if ($phpver[0]<4){
echo("ERROR: You are using PHP ".phpversion()." Bible SuperSearch requires PHP 4.0.5 or better.");
return false;
}// end if
echo("You are using PHP ".substr(phpversion(),0,5)." (".phpversion().") <br>with MySQL ".substr($msl,0,5)." ($msl) &nbsp; <a href='?phpinfo=true'>PHP Info</a><br>");

// are the required files avaliable?
echo("<br><b>Looking for all required files.   Bible SuperSearch will not run without these.</b><br><br>");


if ($err!=0){
echo("<b>$err ERRORS ABOVE.  PLEASE FIX THEM.</b>");
return false;}

// looking for mysql files
echo("<br><b>Looking for the .SQL files.   These are required ONLY if you installed Bible SuperSearch using the provided installer.   If you installed using phpMyAdmin, ignore any errors below.</b><br><BR>");


echo("<br><b>Looking for the image files.   These are not required, but do make Bible SuperSearch look much better.</b><br><BR>");


//echo"Looking for bible_lookup.php";

//echo" => found<br><BR>";


if (($prod_version==null)||($bss_name==null)){
echo("Bible SuperSearch not found.   Please make sure that you have uploaded all required files in the Bible SuperSearch directory.");
else{//Give the version of Bible SuperSearch
echo("<br>You are running <b>$bss_name</b> version $bss_version<br><BR>");

}// end big if

// is mysql.php avaliable?
//echo"looking for mysql.php";
//echo" => found<br><BR>";

//can we connect to the mysql database?
echo"Attempting to connect to the mySQL server.<br>If you successfully used the installer, you will not have any problems here. <br><BR>";

$res=mysql_query("select * from `bible_versions` where `shortname` = '$version'");


echo("Successfully connected to the MySQL database.<br><BR>");
//show table of books

// run the query to get the entire `bible_books` table
$test=mysql_query("Select * from `bible_books_$lang` order by number;");

if ($test==null){
	echo"Unable to find the book names table for the '$version' Bible (`bible_books_$lang`) on the database.  However, this is not required.<br><BR>";
}// end if
echo "Table `bible_books_$lang` found.  The following books of the Bible are installed:<br><BR>";
// set up the table
echo"<table border=2><tr><td>number</td><td>fullname</td><td>short</td></tr>";
while($row = mysql_fetch_array($test)){
}// end if
error_reporting(E_ERROR | E_WARNING| E_PARSE);

if (($count!=66)&&($count!=0)){echo"<BR><BR>There are $count Bible books installed.<BR> You do not have the correct number of books installed.   You should have 66 books.   Please delete and reinstall the \"bible_books\" table.<br>";}
echo "<br>";
}// end else

$test=mysql_query("Select * from `bible_shortcuts_en` order by `index`;");
if ($test==null){echo("WARNING: table `bible_shortcuts_en` is not avaliable.   Predefined search limits will not work.  If you desire this feature, please reinstall Bible SuperSearch.");

echo "Table `bible_shortcuts_en` found.  The following shortcuts/search limiters are installed:<br><BR>";
// set up the table
echo"<table border=2><tr><td>Name</td><td>Alias 1</td><td>Alias 2</td><td>Alias 3</td><td>Reference</td><td>Display</td></tr>";

while($row = mysql_fetch_array($test)){

}// end while
}// end if


if ($version==""){

$re=mysql_query("SELECT * FROM `bible_versions`;");

}// end while

}// end if

}// end else

//}// end while
if (!$istable){
echo("Table `bible_versions` not found.   Please reinstall Bible SuperSearch");
return false;
}// end if

if($err!=0){echo("<b>There are problems with your installation.  Please reinstall Bible SuperSearch again.   If you can't get it to work, please visit BibleSuperSearch.com for help");
return false;}

function testVersion($version){
global $table_prefix;
echo("Testing table for the `$version` Bible version<BR><BR>");

// does bibleverses exist?
$test=mysql_query("Select * from `$table_prefix$version` Where `index` = 1");
if ($test==null){
	echo"Unable to find table `$table_prefix$version` on the database.   Please make sure that it is properly installed.  You may need to rerun the installer.<br><BR>";
	return 1;
}// end if
else{echo"`$version` table found.<br><BR>";}

//test first, last and middle in the verse list
$error=0;// error counter
$error+=testVerses("Gen 1:1 (First verse)", "01", "1", "1", $version);
$error+=testVerses("Ps 23 (Chapter)", "19", "23", "", $version);
$error+=testVerses("2 John (Book)", "63", "", "", $version);
$error+=testVerses("Rev 22:21 (Last Verse)", "66", "22", "21", $version);
// if any errors are found, don't continue
if($error!=0){return 1;}

return 0;
}// end testVersion
// tests the verse lookup capability
// title - heading to be printed
// book - book of the Bible (full, abbreviated or number)
// chapter - chapter of the book
// verse - verse number of the book
// version - Bible Version
function testVerses($title, $book, $chapter, $verse, $version){


//echo("b $book c $chapter v $verse ver $version<br>");

$error = 0;// error counter
echo("<b>$title - $version</b><br>");
// was there a verse found?
if ($verses==null){
echo("<b>Note: $title was not found.   This passage may or may not be needed by this translation, depending on how much of the Bible it contains.   If it has been ommitted accidentally, please reinstall this module.</b><br><BR>");
return 0;
}// end if


return 0;
}// end testVerses

// is bible_lookup.php avaliable?
echo"<b>Congratulations!  Bible SuperSearch is installed and ready!</b> <br><br>

To use Bible SuperSearch, open \"bible_supersearch.php\" in you web browser.<br><BR>

The following Bible SuperSearch interfaces are avaliable on your system. &nbsp; Please pick the one you like best.<br><BR><center>";


<a href='bible_inst_manager.php'>RETURN TO BIBLE MANAGER</A>
Return current item: Bible SuperSearch