QUOTE
1) Upload the files to a useful place inside your web server's document tree.
2) Change the things that look wrong in config.php.
3) Make sure "AcceptPathInfo ON" (or analogous) is somewhere in your PHP file section of your web server config.
4) Go over steps 2 and 3 again, because you probably missed something for lack of documentation.
So I do this, you get a whole bunch of files for each chapter in the Bible. see this code below to explain more. Look at the files at the bottom and it shows what each book of the bible is named:
CODE
<?
/*
* config.php - The configuration for a simple web program written by Alex Markley to display chunks of the Holy Bible.
*/
/*
This file is part of PHPScripture (Formally Alex's PHPBible).
PHPScripture is Copyright © 2003, Alex Markley
PHPScripture 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//Headerless?
$config["headerless"] = FALSE; //Can be TRUE or FALSE. (Probably FALSE.)
//Theme? (Only takes effect if headerless is false.) (It is the name of a folder within the themes folder.)
$config["theme"] = "plain"; //No theme at all.
//$config["theme"] = "eternity"; //Green and forresty.
//$config["theme"] = "forest_bed"; //Green and forresty.
//$config["theme"] = "aquatic_geometry"; //Blue, watery, etc.
//Searching Stuff (Searching requires a sane version of GREP, and a sane shell to both be installed.)
$config["good_shell"] = "/bin/sh"; //Full path to borne or bash or something similar.
$config["grep_command"] = "egrep"; //Search command.
$config["disable_searching"] = FALSE; //Can be TRUE or FALSE. (Probably FALSE.)
//This stuff probably needs changed. ALL OF THESE VALUES SHOULD END IN A '/', EXCEPT IN VERY RARE CIRCUMSTANCES.
$config["URI_prefix"] = "http://my.domain.org/path/to/script/"; //Where the script lives on the web.
$config["script_suffix"] = "bible.php/"; //The name of the main script. (It may seem strange that this should end in a '/', but that is indeed the case.)
$config["local_prefix"] = "/path/to/config/and/things/"; //Where the script lives on the disk.
$config["bible_midfix"] = "bible/"; //The directory that the bible data is in. ($config["local_prefix"] . $config["bible_midfix"])
$config["themes_midfix"] = "themes/"; //The directory that the bible data is in. ($config["local_prefix"] . $config["bible_midfix"])
//This stuff doesn't need changed, but it's useful.
$config["title"] = "Holy Bible"; //Title of the page.
$config["element_wrap"] = 5; //Wrap every 5 things.
$config["search_results_per_page"] = 20; // 20 search results to a page
//Don't change the things below this line.
$config["version"]["major"] = 1;
$config["version"]["minor"] = 2;
$config["version"]["subminor"] = 3;
$bible_books[0]["long"] = "Genesis"; $bible_books[0]["short"] = "Ge";
$bible_books[1]["long"] = "Exodus"; $bible_books[1]["short"] = "Ex";
$bible_books[2]["long"] = "Leviticus"; $bible_books[2]["short"] = "Le";
$bible_books[3]["long"] = "Numbers"; $bible_books[3]["short"] = "Nu";
$bible_books[4]["long"] = "Deuteronomy"; $bible_books[4]["short"] = "De";
$bible_books[5]["long"] = "Joshua"; $bible_books[5]["short"] = "Jos";
$bible_books[6]["long"] = "Judges"; $bible_books[6]["short"] = "Jud";
$bible_books[7]["long"] = "Ruth"; $bible_books[7]["short"] = "Ru";
$bible_books[8]["long"] = "1 Samuel"; $bible_books[8]["short"] = "1Sa";
$bible_books[9]["long"] = "2 Samuel"; $bible_books[9]["short"] = "2Sa";
$bible_books[10]["long"] = "1 Kings"; $bible_books[10]["short"] = "1Ki";
$bible_books[11]["long"] = "2 Kings"; $bible_books[11]["short"] = "2Ki";
$bible_books[12]["long"] = "1 Chronicles"; $bible_books[12]["short"] = "1Ch";
$bible_books[13]["long"] = "2 Chronicles"; $bible_books[13]["short"] = "2Ch";
$bible_books[14]["long"] = "Ezra"; $bible_books[14]["short"] = "Ezr";
$bible_books[15]["long"] = "Nehemiah"; $bible_books[15]["short"] = "Ne";
$bible_books[16]["long"] = "Esther"; $bible_books[16]["short"] = "Es";
$bible_books[17]["long"] = "Job"; $bible_books[17]["short"] = "Job";
$bible_books[18]["long"] = "Psalms"; $bible_books[18]["short"] = "Ps";
$bible_books[19]["long"] = "Proverbs"; $bible_books[19]["short"] = "Pr";
$bible_books[20]["long"] = "Ecclesiastes"; $bible_books[20]["short"] = "Ec";
$bible_books[21]["long"] = "Song of Songs"; $bible_books[21]["short"] = "So";
$bible_books[22]["long"] = "Isaiah"; $bible_books[22]["short"] = "Isa";
$bible_books[23]["long"] = "Jeremiah"; $bible_books[23]["short"] = "Jer";
$bible_books[24]["long"] = "Lamentations"; $bible_books[24]["short"] = "La";
$bible_books[25]["long"] = "Ezekial"; $bible_books[25]["short"] = "Eze";
$bible_books[26]["long"] = "Daniel"; $bible_books[26]["short"] = "Da";
$bible_books[27]["long"] = "Hosea"; $bible_books[27]["short"] = "Ho";
$bible_books[28]["long"] = "Joel"; $bible_books[28]["short"] = "Joe";
$bible_books[29]["long"] = "Amos"; $bible_books[29]["short"] = "Am";
$bible_books[30]["long"] = "Obadiah"; $bible_books[30]["short"] = "Ob";
$bible_books[31]["long"] = "Jonah"; $bible_books[31]["short"] = "Jon";
$bible_books[32]["long"] = "Micah"; $bible_books[32]["short"] = "Mic";
$bible_books[33]["long"] = "Nahum"; $bible_books[33]["short"] = "Na";
$bible_books[34]["long"] = "Habakkuk"; $bible_books[34]["short"] = "Hab";
$bible_books[35]["long"] = "Zephaniah"; $bible_books[35]["short"] = "Zep";
$bible_books[36]["long"] = "Haggai"; $bible_books[36]["short"] = "Hag";
$bible_books[37]["long"] = "Zechariah"; $bible_books[37]["short"] = "Zec";
$bible_books[38]["long"] = "Malachi"; $bible_books[38]["short"] = "Mal";
$bible_books[39]["long"] = "Matthew"; $bible_books[39]["short"] = "Mt";
$bible_books[40]["long"] = "Mark"; $bible_books[40]["short"] = "Mr";
$bible_books[41]["long"] = "Luke"; $bible_books[41]["short"] = "Lu";
$bible_books[42]["long"] = "John"; $bible_books[42]["short"] = "Joh";
$bible_books[43]["long"] = "Acts"; $bible_books[43]["short"] = "Ac";
$bible_books[44]["long"] = "Romans"; $bible_books[44]["short"] = "Ro";
$bible_books[45]["long"] = "1 Corinthians"; $bible_books[45]["short"] = "1Co";
$bible_books[46]["long"] = "2 Corinthians"; $bible_books[46]["short"] = "2Co";
$bible_books[47]["long"] = "Galatians"; $bible_books[47]["short"] = "Ga";
$bible_books[48]["long"] = "Ephesians"; $bible_books[48]["short"] = "Eph";
$bible_books[49]["long"] = "Philippians"; $bible_books[49]["short"] = "Php";
$bible_books[50]["long"] = "Colossians"; $bible_books[50]["short"] = "Col";
$bible_books[51]["long"] = "1 Thessalonians"; $bible_books[51]["short"] = "1Th";
$bible_books[52]["long"] = "2 Thessalonians"; $bible_books[52]["short"] = "2Th";
$bible_books[53]["long"] = "1 Timothy"; $bible_books[53]["short"] = "1Ti";
$bible_books[54]["long"] = "2 Timothy"; $bible_books[54]["short"] = "2Ti";
$bible_books[55]["long"] = "Titus"; $bible_books[55]["short"] = "Tit";
$bible_books[56]["long"] = "Philemon"; $bible_books[56]["short"] = "Phm";
$bible_books[57]["long"] = "Hebrews"; $bible_books[57]["short"] = "Heb";
$bible_books[58]["long"] = "James"; $bible_books[58]["short"] = "Jas";
$bible_books[59]["long"] = "1 Peter"; $bible_books[59]["short"] = "1Pe";
$bible_books[60]["long"] = "2 Peter"; $bible_books[60]["short"] = "2Pe";
$bible_books[61]["long"] = "1 John"; $bible_books[61]["short"] = "1Jo";
$bible_books[62]["long"] = "2 John"; $bible_books[62]["short"] = "2Jo";
$bible_books[63]["long"] = "3 John"; $bible_books[63]["short"] = "3Jo";
$bible_books[64]["long"] = "Jude"; $bible_books[64]["short"] = "Jude";
$bible_books[65]["long"] = "Revelation"; $bible_books[65]["short"] = "Re";
?>
What you just saw was the config.php files. All files are uploaded into the directory http://inneed.mxweb.co.uk/bible. The main file is called index.php, but used to be called bible.php. So I do this, and then it says to edit the config, see the above code it shows instructions near the top, and the urls to edit. So I go to test it out, and guess what? It doesn't work. I worked on it for two whole hours, and it still doesn't work. I need to know how to edit those files, if the index.php file, config.php file, and all the other files are located only in http://inneed.mxweb.co.uk. For the book, I am also including the bible.php code, which I changed to index.php. In case you are wondering, I did change in both these files that the bible.php, is now index.php.
CODE
<?
/*
* bible.php - A simple web program written by Alex Markley to display chunks of the Holy Bible.
*/
/*
This file is part of PHPScripture (Formally Alex's PHPBible).
PHPScripture is Copyright © 2003, Alex Markley
PHPScripture 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include("config.php");
function is_valid_number($something)
{
if(preg_match("/^([0-9]+)$/", $something)) return(TRUE);
else return(FALSE);
}
//We try to _GET the infos.
if(isset($_GET["book"])) $config["book"] = $_GET["book"];
if(isset($_GET["chapter"])) $config["chapter"] = $_GET["chapter"];
if(isset($_GET["verse"])) $config["verse"] = $_GET["verse"];
if(isset($_GET["operation"])) $config["operation"] = $_GET["operation"];
if(isset($_GET["search"])) $config["search"] = $_GET["search"];
if(isset($_GET["page"])) $config["page"] = $_GET["page"];
if(isset($_POST["book"])) $config["book"] = $_POST["book"];
if(isset($_POST["chapter"])) $config["chapter"] = $_POST["chapter"];
if(isset($_POST["verse"])) $config["verse"] = $_POST["verse"];
if(isset($_POST["operation"])) $config["operation"] = $_POST["operation"];
if(isset($_POST["search"])) $config["search"] = $_POST["search"];
if(isset($_POST["page"])) $config["page"] = $_POST["page"];
if(isset($config["book"]) && strcmp($config["book"], "") == 0) unset($config["book"]);
if(isset($config["chapter"]) && strcmp($config["chapter"], "") == 0) unset($config["chapter"]);
if(isset($config["verse"]) && strcmp($config["verse"], "") == 0) unset($config["verse"]);
if(isset($config["operation"]) && strcmp($config["operation"], "") == 0) unset($config["operation"]);
if(isset($config["search"]) && strcmp($config["search"], "") == 0) unset($config["search"]);
if(isset($config["page"]) && strcmp($config["page"], "") == 0) unset($config["page"]);
if($config["disable_searching"] === TRUE)
{
if(isset($config["operation"]) && strcmp($config["operation"], "Search") == 0) unset($config["operation"]);
unset($config["search"]);
unset($config["page"]);
}
//Now we assemble a correct URL to redirect to.
if(isset($config["book"]))
{
if(isset($config["book"]))
{
$stringbits[0] = ($config["book"]);
if(isset($config["chapter"]))
{
$stringbits[1] = ("/" . $config["chapter"]);
if(isset($config["verse"]))
{
$stringbits[2] = ("/" . $config["verse"]);
}
}
}
//Now assemble GET vars.
unset($stringbits[3]); //Make sure is unset.
if(isset($config["operation"]) && strcasecmp($config["operation"], "Go") != 0) //There is a special exception for operation "Go", because it's default anyway.
{
if(isset($stringbits[3]))
$stringbits[3] = ($stringbits[3] . "&");
else
$stringbits[3] = ($stringbits[3] . "?");
$stringbits[3] = ($stringbits[3] . "operation=" . $config["operation"]);
}
if(isset($config["search"]))
{
if(isset($stringbits[3]))
$stringbits[3] = ($stringbits[3] . "&");
else
$stringbits[3] = ($stringbits[3] . "?");
$stringbits[3] = ($stringbits[3] . "search=" . $config["search"]);
}
if(isset($config["page"]))
{
if(isset($stringbits[3]))
$stringbits[3] = ($stringbits[3] . "&");
else
$stringbits[3] = ($stringbits[3] . "?");
$stringbits[3] = ($stringbits[3] . "page=" . $config["page"]);
}
header("Location: " . $config["URI_prefix"] . $config["script_suffix"] . $stringbits[0] . $stringbits[1] . $stringbits[2] . $stringbits[3]);
exit();
}
if(isset($_SERVER["PATH_INFO"])) //The info from the path takes precedence.
{
$array = explode("/", $_SERVER["PATH_INFO"], 5);
for($tint = 1;isset($array[$tint]);$tint++)
{
if($tint === 1)
$config["book"] = $array[$tint];
else if($tint === 2)
$config["chapter"] = $array[$tint];
else if($tint === 3)
$config["verse"] = $array[$tint];
}
}
//echo(" \"" . $config["chapter"] . "\" \n");
?>
<?
if($config["headerless"] === FALSE)
{
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?
if(!isset($config["operation"]) || !(strcmp($config["operation"], "print") == 0))
{
?>
<style type="text/css">
<? include($config["local_prefix"] . $config["themes_midfix"] . $config["theme"] . "/theme.php"); ?>
</style>
<?
}
?>
<title><? echo($config["title"]); ?></title>
</head>
<body>
<?
}
?>
<div align="center"><h1><? echo($config["title"]); ?></h1></div>
<?
//Check for the validity of the input.
if(isset($config["chapter"]) && (is_valid_number($config["chapter"]) === FALSE))
{
if(strcmp($config["chapter"], "") != 0) echo("<h3>Sorry, Chapter needs to be a number.</h3>\n");
unset($config["chapter"]); //Just get rid of it.
}
if(isset($config["verse"]) && (is_valid_number($config["verse"]) === FALSE))
{
//There is a non-numerical character in verse. We /should/ be able to examine it for range.
$temp_array = explode("-", $config["verse"], 2);
if(isset($temp_array[0]) && isset($temp_array[1]) && is_valid_number($temp_array[0]) === TRUE && is_valid_number($temp_array[1]) === TRUE)
{
$config["verse"] = $temp_array[0];
$config["verse_end"] = $temp_array[1];
//echo("<h3>Verse Range \"" . $temp_array[0] . "\" - \"" . $temp_array[1] . "\"</h3>\n");
if($config["verse_end"] <= $config["verse"])
{
echo("<h3>Sorry. With a verse range, ending Verse needs to be larger then begining Verse.</h3>\n");
unset($config["verse"]);
unset($config["verse_end"]);
}
}
else
{
if(strcmp($config["verse"], "") != 0) echo("<h3>Sorry, Verse needs to be a number.</h3>\n");
unset($config["verse"]); //Just get rid of it.
}
}
if(isset($config["verse"]) && !isset($config["chapter"]))
{
echo("<h3>Sorry, you need a chapter if you're going to have a verse.</h3>\n");
unset($config["verse"]); //Just get rid of it.
}
if(strstr($config["book"], "/") === FALSE)
{
$bookok = FALSE; //Assume the book is invalid.
for($tint = 0;isset($bible_books[$tint]);$tint++)
{
//echo("<p> " . $tint . " " . $config["book"] . " " . $bible_books[$tint]["long"] . " " . $bible_books[$tint]["short"]);
if(strcasecmp($config["book"], $bible_books[$tint]["long"]) == 0) //This is a ref to the long name.
{
$bookok = TRUE; //The book is valid.
$bookindex = $tint;
$config["book"] = $bible_books[$tint]["short"]; //But the name needs to be the short version.
//echo(" <-- This!\n");
}
else if(strcasecmp($config["book"], $bible_books[$tint]["short"]) == 0) //This is a ref to the short name.
{
$bookok = TRUE; //The book is valid.
$bookindex = $tint;
$config["book"] = $bible_books[$tint]["short"]; //Make sure the name is exact. (We checked case insensitive, the case does matter though, so it's fixed.)
//echo(" <-- This!\n");
}
}
//If it's still okay.
if($bookok === TRUE)
{
//echo("<p>Book still okay\n");
$bookfilename = ($config["local_prefix"] . $config["bible_midfix"] . $config["book"]); //Generate the real filename.
//echo("<p>\"" . $bookfilename . "\"\n");
$bookfile = @fopen($bookfilename, "rb"); //Try to open the book.
if($bookfile == FALSE)
{
$bookok = FALSE;
//echo("<p>No such book! \"" . $bookfilename . "\"\n");
}
else
{
//echo("<p>Book Opened! \"" . $bible_books[$bookindex]["long"] . "\"\n");
}
//echo("<p>Book either opened or not.\n");
}
}
else
{
$bookok = FALSE;
}
if($bookok === FALSE && strcasecmp($config["operation"], "Search") != 0) //We'll be displaying a list of availible books if the book is bad we're not searching.
{
if(strcmp($config["book"], "") != 0) echo("<h3>Sorry, can't find Book \"" . $config["book"] . "\"</h3>\n");
?>
<?
//Prepare the required vars.
$tint = 0;
$wrap = 0;
?>
<div align="center">
<h3>Old Testament</h3>
<h4>The Books of the Law</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 5)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>The Books of History</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 17)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>The Books of Wisdom</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 22)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>The Books of the Prophets</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 39)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h3>New Testament</h3>
<h4>Accounts of Christ's Life on Earth, and of the Early Church</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 44)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>Letters from the Apostle Paul to Churches</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 53)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>Letters from the Apostle Paul to Individuals</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 57)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>Other Epistles</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 65)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
<h4>Prophecy</h4>
<p>
<table border="0"><tr align="center" valign="middle">
<?
$wrap = 0;
while($tint < 66)
{
if($wrap >= $config["element_wrap"])
{
$wrap = 0;
echo("</tr><tr align=\"center\" valign=\"middle\">");
}
echo("<td><form ACTION=\"" . $config["URI_prefix"] . $config["script_suffix"] . $bible_books[$tint]["short"] . "/" . 1 . "/\" METHOD=\"post\"><input TYPE=\"submit\" VALUE=\"" . $bible_books[$tint]["long"] . "\"></form></td>\n");
$tint++;
$wrap++;
}
?>
</tr></table>
</div>
<?
}
else if(strcasecmp($config["operation"], "Search") == 0) //Not displaying the title page, but are searching.
{
if(!isset($config["search"]) || strcmp(trim($config["search"]), "") == 0) //If there's nothing in there.
{
echo("<h3>If I'm going to search, I need something to search for. (Regular Expressions are supported.)</h3>\n");
}
else
{
$config["search"] = addslashes(trim($config["search"]));
$bdata_path = $config["local_prefix"] . $config["bible_midfix"];
//if(!isset($config["book"]))
if($bookok === FALSE)
{
unset($files); //Make sure is unset.
foreach($bible_books as $bible_book)
{
$files = ($files . $bible_book["short"] . " ");
}
$command = ("'" . $config["search"] . "' " . $files);
}
else
{
$command = ("'" . $config["search"] . "' " . $config["book"]);
}
if(($search_results = popen($config["good_shell"] . " -c \"cd " . $bdata_path . "; env LANG=C " . $config["grep_command"] . " -H -i " . $command . "\"", "r")) == FALSE)
{
echo("<h3>Error! Error! Unable to read search results!</h3>\n");
}
else
{
echo("<div align=\"center\"><h3>Search Results</h3></div>\n");
if(is_valid_number($config["page"]) === FALSE) $config["page"] = 1; //If we can't use it, it is probably nothing.
$evaluate_verse_next = TRUE;
$page = 0;
$subpage = $config["search_results_per_page"] + 5;
while($search_results != FALSE && !feof($search_results))
{
$buffer = fgets($search_results, 128);
if($evaluate_verse_next === TRUE && strcmp(rtrim($buffer), "") == 0);//echo("<h3>Killed a buffer!</h3>\n");
else
{
if($evaluate_verse_next === TRUE)
{
//Ok, this is a new verse, so we need to parse in and mark up the verse header.
$buffer = explode(" ", $buffer, 2); //Seperate the verse from the header.
$versedata = explode(":", $buffer[0]); //Explode the chunks of the header.
$buffer = $buffer[1]
I am including the rest of this in the next post.
