Exemple #1
0
     // Hash the password with the salt
     $hash = crypt($cleanedPost['create_user_password'], $salt);
     $sql = "INSERT INTO admin (username, password, usertype) VALUES(?, ?, ?)";
     $stmt = $db->prepare($sql);
     $stmt->execute(array($cleanedPost['create_user_name'], $hash, $cleanedPost['create_user_usertype']));
     $stmt->closeCursor();
     header('Location:../admin.php');
     exit;
 } else {
     if (isset($_GET['action']) && $_GET['action'] == 'project_delete') {
         //check if logged in and logged in as admin or editor before deleting
         if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 1) {
             //instantiate the Project class
             $blogpost = new Blogpost();
             //Delete the post and return to the entry
             if ($blogpost->deleteBlogpost($_GET['id'])) {
                 header('Location:../news.php');
                 exit;
             } else {
                 exit('ERROR: Could not delete the project.');
             }
             exit;
         } else {
             exit('ERROR: You are not authorized to delete projects.');
         }
     } else {
         if (isset($_GET['action']) && $_GET['action'] == 'event_delete') {
             //check if logged in and logged in as admin or editor before deleting
             if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == 1) {
                 //instantiate the Project class
                 $event = new Event();