Location: PHPKode > projects > phpBible > phpbible/show_lex2_entry.php
<?php

###
###
###    Copyright 2004, Danny Carlton. Permission is hereby granted to distribute 
###  copies of this software package as long as you do not charge for it, and the 
###  copyright notices remain intact. Permission is also granted to use the concepts 
###  in these scripts for other similar scripts, but you may not simply copy the scripts and claim them as your own.
###   
###


if(!$num)
  {
  reset ($HTTP_POST_VARS);
  while (list ($key, $val) = each ($HTTP_POST_VARS)) 
    {
    $$key=$value;
    }
  reset ($HTTP_GET_VARS);
  while (list ($key, $val) = each ($HTTP_GET_VARS)) 
    {
    $$key=$value;
    }
  }


$browser2 = getenv("HTTP_USER_AGENT");
$browser=str_replace(' ', '+', $browser);

if(stristr($browser2, 'netscape')){$browser='NS';}
if(stristr($browser2, 'mozilla')){$browser='NS';}
if(stristr($browser2, 'msie')){$browser='IE';}
if(stristr($browser2, 'opera')){$browser='OP';}


if(!$num){$num="01";}
require("./config.php");
$link = mysql_connect($host, $user, $password)
    or die("Could not connect : " . mysql_error());
mysql_select_db($db_name) or die("Could not select database");

$html=implode('', file("./_lex2_template.htm"));

if(strpos($num, '0')===0)
  {
  $table_name=$table_prefix;
  $table_name.='hebrew_lexicon';
  $num=substr($num, 1);
  $font="BSTHebrew, SLHebrew";
  $start='0';
  $num_start='0';
  }
else
  {
  $table_name=$table_prefix;
  $table_name.='greek_lexicon';
  $font="BSTGreek, SLGreek";
  $num_start='';
  }


$query = "SELECT * FROM $table_name WHERE number LIKE \"$num\"";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
$line = mysql_fetch_row($result); 

#echo "<html><body bgcolor=#eefefe><table width=280 cellpadding=0 cellspacing=0 border=0 bgcolor=#eefefe><tr><td valign=top nowrap><font size=3><b>$line[0]. </b> &nbsp;</font></td><td><p><font size=4 face='$font'>$line[1]</font><font size=3> &nbsp;$line[3], &nbsp;<i>$line[5]</i>; &nbsp;$line[7]</font></p></td></tr></table></body></html>";

 
$word_list=explode(' ', $line[2]);
for($i=0;$i<count($word_list);$i++)
  {
  if(strstr(" $word_list[$i]", '('))
    {
    $word_list[$i]=str_replace('(', '', $word_list[$i]);
    $word_list[$i]=str_replace(')', '', $word_list[$i]);
    $punc=ereg_replace("[0-9]", '', $word_list[$i]);
    $word_list[$i]=ereg_replace("[^0-9]", '', $word_list[$i]);
    $word_list[$i]="<a href=\"./show_lex2_entry.php?num=$word_list[$i]\">$word_list[$i]</a>$punc";
    }
  }
$line[2]=implode(' ', $word_list);



if($browser!='IE')
  {
  $notie="<table width=100%
    <tr>
      <td bgcolor=\"{{DARK}}\" valign=\"top\" style=\"padding-left: 3; padding-right: 3\" height=\"20\" nowrap colspan=2>
        <table border=\"0\" width=\"100%\">
          <tr>
            <td><font color=\"#FFFFFF\" face=\"Verdana\" size=\"2\"><b>Lexicon:&nbsp;<span class=def_title onclick=\"opener.location.href='./$script_name?keyword=~$num_start$num'; window.close();\" style=\"cursor:pointer\">Strong's</span></b></font></td>
            <td><i><b><font color=\"{{MEDIUM}}\" size=\"3\">[$word]</font></b></i></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr></table>";
  }

$notie=str_replace('{{VERY DARK}}', $page_very_dark, $notie);
$notie=str_replace('{{DARK}}', $page_dark, $notie);
$notie=str_replace('{{LIGHT}}', $page_light, $notie);
$notie=str_replace('{{MEDIUM}}', $page_medium, $notie);
$notie=str_replace('{{MAIN}}', $script_name, $notie);

$html=str_replace('<body class="light" onload="self.focus()">', "<body class=\"light\" onload=\"self.focus()\">$notie", $html);
$html=str_replace('{{STRONG\'S NUMBER}}', "$start$num", $html);
$html=str_replace('{{ORIGINAL WORD}}', "<font size=4 face='$font'>$line[1]</font>", $html);
$html=str_replace('{{WORD ORIGIN}}', $line[2], $html);
$html=str_replace('{{TRANSLITERATED WORD}}', $line[3], $html);
$html=str_replace('{{TDNT}}', $line[4], $html);
$html=str_replace('{{PART OF SPEECH}}', $line[6], $html);
$html=str_replace('{{PHONETIC SPELLING}}', $line[5], $html);
$html=str_replace('{{DEFINITION}}', $line[8], $html);

echo $html;
#echo "<b>$line[0]. </b> &nbsp;<font size=4 face='$font'>$line[1]</font> &nbsp;$line[3], &nbsp;<i>$line[5]</i>; &nbsp;$line[7]";
?> 
Return current item: phpBible