PHP Classes

File: uploady/admin/roles/actions/update.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   Uploady PHP Upload File to MySQL   uploady/admin/roles/actions/update.php   Download  
File: uploady/admin/roles/actions/update.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Uploady PHP Upload File to MySQL
Store file upload details in a MySQL database
Author: By
Last change: refactor
Code refactor
Date: 5 months ago
Size: 645 bytes
 

Contents

Class file image Download
<?php
require_once '../../session.php';

$role = new Uploady\Role($db, $user);

if (
$_SERVER['REQUEST_METHOD'] == "POST") {
   
$msg_code = "";

    if (!
$auth->checkToken($_POST['csrf'], $_SESSION['csrf'])) {
       
$utils->redirect($utils->siteUrl(
           
"/admin/roles/view.php?msg=csrf"
       
));
    }

    unset(
$_POST['csrf']);
   
$id = (int) $_POST['id'];

   
$msg_code = $role->updateRole(
       
$utils->sanitize($_POST['role_name']),
       
$utils->sanitize($_POST['size_limit']),
       
$id
   
) ? "role_updated" : "error";

   
$utils->redirect($utils->siteUrl(
       
"/admin/roles/view.php?msg=$msg_code"
   
));
}