Skip to content

Commit

Permalink
check authentication when uploading files
Browse files Browse the repository at this point in the history
  • Loading branch information
evo42 committed May 21, 2013
1 parent 58ec2d8 commit 47f7a91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions runty/app/upload.aloha.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<?php
require_once 'core.php';

if (isset($_SESSION['user']->role)) {
if ($_SESSION['user']->role != 'admin' || $_SESSION['user']->role != 'editor') {
echo json_encode('Runty: User not authenticated.')
die();
}
} else {
echo json_encode('Runty: User not authenticated.')
die();
}

/**
* Easy example script to store uploaded files
Expand Down
11 changes: 10 additions & 1 deletion runty/app/upload.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<?php
require_once 'core.php';

//include_once './vendor/Markdown.php';
if (isset($_SESSION['user']->role)) {
if ($_SESSION['user']->role != 'admin' || $_SESSION['user']->role != 'editor') {
echo json_encode('Runty: User not authenticated.')
die();
}
} else {
echo json_encode('Runty: User not authenticated.')
die();
}

spl_autoload_register(function($class){
require './vendor/'.preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php';
Expand Down

0 comments on commit 47f7a91

Please sign in to comment.