mirror of
https://github.com/myvesta/vesta
synced 2025-07-06 13:01:56 -07:00
Proper way to fix CSRF in /schedule/backup/
This commit is contained in:
parent
0336e8b8d0
commit
11f1cfcf4e
2 changed files with 8 additions and 4 deletions
|
@ -1,14 +1,18 @@
|
|||
<?php
|
||||
|
||||
// Preventing CSRF
|
||||
prevent_post_csrf(true);
|
||||
|
||||
// Init
|
||||
error_reporting(NULL);
|
||||
ob_start();
|
||||
session_start();
|
||||
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
||||
|
||||
// Check token
|
||||
if ((!isset($_GET['token'])) || ($_SESSION['token'] != $_GET['token'])) {
|
||||
die($_SESSION['token']);
|
||||
header('location: /login/');
|
||||
exit();
|
||||
}
|
||||
|
||||
$v_username = escapeshellarg($user);
|
||||
exec (VESTA_CMD."v-schedule-user-backup ".$v_username, $output, $return_var);
|
||||
if ($return_var == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="l-center">
|
||||
<div class="l-sort clearfix noselect">
|
||||
<a href="/schedule/backup/" class="l-sort__create-btn" title="<?=__('Create Backup')?>"></a>
|
||||
<a href="/schedule/backup/?token=<?=$_SESSION['token']?>" class="l-sort__create-btn" title="<?=__('Create Backup')?>"></a>
|
||||
<div class="l-sort-toolbar clearfix">
|
||||
<table>
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue