#native_company# #native_desc#
#native_cta#

Bible XML Parser – Keyword

By Michael
on November 25, 2002

Version: 1.0

Type: Full Script

Category: Other

License: GNU General Public License

Description: parses the king james bible, american standard bible, hitchcocks and eastons bible dictionaries, matthew henry commentary, bible maps and mikesartbible databases. All free XML feeds. Choose chapter and verse or keyword versions.

<?

///////////////////////////////////BPP PARSER/////////////////////////////////////
//Keyword of Phrase Search Parser w/ Search Box version: 0.1
//Created Tuesday, November 05, 2002
//This software is shareware with restrictions, you may distribute it freely
//The intent of this code is to distribute the Bible around the world. Enabling 
//Christian Webmasters to serve good Christian literature and useful information
//Under this GPL you agree to the terms below:
//1. There is no warranty for this code, you are on your own.
//2. This license does not make you the owner of this code just the licensee
//3. If you violate this agreement or the spirit in which the code was intended your 
//site will be blocked from our results XML Feed.
//4. This code gets results from http://www.bibleportalproject.com/cgi/xml.php
//5. The code is load balanced and reacts to "GET METHOD" only!
//6. You may not change or delete this header
//7. You may not bundle this code with another code
//8. You may not sell, rent, lease or re-license this code
//9. (c) 2002 Michael L Hill Sr all rights reserved
//The Bible Portal Project www.bibleportalproject.com [email protected]
//Test search is located at http://www.bibleportalproject.com/cgi/s.php

//About The Project: This parser gets results from an XML search feed
//You can place this code as an include or cut and paste it to your PHP script.
//The other end is powered by load balanced PHP 4.12 scripts and mySQL database
//Some Documentation can be found at 
//http://www.bibleportalproject.com/bpp/developers_center/feeds.php
//Other tools from this project can be found at
//http://www.bibleportalproject.com

//You can change any of these tags and look throughout the code for additional tags
//see this symbol below to change fonts inside results '<!------------->'

$quote = "We found these results";
$quote2 = "Search for <b>$Q $EX</b> in";
$quote3 = "This search was in:";
$site_name = "for <b>$Q $EX</b>"; //change this is you like 'at Your Site Name Here'
$titl_font = "font size=3 color=black face=arial";
$tit2_font = "font size=2 color=gray face=arial";
$desc_font = "font size=2 color=black face=arial";
$misc_font = "font size=2 color=gray face=arial";
$err_font = "font size=2 color=red face=arial";
$bullet = " ";
$link_target = "target='_blank'";

///////////////////////////////////BPP PARSER/////////////////////////////////////

//This is the search box

$names = array(
"KJV" => "King James Bible",
"ASV" => "American Standard Bible",
"Topical" => "Topical References",
"Henry" => "Matthew Henry Commentary",
"Easto" => "Easton's Bible Dictionary",
"Hitch" => "Hitchcock's Dictionary Of Names",
"Maps" => "MikesartBible Maps",
"Time" => "MikesartBible Dates/Times"
);

if($S == "or"){ $ss0 = "checked"; }
elseif($S == "and"){ $ss1 = "checked"; }
elseif($S == "phr"){ $ss2 = "checked"; }
else{ $ss0 = "checked"; }

echo"<center>n";
echo"<form action='$PHP_SELF' method=get><$desc_font>n";
echo"<select name=R>n";
while(list($k,$v)=each($names)){
	if($R == $k){echo"<option value='$k' selected>$v</option>n";}
	echo"<option value='$k'>$v</option>n";
}
echo"</select>n ";
echo"<input type='text' name='Q' value='$Q'>n ";
echo"<input type='submit' value='Search'>n ";
echo"<br><input type='radio' name='S' value='or' $ss0> or (match any word)n ";
echo"<input type='radio' name='S' value='and' $ss1> and (match all words)n ";
echo"<input type='radio' name='S' value='phr' $ss2> plus (match a phrase)n ";
echo"<br><$desc_font><a href='$PHP_SELF?help=y'>Learn more about how to use this search</a>n ";
echo"</form>
n";

if($help == "y"){ echo"<script language="JavaScript" src="http://www.bibleportalproject.com/bpp/developers_center/js-bin/search_help.php"></script>n "; } 

echo"</center>n";


//This is the parser 
//------------------------------------------

	$N = str_replace(" ", "+", $Q);
	$domain = "www.bibleportalproject.com";
	$file = "cgi/xml.php?$QUERY_STRING";

    $fp = fopen("http://$domain/$file", "r");
	$read = fread($fp, 100000);

	$pattern1 = "<ResultCounts>nt<KJVBible count= "(.*)" />nt<ASVBible count= "(.*)" />nt<Eastons count= "(.*)" />nt<Hitchcocks count= "(.*)" />nt<Henrys count= "(.*)" />nt<Maps count= "(.*)" />nt<Times count= "(.*)" />nt<Library count= "(.*)" />n</ResultCounts>";
	
	preg_match_all("/$pattern1/", $read, $tot);
	
	$kjvq = $tot[1];
	$asvq = $tot[2];
	$easq = $tot[3];
	$htiq = $tot[4];
	$henq = $tot[5];
	$mapq = $tot[6];
	$timq = $tot[7];
	

  fclose ($fp);

//------------------------------------------
// below this line we begin to parse and show content


if($R == "KJV" || $R == "ASV"){
//------------------------------------------Pattern for the Bible
	if($R=="KJV"){ $tag = "kjv";}
	elseif($R=="ASV"){ $tag = "asv";}

	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<OTNT>(.*)</OTNT>/", $read, $resul2);
	preg_match_all("/<Class>(.*)</Class>/", $read, $resul3);
	preg_match_all("/<Title>(.*)</Title>/", $read, $resul4);
	preg_match_all("/<Number>(.*)</Number>/", $read, $resul5);
	preg_match_all("/<Text>(.*)</Text>/", $read, $resul6);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];
	$e = $resul5[1];		$f = $resul6[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	if($count > 0){

	echo"<p><$tit2_font>$quote $Tres[0] results $site_name"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	function display($n, $m, $o, $p, $r, $s, $t, $u) {
		$ZZZ = $Q;
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$bold_resul = 1; // 0 is off, 1 is on
		$bold_title = 1; // 0 is off, 1 is on
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
		
		if($bold_resul == 1){ $n_s = str_replace("$t", "<b>$t</b>", $s); }
		else{ $n_s = $s; }
		if($bold_title == 1){ $title = "<b>$bullet $p, $r</b>"; }
		else{ $title = "$bullet $p, $r"; }
		
		$new_cv = $r[0] . $r[1] . $r[2];
		$new_cv = str_replace(":", "|", $new_cv);
		$c_v = preg_split("/|/", $new_cv); 
		
		
		$extras = "<br><$misc_font>Show: <a href='$PHP_SELF?R=$u&A=M1&Q=$t&ID=$n'>1 Vr Preceeding and After</a>";
		$extras .= " | <$misc_font><a href='$PHP_SELF?R=$u&A=M5&Q=$t&ID=$n'>5 Vrs Preceeding and After</a><br>";
		$extras .= "<$misc_font>Ref: <a href='$PHP_SELF?R=Henry&B=$p&G=$c_v[0]&Q=$t&S=and'>Commentary for $p</a>";
		$extras .= " | <a href='$PHP_SELF?R=Maps&Q=$t'>Maps</a>";
		$extras .= " | <a href='$PHP_SELF?R=Time&Q=$t'>Times</a>";

		return "
		<p><$titl_font>$title
		<br><$desc_font>$n_s
		$extras
		";
	
	}

	$arr = array_map ("display", $a, $b, $c, $d, $e, $f, $ZZZ, $XXX);
	while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	echo"<p><$err_font>Sorry No Results Found</p></font>"; }

}elseif($R == "Topical"){

	$tag = "ttr";
	
	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";
	
	preg_match_all("/$vpattern/", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<Name>(.*)</Name>/", $read, $resul2);
	preg_match_all("/<Pass><![CDATA[(.*)]]></Pass>/", $read, $resul3);
	preg_match_all("/<Name_Def><![CDATA[(.*)]]></Name_Def>/", $read, $resul4);
	preg_match_all("/<Pass_Def><![CDATA[(.*)]]></Pass_Def>/", $read, $resul5);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];		$g = $resul5[1];
	$c = $resul3[1];		$d = $resul4[1];

	$count = $RTotal[0];
	
	
	if($count > 0){
	
	echo"<p><$tit2_font>$quote $site_name ($Tres[0])"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	
		function display($m, $n, $o, $p, $r, $s, $t) {

			// User Changes To Style
			// Be careful - do not remove the // signs
			// <!------------->

			$bold_resul = 1; // 0 is off, 1 is on
			$bold_title = 1; // 0 is off, 1 is on
			$titl_font = "font size=3 color=black face=arial";
			$tit2_font = "font size=2 color=gray face=arial";
			$desc_font = "font size=2 color=black face=arial";
			$misc_font = "font size=2 color=gray face=arial";
			$bullet = " ";
			$link_target = "target='_blank'";

			if($bold_resul == 1){ $n_s = str_replace("$r", "<b>$r</b>", $p); }
			else{ $n_s = $p; }
			
			if($bold_title == 1){ $title = "<b>$bullet $n</b>"; }
			else{ $title = "$bullet $n"; }
		
			$o = preg_replace("/-/", ",", $o);

			return "
			<p><$titl_font>$title
			<br><$desc_font>Topic: $n_s
			<br><a href='$PHP_SELF?EX=$o&R=KJV1'>$t</a>
			";
		}


		$arr = array_map ("display", $a, $b, $c, $d, $ZZZ, $XXX, $g);
		while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	echo"<p><$err_font>Sorry No Results Found.</p></font>"; }


}elseif($R == "KJV1"){

	$tag = "kmc";
	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<OTNT>(.*)</OTNT>/", $read, $resul2);
	preg_match_all("/<Class>(.*)</Class>/", $read, $resul3);
	preg_match_all("/<Title>(.*)</Title>/", $read, $resul4);
	preg_match_all("/<Number>(.*)</Number>/", $read, $resul5);
	preg_match_all("/<Text>(.*)</Text>/", $read, $resul6);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];
	$e = $resul5[1];		$f = $resul6[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	if($count > 0){

	echo"<p><$tit2_font>$quote $site_name"; 

	function display($n, $m, $o, $p, $r, $s) {
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$bold_resul = 1; // 0 is off, 1 is on
		$bold_title = 1; // 0 is off, 1 is on
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
		
		$n_s = $s;
		if($bold_title == 1){ $title = "<b>$bullet $p, $r</b>"; }
		else{ $title = "$bullet $p, $r"; }
		$t = preg_replace("/ /", "+", $t);
		$u = preg_replace("/ /", "+", $u);
		$w = preg_replace("/ /", "+", $w);

		$extras = "<br><$misc_font>Show: <a href='$PHP_SELF?R=KJV&A=M1&B=$p&G=$r&ID=$n'>1 Vr Preceeding and After</a>";
		$extras .= " | <$misc_font><a href='$PHP_SELF?R=KJV&A=M5&B=$p&G=$r&ID=$n'>5 Vrs Preceeding and After</a>";

		return "
		<p><$titl_font>$title
		<br><$desc_font>$n_s
		$extras
		";
	
	}

	$arr = array_map ("display", $a, $b, $c, $d, $e, $f);
	while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	echo"<p><$err_font>Sorry No Results Found -- We Did Not Understand That Command</p></font>"; }



}elseif($R == "Easto" || $R == "Hitch" || $R == "Time"){
//------------------------------------------Pattern for the Names and Dictionaries
	if($R=="Easto"){ $tag = "eas";}
	elseif($R=="Hitch"){ $tag = "hit";}
	elseif($R=="Time"){ $tag = "tim";}
	
	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";
	
	preg_match_all("/$vpattern/", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<Category>(.*)</Category>/", $read, $resul2);
	preg_match_all("/<Name>(.*)</Name>/", $read, $resul3);
	preg_match_all("/<Name_Def><![CDATA[(.*)]]></Name_Def>/", $read, $resul4);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	if($count > 0){
	
	echo"<p><$tit2_font>$quote $site_name ($Tres[0])"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	
		function display($m, $n, $o, $p, $r, $s) {

			// User Changes To Style
			// Be careful - do not remove the // signs
			// <!------------->

			$bold_resul = 1; // 0 is off, 1 is on
			$bold_title = 1; // 0 is off, 1 is on
			$titl_font = "font size=3 color=black face=arial";
			$tit2_font = "font size=2 color=gray face=arial";
			$desc_font = "font size=2 color=black face=arial";
			$misc_font = "font size=2 color=gray face=arial";
			$bullet = " ";
			$link_target = "target='_blank'";

			if($bold_resul == 1){ $n_s = str_replace("$r", "<b>$r</b>", $p); }
			else{ $n_s = $p; }
			if($bold_title == 1){ $title = "<b>$bullet $o</b>"; }
			else{ $title = "$bullet $o"; }

			return "
			<p><$titl_font>$title
			<br><$desc_font>$n_s
			";
		}


		$arr = array_map ("display", $a, $b, $c, $d, $ZZZ, $XXX);
		while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	$D = ucfirst($Q); echo"<p><$err_font>Sorry No Results Found. You might try upper case first letter <b>''$D''</b></p></font>"; }

}elseif($R == "MH"){

	$tag = "mat";

	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<Book>(.*)</Book>/", $read, $resul2);
	preg_match_all("/<Source_Text><![CDATA[(.*)]]></Source_Text>/", $read, $resul3);
	preg_match_all("/<Topics>(.*)</Topics>/", $read, $resul4);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	//if($count > 0){

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	function display($m, $n, $o, $p, $r, $s) {
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$bold_resul = 1; // 0 is off, 1 is on
		$bold_title = 1; // 0 is off, 1 is on
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
		
		
		$n = preg_replace("/.txt/", "", $n);
		
		if($bold_resul == 1){ $n_s = str_replace("$r", "<b>$r</b>", $o); }
		else{ $n_s =  $o; }
		
		if($bold_title == 1){ $title = "<b>$bullet Results for: $n, ID: $m</b>"; }
		else{ $title = "$bullet Results: for $n, ID: $m"; }

		$n_s = preg_replace("/<B>ORD</B>/i", "ord", $n_s);
		$n_s = preg_replace("/(/", "<p>(", $n_s);
		$n_s = preg_replace("/[/", "<br>[", $n_s);
		$n_s = preg_replace("/-/", ",", $n_s);
		$n_s = preg_replace("//cgi/cv.php/", "$PHP_SELF", $n_s);
		
		return "
		<p><$titl_font>$title
		<br><$desc_font>$n_s
		";
	
	}

	$arr = array_map ("display", $a, $b, $c, $d, $ZZZ, $XXX);
	while(list($k,$v) = each($arr)){ echo"$vn"; }

		//}else{ 	echo"<p><$err_font>Sorry No Results Found</p></font>"; }

}elseif($R == "Henry"){
//------------------------------------------Pattern for Commentaries
	$tag = "mat";

	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);
	
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<Book>(.*)</Book>/", $read, $resul2);
	preg_match_all("/<Source_Text><![CDATA[(.*)]]></Source_Text>/", $read, $resul3);
	preg_match_all("/<Topics>(.*)</Topics>/", $read, $resul4);
	preg_match_all("/<Chapter>(.*)</Chapter>/", $read, $resul5);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];		$g = $resul5[1];
	$c = $resul3[1];		$d = $resul4[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	if($count > 0){

	echo"<p><$tit2_font>$quote $site_name ($Tres[0])"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	function display($m, $n, $o, $p, $r, $s, $t) {
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$bold_resul = 1; // 0 is off, 1 is on
		$bold_title = 1; // 0 is off, 1 is on
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
		
		
		$n = preg_replace("/.txt/", "", $n);
		
		if($bold_resul == 1){ $n_s = str_replace("$r", "<b>$r</b>", $o); }
		else{ $n_s =  $o; }
		
		if($bold_title == 1){ $title = "<b>$bullet $n, $t</b>"; }
		else{ $title = "$bullet $n, $t"; }

		return "
		<p><$titl_font><a href='$PHP_SELF?ID=$m&R=MH&Q=$r'>$title</a>
		<br><$desc_font>$n_s
		";
	
	}

	$arr = array_map ("display", $a, $b, $c, $d, $ZZZ, $XXX, $g);
	while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	echo"<p><$err_font>Sorry No Results Found</p></font>"; }
	
}elseif($R == "Maps"){
//------------------------------------------Pattern for Maps
	$tag = "map";
	
	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);

	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<URL><![CDATA[(.*)]]></URL>/", $read, $resul2);
	preg_match_all("/<remoteImage><![CDATA[(.*)]]></remoteImage>/", $read, $resul3);
	preg_match_all("/<iTitle><![CDATA[(.*)]]></iTitle>/", $read, $resul4);
	preg_match_all("/<iType>(.*)</iType>/", $read, $resul5);
	preg_match_all("/<iSize>(.*)</iSize>/", $read, $resul6);
	preg_match_all("/<iHeight>(.*)</iHeight>/", $read, $resul7);
	preg_match_all("/<iWidth>(.*)</iWidth>/", $read, $resul8);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];
	$e = $resul5[1];		$f = $resul6[1];
	$g = $resul7[1];		$h = $resul8[1];

	$count = $RTotal[0];
	//echo"<p>$count<p>";
	
	if($count > 0){

	echo"<p><$tit2_font>$quote $site_name ($Tres[0])"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	function display($k, $l, $m, $n, $o, $p, $r, $s, $t, $u) {
		$ZZZ = $Q;
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
		

		return "
		<p><$titl_font>$bullet <b><a href='$m' $link_target>Image</a></b> | <b><a href='$l' $link_target>Informational Page</a></b>
		<br><$desc_font>$n
		<br><$desc_font>Type:$o  <$misc_font>$Size: ($p)bytes  width: $r   height: $s
		";
	
	}

	$arr = array_map ("display", $a, $b, $c, $d, $e, $f, $g, $h, $ZZZ, $XXX);
	while(list($k,$v) = each($arr)){ echo"$vn"; }

		}else{ 	echo"<p><$err_font>Sorry No Results Found</p></font>"; }
	
}else{
//------------------------------------------Do this when not specified
	$tag = "kjv"; $this = $kjvq[0];
	
	$vpattern = "t<Scope$tag>ntt<Res>(.*)</Res>ntt<ResDesc>(.*)</ResDesc>ntt<Tres>(.*)</Tres>ntt<Tpag>(.*)</Tpag>ntt<Previous>(.*)</Previous>ntt<Next>(.*)</Next>ntt<RTotal>(.*)</RTotal>nt</Scope$tag>";

	preg_match_all("/$vpattern/ms", $read, $meta);
	preg_match_all("/<ID>(.*)</ID>/", $read, $resul1);
	preg_match_all("/<OTNT>(.*)</OTNT>/", $read, $resul2);
	preg_match_all("/<Class>(.*)</Class>/", $read, $resul3);
	preg_match_all("/<Title>(.*)</Title>/", $read, $resul4);
	preg_match_all("/<Number>(.*)</Number>/", $read, $resul5);
	preg_match_all("/<Text>(.*)</Text>/", $read, $resul6);

	$Res = $meta[1];		$ResDesc = $meta[2];
	$Tres = $meta[3];		$Tpag = $meta[4];
	$Previous = $meta[5];	$Next = $meta[6];
	$RTotal = $meta[7];

	$a = $resul1[1];		$b = $resul2[1];
	$c = $resul3[1];		$d = $resul4[1];
	$e = $resul5[1];		$f = $resul6[1];

	$count = $RTotal[0];
	
	if($count > 0){

	echo"<p><$tit2_font>$quote $site_name ($Tres[0])"; 

	for($i=0; $i<$count; $i++){ $ZZZ[$i] = "$N"; }
	for($i=0; $i<$count; $i++){ $XXX[$i] = "$R"; }
	
	function display($n, $m, $o, $p, $r, $s, $t, $u) {
		$ZZZ = $Q;
		
		// User Changes To Style
		// Be careful - do not remove the // signs
		// <!------------->
		
		$bold_resul = 1; // 0 is off, 1 is on
		$bold_title = 1; // 0 is off, 1 is on
		$titl_font = "font size=3 color=black face=arial";
		$tit2_font = "font size=2 color=gray face=arial";
		$desc_font = "font size=2 color=black face=arial";
		$misc_font = "font size=2 color=gray face=arial";
		$bullet = " ";
		$link_target = "target='_blank'";
	
		
		if($bold_resul == 1){ $n_s = str_replace("$t", "<b>$t</b>", $s); }
		else{ $n_s = $s; }
		if($bold_title == 1){ $title = "<b>$bullet $p, $r</b>"; }
		else{ $title = "$bullet $p, $r"; }

		$extras = "<br><$misc_font>Show: <a href='$PHP_SELF?R=$u&A=M1&Q=$t&ID=$n'>1 Vr Preceeding and After</a>";
		$extras .= " | <$misc_font><a href='$PHP_SELF?R=$u&A=M5&Q=$t&ID=$n'>5 Vrs Preceeding and After</a><br>";
		$extras .= "<$misc_font>Ref: <a href='$PHP_SELF?R=Henry&Q=$t'>Commentary</a>";
		$extras .= " | <a href='$PHP_SELF?R=Maps&Q=$t'>Maps</a>";
		$extras .= " | <a href='$PHP_SELF?R=Time&Q=$t'>Times</a>";
		
		return "
		<p><$titl_font>$title
		<br><$desc_font>$n_s
		$extras
		";
	}

		$arr = array_map ("display", $a, $b, $c, $d, $e, $f, $ZZZ, $XXX);
		while(list($k,$v) = each($arr)){ echo"$vn"; }
	
		}else{ 	
		
		if($Q == "" || !$Q) { echo"<p align=center><$err_font>Enter A Keyword</p></font>"; }
		else { echo"<p><$err_font>Sorry No Results Found</p></font>"; }
		
		}
}

if(!$ID){
$ppp = $Tpag[0]-1;
if($count >=1){ $more = "<p><$desc_font>$quote3 $R: ''$ResDesc[0]''<p>"; }
if($Previous[0] >= 1 && $Previous[0] <= $ppp) { $more .= "<$desc_font>&lt;&lt; <a href='$PHP_SELF?R=$R&Q=$N&T=0'>First</a> "; }
if($Previous[0] >= "0" && $Previous[0] <= $ppp){ $more .= "<$desc_font>&lt; <a href='$PHP_SELF?R=$R&Q=$N&T=$Previous[0]'>Previous</a> "; }
if($Tres[0] > 0) { $more .= "<$desc_font>... $Tres[0] Results ...  "; }
if($Next[0]){ $more .= "<$desc_font><a href='$PHP_SELF?R=$R&Q=$N&T=$Next[0]'>Next &gt;</a>  "; }
if($T < $Tpag[0] && $Next[0]) { $more .= "<$desc_font><a href='$PHP_SELF?R=$R&Q=$N&T=$Tpag[0]'>Last &gt;&gt;</a> "; }
}
if($Q){ $more .= "<p><$desc_font><br>$quote2 <a href='$PHP_SELF?R=KJV&Q=$N'>KJVBible</a> | <a href='$PHP_SELF?R=ASV&Q=$N'>ASVBible</a> | <a href='$PHP_SELF?R=Topical&Q=$N'>Topical Reference</a> | <a href='$PHP_SELF?R=Easto&Q=$N'>Bible Dictionary</a> | <a href='$PHP_SELF?R=Hitch&Q=$N'>Bible Names</a>"; }
echo"$more";
?>