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

Go Live Process

[php] // FORMAT VALUES
//=======================================================================
$lsUser = “”;
$lsPW = “”;
$lsDNS = “”;
$lsScripture = “”;
$lsNotes = “”;
$curDate = date(“Y-m-d H:i:s”);
$DUPLICATE_FOUND = “no”;

// RETRIEVE FROM FORM ON add-a-sermon PAGE
//=======================================================================
$lsUser = $_POST[“lsUser”];
$lsPW = $_POST[“lsPW”];
$lsDNS = $_POST[“lsDNS”];
$lsScripture = $_POST[“lsScripture”];
$lsNotes = $_POST[“lsNotes”];

echo “User: ‘”.$lsUser.”‘
“;
echo “PW: ‘”.$lsPW.”‘
“;
echo “DNS: ‘”.$lsDNS.”‘
“;
echo “Scripture: ‘”.$lsScripture.”‘
“;
echo “Notes: ‘”.$lsNotes.”‘
“;
echo “Date: ‘”.$curDate.”‘

“;

// ONLY PROCEED IF LOGIN IS CORRECT
//=======================================================================
if (($lsUser == “Tim”) and ($lsPW == “ByGraceAlone1!”)) {

// —- CHECK FOR DUPLICATE —————————————————————-

$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 = ‘SELECT * FROM livestream WHERE lsStart=”‘.$curDate.'”‘;
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!”;
}

while ($row = mysqli_fetch_assoc($result)):
$DUPLICATE_FOUND = “yes”;
endwhile;

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

// —- INSERT INTO LIVE VIDEO —————————————————————-

if ($DUPLICATE_FOUND = “no”) {

$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 livestream (lsStart, lsEnd, lsNotes, lsPublicDNSName, lsScripture) values (“‘.$curDate.'”, null, “‘.$lsNotes.'”, “‘.$lsDNS.'”, “‘.$lsScripture.'”);’;
mysqli_select_db($link, “wbfc3300”);
$result = mysqli_query($link, $query);
echo “

QUERY: “.$query.”

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

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

You are Live!

“;
echo “

Your video is now live.

“;
echo “

Visit the Live Stream.

“;
echo “

End the Live Stream.

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

Failed to Go Live

“;
echo “

You did not go live 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.

“;
}

[/php]
Outdoor worship begins Sunday, June 7 at 10:15amGet more info