introducing ordinary people to extraordinary, ever-growing life in Jesus, our Savior

Sermon

[php]

if (isset($_GET[‘sermontitle’]))
$sermontitle = $_GET[‘sermontitle’];
else
$sermontitle=”;

if (isset($_GET[‘church’]))
$church = $_GET[‘church’];
else
$church=’Whitehall’;

if (isset($_GET[‘sermondate’]))
$sermondate = $_GET[‘sermondate’];
else
$sermondate = “No Sermon Date Provided.”;

echo ‘

‘;
echo ‘

‘;

$link = mysqli_connect(‘whitehall.church’, ‘wbfc3300’, ‘REDSreds1005!!’);

if (!$link) {
echo “Error: Unable to connect to MySQL.” . PHP_EOL;
echo “Debugging errno: ” . mysqli_connect_errno() . PHP_EOL;
echo “Debugging error: ” . mysqli_connect_error() . PHP_EOL;
exit;
}

mysqli_select_db($link, “wbfc3300″);

if ($sermontitle ==”)
$query = “select * from sermons order by sdate desc limit 1”;
else
$query = “select * from sermons where sTitle='”.$sermontitle.”‘ and sChurch='”.$church.”‘ order by sdate”;

$result = mysqli_query($link, $query);

if (!$result) {
$message = ‘Invalid query: ‘ . mysqli_error() . “\n”;
$message .= ‘Whole query: ‘ . $query;
die($message);
echo “Could not connect to the table!”;
}

while ($row = mysqli_fetch_assoc($result)) {

$sDate= $row[‘sDate’];
$sTitle= $row[‘sTitle’];
$sSeries = $row[‘sSeries’];
$sText = $row[‘sText’];
$sDesc = $row[‘sDesc’];
$sNotes = $row[‘sNotes’];
$sAudio = $row[‘sAudio’];
$sAudio_Duration = $row[‘sAudio_Duration’];
$sResearch = $row[‘sResearch’];
$sKeywords = $row[‘sKeywords’];
$sSpeaker = $row[‘sSpeaker’];
$sChurch = $row[‘sChurch’];
$sSpeakerURL = $row[‘sSpeakerURL’];
$sVideo = $row[‘sVideo’];
$sVideo_Preview = $row[‘sVideo_Preview’];
$sVimeo = $row[‘sVimeo’];
$sYouTube = $row[‘sYouTube’];
$sTranscript = $row[‘sTranscript’];
}

$result->close();

if ($sermontitle ==”)
$query = “select * from downloads where dType=’Sermons’ order by ddate desc limit 1”;
else
$query = “select * from downloads where dTitle='”.$sermontitle.”‘ order by ddate”;

$result = mysqli_query($link, $query);

if (!$result) {
$message = ‘Invalid query: ‘ . mysqli_error() . “\n”;
$message .= ‘Whole query: ‘ . $query;
die($message);
echo “Could not connect to the table!”;
}

while ($row = mysqli_fetch_assoc($result)) {
// dID, dTitle, dDate, dDesc, dURL, dType, dUser, dScribdURL, dScribdDOCID, dScribdKeyCode
$dScribdDOCID= $row[‘dScribdDOCID’];
$dScribdKeyCode= $row[‘dScribdKeyCode’];
}

$result->close();
mysqli_close($link);

if ($sSpeaker == ‘Pastor Tim’)
{
$sSpeakerURL = ‘Pastor Tim‘;
}
else if ($sSpeaker == ‘Pastor Aaron’)
{
$sSpeakerURL = ‘Pastor Aaron‘;
}
else if ($sSpeaker == ‘Pastor Al’)
{
$sSpeakerURL = ‘Pastor Al’;
}
else if ($sSpeaker == ‘Pastor Ruth’)
{
$sSpeakerURL = ‘Pastor Ruth’;
}
else if ($sSpeaker == ‘Pastor Gene’)
{
$sSpeakerURL = ‘Pastor Gene‘;
}
else
{
$sSpeakerURL = ‘‘.$sSpeaker.’‘;
}

// NOW DISPLAY THE DATABASE CONTENT

echo ‘

‘, $sTitle, ‘

‘;

$sVideo_DISPLAY = “”;
if ($sVimeo<>”) {
echo ‘

Video

‘;
echo ‘‘;
$sVideo_DISPLAY = “http://www.vimeo.com/”.$sVimeo;
}

if ($sVimeo==” and $sYouTube<>”) {
echo ‘‘;
echo ‘

Video

‘;
echo ‘‘;
$sVideo_DISPLAY = “www.youtube.com/watch?v=”.$sYouTube;
}

$sChurch_DISPLAY = ”;

if($sChurch == “Whitehall”):
$sChurch_DISPLAY = ‘Whitehall‘;
elseif($sChurch == “Northern Lehigh”):
$sChurch_DISPLAY = ‘Northern Lehigh‘;
else:
$sChurch_DISPLAY = ‘unknown’;
endif;

if ($sAudio<>”) {
echo ‘

Audio

http://whitehall.church/sermons/'.$sAudio.'

‘;

}

if ($dScribdDOCID<>”) {
echo ‘

Notes

‘;
}

echo ‘

 

‘;
echo ‘

Description: ‘, $sDesc, ‘

‘;
echo ‘

Keywords: ‘, $sKeywords, ‘

‘;

echo ‘

‘;
echo ‘

‘;
echo ‘

Date: ‘, date(‘F d, Y’, strtotime($sDate)), ‘

‘;
echo ‘

Series: ‘, $sSeries, ‘

‘;
echo ‘

Speaker: ‘, $sSpeakerURL, ‘

‘;
echo ‘

Church: ‘, $sChurch_DISPLAY, ‘

‘;
echo ‘

‘;
if ($sVideo_DISPLAY<>”) {
echo ‘

Scripture: ‘, $sText, ‘

‘;
echo ‘

Video: Watch this Sermon

‘;
}
if ($sAudio<>”) {
echo ‘

Audio: Listen to this Sermon (time ‘, $sAudio_Duration, ‘)

‘;
}
if ($sNotes<>”) {
echo ‘

Notes: Read Sermon Notes

‘;
}
echo ‘

‘;

if ($sTranscript<>”) {
echo ‘Transcript (new way)
‘;
$file = “http://whitehall.church/sermons/”.$sTranscript;
$contents = file($file);
$string = implode($contents);
$string = trim(preg_replace(‘/\s+/’, ‘ ‘, $string));
echo $string;
echo ”

“;
}

if ($sVideo_Preview<>”) {
echo ‘

Sermon Image

‘;
}

[/php]

Return to All Sermons