コード例 #1
0
ファイル: new_admin.php プロジェクト: rafay826/Fywave-CMS
<?php

session_start();
require_once '../../inc/model/sessions.php';
require_once '../../inc/model/classes.php';
require_once '../../inc/model/functions.php';
require_once '../../inc/model/validation_func.php';
main\confirm_login();
main\find_selected_page();
if (isset($_POST["submit"])) {
    $username = main\mysql_prep($_POST["username"]);
    $password = main\password_encrypt($_POST["password"]);
    validation\no_null($username);
    $query = "INSERT INTO admins\n              (username, hashed_password)\n              VALUES\n              ( '{$username}', '{$password}' )\n             ";
    $result = $db->query($query);
    if ($result) {
        ?>
<p class="alert alert-success"><?php 
        $_SESSION["message"] = "Success!";
        ?>
</p><?php 
        main\redirect_to("../manage_content.php");
    } else {
        $_SESSION["message"] = "Fail!";
        main\redirect_to("new_admin.php");
    }
} else {
}
include '../../inc/views/layouts/header.php';
main\menu($selected_subject_id, $selected_page_id);
//include('../../inc/views/layouts/admin_header.php');
コード例 #2
0
<?php

session_start();
require_once '../../inc/model/classes.php';
require_once '../../inc/model/functions.php';
require_once '../../inc/model/validation_func.php';
main\confirm_login();
main\find_selected_page();
if (isset($_POST["submit"])) {
    $menu_name = main\mysql_prep($_POST["menu_name"]);
    validation\no_null($menu_name);
    $query = "DELETE FROM subjects\n              WHERE menu_name = '{$menu_name}'\n              LIMIT 1";
    $result = $db->query($query);
    if ($result) {
        $_SESSION["message"] = "Success!";
        main\redirect_to("delete_menu_items.php");
    } else {
        $_SESSION["message"] = "Fail!";
        main\redirect_to("delete_menu_items.php");
    }
} else {
}
include '../../inc/views/layouts/header.php';
main\menu($selected_subject_id, $selected_page_id);
?>

<div class="wrapper">
    <section class="content">
    <form action="delete_menu_items.php" method="post">
        <p>Menu Name: <select name="menu_name">
                <?php