123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- // Check for submission of entered data
- if (isset($_POST['submit'])){
- if ( ( $nameErr != "") ||
- ( $emailErr != "") ||
- ( $telErr != "") ||
- ( $legalpermissionErr != "" ) ||
- ( $languageErr != "") ||
- ( $storyErr != "") ||
- ( $titleErr != "") ||
- ( $authorshipErr != "" ) ) {
- if ($nameErr != "") {
- echo $nameErr;
- }
- if ($emailErr != "") {
- echo $emailErr;
- }
- if ($telErr != "") {
- echo $telErr;
- }
- if ($legalpermissionErr != "") {
- echo $legalpermissionErr;
- }
- if ($storyErr != "" ) {
- echo $storyErr;
- }
- if ($titleErr != "" ) {
- echo $titleErr;
- }
- if ($authorshipErr != "") {
- echo $authorshipErr;
- }
- die(' Data is not entered correctly.');
- }
- else{
- $languagename = getlanguage($language);
- $to = "lugha@tuvutepamoja.africa";
- $subject = "Story Submission";
- $txt = "Dear " . $name . ",\n Thanks for your short story submission in " . $languagename . ". Your story has the title:\n" .$title ."\n We have your contact telephone as :\n" . $countryCode . " " . $tel . "\n We will remind you when the translation and evaluation phase begin. Should you have any questions, please contact us at \n lugha@tuvutepamoja.africa \n Thanks again for your contribution which is below.\n\n Sincerely,\nThe organizing committee.\n\n" . $story ."\n";
- $txt = wordwrap($txt , 70);
- $headers = "From: lugha@tuvutepamoja.africa" . "\r\n" . "CC: " . $email ."\r\nContent-Type: text/plain; charset=UTF-8";
- mail($to,$subject,$txt,$headers);
- echo "<br>";
- echo "Thank you for your submission. You should receive an acknowledgement from a human within 1 working day.";
- echo "Please restart your web browser if you wish to make another submission.";
- echo "<br>";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- mysqli_set_charset($conn, "utf8");
- // Check connection
- if (!$conn) {
- die("Database connection failed: " . mysqli_connect_error());
- }
- $wordsentered = wordcount($story);
- $name=mysqli_real_escape_string($conn,$name);
- $story=mysqli_real_escape_string($conn,$story);
- $title=mysqli_real_escape_string($conn,$title);
- $email=mysqli_real_escape_string($conn,$email);
- $tel=mysqli_real_escape_string($conn,$tel);
- $checked = "no";
- $translation = "no";
- $translatedfromid = 0;
- $sql = "INSERT INTO originalstories (name, legalpermission, email, countryCode, tel, language, title, story, authorship, wordsentered, checked, translation, translatedfromid) VALUES ( '" . $name . "', '" . $legalpermission . "', '" . $email . "', '" . $countryCode . "', '" . $tel . "' , '" . $language . "','" . $title . "', '" . $story . "', '" . $authorship . "', '" . $wordsentered . "', '" . $checked . "', '" . $translation . "', '" . $translatedfromid . "' )";
- if (mysqli_query($conn, $sql)) {
- echo "New record created successfully";
- } else {
- echo "Error creating database record, please contact lugha@tuvutepamoja.africa.";
- //echo $sql . "<br>" . mysqli_error($conn);
- }
-
- mysqli_close($conn);
-
- }
-
- }
- ?>
|