if ($action != "login" && $action != "logout" && !$username) { login(); exit; } switch ($action) { case 'login': login(); break; case 'logout': logout(); break; case 'newArticle': newArticle(); break; case 'editArticle': editArticle(); break; case 'deleteArticle': deleteArticle(); break; default: listArticles(); } function login() { $results = array(); $results['pageTitle'] = "Admin Login | Falcon"; if (isset($_POST['login'])) { // User has posted the login form: attempt to log the user in if ($_POST['username'] == ADMIN_USERNAME && $_POST['password'] == ADMIN_PASSWORD) { // Login successful: Create a session and redirect to the admin homepage
<? require_once('articleModel.php'); $id = 3; $title = 'изменение title записи'; $text = 'изменение text записи'; $result = editArticle( $id, $title, $text ); if( $result ){ echo 'Новость успешно изменена'; }else echo 'Ошибка изменения новости';
// echo 'Article'; addArticle(); break; case PageLocation::Products: displayOurProducts(); //showAllArticles(); break; case PageLocation::SpecialOffer: editArticle($edit); //showAllArticles(); break; case PageLocation::Contact: echo 'User'; break; case PageLocation::AboutUs: editArticle($edit); //showAllArticles(); break; case PageLocation::Register: require_once __ROOT__ . '/include/register.php'; echo "Register...<br/>"; if (isset($registerForm)) { echo "Registering user...<br/>"; checkRegisterParams(); } else { echo "New user...<br/>"; showRegisterForm(); } break; case PageLocation::LogOff: echo 'LogOff';
echo roles(str_replace("#", "=", $_POST['query'])); } break; case "add_raider": if (notNull($_POST)) { addRaider($_POST); } break; case "add_article": if (notNull($_POST)) { addArticle($_POST); } break; case "edit_article": if (notNull($_POST)) { editArticle($_POST); } break; case "update_articles": if (notNull($_POST)) { updateArticles($_POST['order']); } break; case "delete_article": if (notNull($_POST)) { deleteArticle($_POST['id']); } break; case "shout": if (notNull($_POST)) { shout($_POST['message'], $_POST['dest']);