<div id="page-wrapper"> <div class="container-fluid"> <!-- Page Heading --> <div class="row"> <div class="col-lg-12"> <h1 class="page-header"> Categories <small>Author</small> </h1> <div class="col-xs-6"> <?php insertCategories(); ?> <form action="" method="post"> <label for="cat_title">Category Title</label> <div class="form-group"> <input class="form-control" name = "cat_title" type="text"> </div> <div class="form-group"> <input class="btn btn-primary" type="submit" name="submit" value="Add Category"> </div> </form> <?php //update include if (isset($_GET["edit"])) { include "includes/update_categories.php";
$pdos->execute(); } // To generate the JSON response. $success = FALSE; $errorMessage = ''; if (isset($_POST['school']) && isset($_POST['email']) && isset($_POST['password'])) { $school = strip_tags($_POST['school']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $publicId = rand() . $school . rand(); $privateId = rand() . $password . rand(); if (checkEmailPublicIdPrivateId($email, $publicId, $privateId)) { if (strlen($email) <= MAX_EMAIL_LENGHT) { if (strlen($school) <= MAX_SCHOOL_LENGHT) { insert($school, $email, $password, $publicId, $privateId); insertCategories($GLOBALS['pdo']->lastInsertId()); $success = TRUE; } else { $errorMessage = 'Der Schulname ist zu lang.'; } } else { $errorMessage = 'Die E-Mailadresse ist zu lang.'; } } else { // This message is not completely accurate. // It could also be the case that publicId or privateId are already in // use. Anyway this should not happen. $errorMessage = 'Diese E-Mail existiert bereits.'; } } echo generateJSONAnswer(array('success' => $success, 'errorMessage' => $errorMessage));