From f8ec66cf798ae168a9f60288f13ef736ab588b49 Mon Sep 17 00:00:00 2001 From: LB3D <85522485+LeoBlanchette@users.noreply.github.com> Date: Tue, 5 Nov 2024 01:01:33 -0600 Subject: [PATCH] Remove the web folder. This is not necessary as the focus is simply databases. --- web/bible_to_sql.php | 131 ------------------------------------------- web/index.php | 113 ------------------------------------- 2 files changed, 244 deletions(-) delete mode 100644 web/bible_to_sql.php delete mode 100644 web/index.php diff --git a/web/bible_to_sql.php b/web/bible_to_sql.php deleted file mode 100644 index 425f3bce..00000000 --- a/web/bible_to_sql.php +++ /dev/null @@ -1,131 +0,0 @@ -stmt_init(); - $stmt->prepare($query); - $stmt->bind_param("s", $book); - $stmt->execute(); - $result = $stmt->get_result(); - if ($row = $result->fetch_array(MYSQLI_NUM)) { - return $row[0]; - } - $stmt->close(); -} - -function convertToBook($number = NULL, $database = NULL) { - if (!$database) { die('You forgot to specify the database in your bible_to_sql call.'); } - - $query = "SELECT n from bible.key_english WHERE b=?"; - - $stmt = $database->stmt_init(); - $stmt->prepare($query); - $stmt->bind_param("s", $number); - $stmt->execute(); - $result = $stmt->get_result(); - if ($row = $result->fetch_array(MYSQLI_NUM)) { - return $row[0]; - } - $stmt->close(); - -} - -//JOSHUA 1:8-10 to 0601008-0601010 - -//return book number -class bible_to_sql { - - protected $book = null; - protected $bookName = null; - protected $chapter = null; - protected $chapterHuman = null; - protected $verse = "001"; - protected $endverse = "999"; - protected $range = FALSE; - - public function __construct($string = NULL, $range = FALSE, $database = NULL) { - - //places a . between book name and reference. - //i.e. changes "Song of Solomon 9:6" to "Song of Solomon.9:6" - $string = preg_replace('/\s(\S*)$/', '.$1', trim($string)); //trim end for sanitization. - - //split - $separatedArray = explode(".",$string); - $this->book = $this->addZeros(convertToNumber($separatedArray[0], $database), 2); - $this->bookName = convertToBook($this->book, $database); - - //split chapter and verse - $separatedVerse = explode(":",$separatedArray[1]); - $this->chapterHuman = $separatedVerse[0]; - $this->chapter = $this->addZeros($separatedVerse[0],3); - - //determine if single or range - if (strpos($separatedArray[1], '-') !== FALSE) { - $range = TRUE; - } - - if (!isset($separatedVerse[1])) { - $range = TRUE; - } - - //set range - $this->range = $range; - - if ($range) { - if (count($separatedVerse) > 1) { - $anotherSplit = explode("-",$separatedVerse[1]); - $this->verse = $this->addZeros($anotherSplit[0], 3); - if (count($anotherSplit) > 1) { - $this->endverse = $this->addZeros($anotherSplit[1] + 1, 3); - } - } - } else { - $this->verse = $this->addZeros($separatedVerse[1], 3); - } - - } - - public function addZeros($input,$max) { - $len = strlen($input); - - for ($len; $len < $max; $len++) { - $input = "0".$input; - } - - return $input; - - } - - public function sql() { - if ($this->range) { - return "id >= ".$this->book.$this->chapter.$this->verse." AND id < ".$this->book.$this->chapter.$this->endverse." "; - } else { - return "id='".$this->book.$this->chapter.$this->verse."'"; - } - } - - public function getBook() { - return $this->bookName; - } - - public function getChapter() { - return $this->chapterHuman; - } - - public function getVerse() { - return $this->verse; - } - - public function getEndVerse() { - return $this->endverse; - } - - public function getRange() { - return $this->range; - } - -} diff --git a/web/index.php b/web/index.php deleted file mode 100644 index 37d8e320..00000000 --- a/web/index.php +++ /dev/null @@ -1,113 +0,0 @@ -connect_error) { - die('Connect Error (' . $mysqli->connect_errno . ') ' - . $mysqli->connect_error); - } - - $mysqli->query("SET NAMES utf8"); - - require("bible_to_sql.php"); - //echo "b: ".$_GET['b']." r: ".$_GET['r']."
"; - - - //split at commas - if (!empty($_GET['b'])) { - $refText = $_GET['b']; - $references = explode(",",$refText); - } else { - $refText = $default_text; - $references = explode(",", $default_text); - } - - if (!empty($_GET['v'])) { - $version = $_GET['v']; - } else { - $version = $default_version; - } -?> - - - - Bible Search - - - - -
-
- - - -
-
-
- -
- sql() . "
"; - //SELECT * FROM bible.t_kjv WHERE id BETWEEN 01001001 AND 02001005 - $sqlquery = "SELECT * FROM " . $version . " WHERE " . $ret->sql(); - $stmt = $mysqli->prepare($sqlquery); - $stmt->execute(); - $result = $stmt->get_result(); - if ($result->num_rows > 0) { - //$row = $result->fetch_array(MYSQLI_NUM); - //0: ID 1: Book# 2:Chapter 3:Verse 4:Text - - print "

{$ret->getBook()} {$ret->getChapter()}

"; - - while ($row = $result->fetch_row()) { - print "
${row[3]}
${row[4]}

"; - } - print "
"; - - } else { - print "Did not understand your input."; - } - $stmt->close(); - } - $mysqli->close(); - ?> -
- -