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

Sermon Added

[php] // FORMAT FIELDS
//=======================================================================
$sDate = “”;
$sTitle = “”;
$sSeries = “”;
$sText = “”;
$sDesc = “”;
$sNotes = “”;
$sAudio = “”;
$sAudio_Duration = “”;
$sResearch = “”;
$sKeywords = “”;
$sSpeaker = “”;
$sSpeakerURL = “”;
$sVideo = “”;
$sVideo_Preview = “”;
$sVimeo = “”;
$sVimeo_Download = “”;
$sYouTube = “”;
$sChurch = “Whitehall”;
$sPageURL = “”;
$sTranscript = “”;
$uName = “”;
$uPW = “”;
// RETRIEVE FROM FORM ON add-a-sermon PAGE
//=======================================================================
$uName = $_POST[“uName”];
$uPW = $_POST[“uPW”];
$sDate = $_POST[“sDate”];
$sTime = $_POST[“sTime”];
$sTitle = $_POST[“sTitle”];
$sSeries = $_POST[“sSeries”];
$sText = $_POST[“sText”];
$sDesc = $_POST[“sDesc”];
$sResearch = $_POST[“sResearch”];
$sVideo_Preview = $_POST[“sVideo_Preview”];
$sKeywords = $_POST[“sKeywords”];
$sSpeaker = $_POST[“sSpeaker”];
$sAudio_Duration = $_POST[“sAudio_Duration”];
$sAudio = $_POST[“sAudio”];
$sVimeo = $_POST[“sVimeo”];

// ONLY PROCEED IF LOGIN IS CORRECT
//=======================================================================
if (($uName == “Tim”) and ($uPW == “ByGraceAlone1!”)) {
// REFORMAT VALUES
//=======================================================================
if (isset($_POST[“dScribdDocID”])) {
$dScribdDocID = $_POST[“dScribdDocID”];
$dScribdURL = “http://www.scribd.com/doc/”.$dScribdDocID;
}
if (isset($_POST[“sNotes”])) {
$sNotes = $_POST[“sNotes”];
$dNotes = “sermons/”.sNotes;
}
if ($sTime == “am”) { $sDate_formatted = $sDate.” 12:00:00″; }
if ($sTime == “pm”) { $sDate_formatted = $sDate.” 19:00:00″; }
// SAVE TO DATABASE
//=======================================================================

// —- INSERT INTO SERMONS —————————————————————-

$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;
}

$query = “INSERT INTO `sermons` (`sDate`, `sTitle`, `sSeries`, `sText`, `sDesc`, `sNotes`, `sAudio`, `sAudio_Duration`, `sResearch`, `sKeywords`, `sSpeaker`, `sSpeakerURL`, `sVideo`, `sVideo_Preview`, `sVimeo`, `sVimeo_Download`, `sYouTube`, `sChurch`, `sPageURL`, `sTranscript`) VALUES (‘”.$sDate_formatted.”‘, ‘”.$sTitle.”‘, ‘”.$sSeries.”‘, ‘”.$sText.”‘, ‘”.$sDesc.”‘, ‘”.$sNotes.”‘, ‘”.$sAudio.”‘, ‘”.$sAudio_Duration.”‘, ‘”.$sResearch.”‘, ‘”.$sKeywords.”‘, ‘”.$sSpeaker.”‘, ‘”.$sSpeakerURL.”‘, ‘”.$sVideo.”‘, ‘”.$sVideo_Preview.”‘, ‘”.$sVimeo.”‘, ‘”.$sVimeo_Download.”‘, ‘”.$sYouTube.”‘, ‘”.$sChurch.”‘, ‘”.$sPageURL.”‘, ‘”.$sTranscript.”‘)”;
mysqli_select_db($link, “wbfc3300”);
$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!”;
}

mysqli_close($link);

// —- INSERT INTO DOWNLOADS —————————————————————-

$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;
}
if ($sNotes <> “”) {
$sNotes = “sermons/”.$sNotes;
}

$query = “INSERT INTO `downloads` (`dTitle`, `dDate`, `dDesc`, `dURL`, `dType`, `dUser`, `dScribdURL`, `dScribdDOCID`, `dScribdKeyCode`) VALUES (
‘”.$sTitle.”‘, ‘”.$sDate.”‘, ‘”.$sDesc.”‘, ‘”.$sNotes.”‘, ‘Sermons’, 0, ‘”.$dScribdURL.”‘, ‘”.$dScribdDocID.”‘, null)”;
mysqli_select_db($link, “wbfc3300”);
$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!”;
}

mysqli_close($link);

// —- TELL ‘EM IT WORKS —————————————————————-
echo “

Your Sermon was Successfully Added

“;
echo “

Your entry is now entered into the sermon archive.

“;
echo “

Visit the Sermon Archive. Your entry will be at the top of the list!

“;
} // end of credential check IF statement
// —- TELL ‘EM IT DIDN’T WORK ————————————————————–
else {
echo “

Failed to Add the Sermon

“;
echo “

Your entry was not accepted because your username and password were invalid.

“;
echo “

To prevent needing to re-enter all your data, hit the back button on your web browser and then try re-entering your login credentials.

“;

echo “

QUERY: “.$query.”

“;

}
[/php]

Outdoor worship throughout the Sundays in October at 10:00amGet more info