}
if ($group === null) {
    $group = $defaultString;
}
$title = $titleString[$group];
$head = $headString[$group];
$link = $linkString[$group];
$subcount = subCount($name, getGroupNumber($group));
$validSubMsg = null;
$magWrd = null;
$submit = null;
if (!array_key_exists('magword', $_POST)) {
    $_POST = array('magword' => null, 'submit' => null);
} else {
    $magWrd = saniTize($_POST['magword']);
    $submit = saniTize($_POST['submit']);
}
// now this is a little nutty
if ($magWrd === $magicword_2) {
    $magWrd = $magicword;
}
if ($magWrd !== $magicword || !$name || !$email) {
    if (!$email && $submit) {
        $validSubMsg = "alert('Submission needs a valid email address');" . "javascript:history.go(-1);";
    }
    if (!$name && $submit) {
        $validSubMsg = "alert('Submission needs a name');" . "javascript:history.go(-1);";
    }
    if ($magWrd != "launchcode" && $submit) {
        $validSubMsg = "alert('You must use a Magic Word. Check the referring web" . "page for the correct Magic Word.');" . "javascript:history.go(-1);";
    }
Beispiel #2
0
        }
    }
} else {
    // if $_GET set change submission group change our default group
    if (saniTize($_GET['chg']) === "default") {
        // target changed from sub to change group
        $target = "chggrp";
    }
}
// if post has group key set cookie for the group selected
if (isset($_POST['group'])) {
    $cookie_value = saniTize($_POST['group']);
    setcookie($cookie_name, $cookie_value, $cookie_time, '/');
    header('Location: ' . 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/getspeller');
    #exit;
}
// if post has target key test and then redirect to show
if (isset($_POST['target'])) {
    //sanitize post data before use
    if (saniTize($_POST['target']) === "chggrp") {
        header('Location: show');
        #exit;
    }
}
// render header
require '../template/header.php';
// render template
require '../template/grpselform.php';
// render footer
require '../template/footer.php';
//  last edit:  02/02/2015  ebt
// use alternate upload directory during automation
if (file_exists('../minis/alt_load.txt')) {
    $dirString = '../uploading_alt/';
}
// if speller absent(null) or the wrong file name alert user
if ($_FILES['uploadedfile']['name'] !== 'speller') {
    $message = 'missing, bogus or corupted file submission " ' . $_FILES['uploadedfile']['name'] . ' " please submit the file " speller " again.' . '<br /><br /><b>No file submission.</b>';
} else {
    // sanitize the passed data
    $group = saniTize($_POST['group']);
    // get the page header strings to make the page pretty
    $title = $titleString[$group];
    $head = $headString[$group];
    $link = $linkString[$group];
    // sanitize critical data passed from form
    $name = saniTize($_POST['name']);
    $email = validEmail($_POST['email']);
    // build the submission file name from  name, group number, and type
    $submissionNameGrpTyp = $name . getGroupNumber($group) . '-' . $_POST['type'];
    // get uploaded file from system data
    $fileName = basename($_FILES['uploadedfile']['name']);
    // build the target path string
    $target_path = $dirString . $submissionNameGrpTyp . $fileName . '.x';
    // search for duplicate subbmissions by name
    $files = glob($dirString . '*');
    foreach ($files as $file) {
        if (strpos($file, $name)) {
            $dupSub = true;
        }
    }
    // if duplicate name in local submissions folder alert user