-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeToolStatus.php
More file actions
23 lines (16 loc) · 1012 Bytes
/
changeToolStatus.php
File metadata and controls
23 lines (16 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
require "../phplib/genlibraries.php";
require "../phplib/admin.inc.php";
$data = $GLOBALS['toolsDevMetaCol']->findOne(array('_id' => $_REQUEST['toolid']));
if(!isset($data)) {
$_SESSION['errorData']['Error'][] = "Tool id unexisting.";
redirect($GLOBALS['BASEURL'].'admin/myNewTools.php?id='.$_REQUEST['toolid']);
}
if($data["user_id"] != $_SESSION["User"]["id"] && ($_SESSION['User']['Type'] != 0)) {
$_SESSION['errorData']['Error'][] = "The tool id <strong>".$_REQUEST['toolid']."</strong> you are trying to edit doesn't belong to you.";
redirect($GLOBALS['BASEURL'].'admin/myNewTools.php');
}
$GLOBALS['toolsDevMetaCol']->update(array('_id' => $_REQUEST['toolid']),
array('$set' => array('last_status_date' => date('Y/m/d H:i:s'), 'last_status' => $_REQUEST['status'])));
$_SESSION['errorData']['Info'][] = "Status for tool <strong>".$_REQUEST['toolid']."</strong> successfully changed to <strong>".$_REQUEST['status']."</strong>.";
redirect($GLOBALS['BASEURL'].'admin/myNewTools.php');