Example #1
0
/** START SESSION */
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/config.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/database.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/utilities.php';
/** GET DATA FROM POST */
$_old_password = $_POST['old_password'];
$_new_password = $_POST['new_password'];
$_confirm_new_password = $_POST['confirm_new_password'];
$_response_items = array();
/** LOAD DB */
$db = new Database();
/** GET USER FROM DB */
$_user = $db->query('select * from sys_user where id=' . $_SESSION['user']['id'] . ' and password="******"');
/** IF USER EXIST */
if ($db->get_num_rows() > 0) {
    /** IF THE NEW PASSWORD IS CONFIRMED */
    if ($_new_password == $_confirm_new_password) {
        $data_update['password'] = md5($_new_password);
        $db->update('sys_user', array('column' => 'id', 'value' => $_user['id'], 'sign' => '='), $data_update);
        $db->close();
        $result = 'ok';
        $message = '<i class="fa fa-check"></i> New password saved';
        $icon = 'fa fa-thumbs-up bounce animated ';
        $color = '#659265';
        $title = 'Success';
    } else {
        $result = 'ko';
        $message = 'New password is not confirmed';
        $icon = 'fa fa-warning';
        $color = '#C46A69';
Example #2
0
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/config.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/utilities.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/database.php';
$start = $_REQUEST['start'];
$end = $_REQUEST['end'];
$mode = $_REQUEST['mode'];
$db = new Database();
$lasts = $db->query('SELECT * FROM (`sys_tasks`) WHERE `status` != "running" AND `user` = ' . $_SESSION['user']['id'] . ' ORDER BY `start_date` desc LIMIT ' . $start . ',' . $end);
$num_rows = $db->get_num_rows();
if ($num_rows == 0) {
    exit('');
}
if (!isset($lasts[0])) {
    $temp = array();
    $temp[0] = $lasts;
    $lasts = $temp;
}
$totalLasts = count($lasts);
$countLasts = 0;
?>

	<?php 
foreach ($lasts as $task) {
    ?>
		
Example #3
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/config.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/database.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/utilities.php';
/** LOAD DB */
$db = new Database();
/** GET ALL RUNNING TASKS */
$_tasks = $db->query('select * from sys_tasks where status="running"');
/** CLOSE DB CONNECTION */
$_tasks_number = $db->get_num_rows();
$db->close();
if ($_tasks_number == 0) {
    ?>
    
<!-- NOTHING TO SHOW -->
<div class="alert alert-transparent">
	<h4 class="text-center">No tasks available</h4>
</div>
<?php 
} else {
    ?>
<ul class="notification-body">
	
	<?php 
    if ($_tasks_number == 1) {
        $_temp = $_tasks;
        $_tasks = array();
        $_tasks[] = $_temp;
    }
    ?>
Example #4
0
/** SAVE POST PARAMETERS */
$_object_id = $_POST["id_object"];
$_printable = $_POST["printable"];
/** UTIL PARAMS */
$_printable_files[] = '.gc';
$_printable_files[] = '.gcode';
$_printable_files[] = '.nc';
/** LOAD DB */
$db = new Database();
/** LOAD OBJECE FROM DB */
$_object = $db->query("select * from sys_objects where id=" . $_object_id);
//$_object = $_object[0];
$_object['date_insert'] = mysql_to_human($_object['date_insert']);
$_object['date_updated'] = mysql_to_human($_object['date_updated']);
/** LOAD OBJECT'S FILES FROM DB */
$_object_files = $db->query("select * from sys_obj_files where id_obj=" . $_object_id);
if ($db->get_num_rows() == 1) {
    $temp = $_object_files;
    $_object_files = array();
    $_object_files[] = $temp;
}
$_files = array();
foreach ($_object_files as $_obj) {
    $_temp = $db->query("select * from sys_files where id=" . $_obj['id_file']);
    if (isset($_temp)) {
        $_files[$_temp['id']] = $_temp;
    }
}
$db->close();
/** RESPONSE */
echo minify(json_encode(array('object' => $_object, 'files' => array('number' => count($_files), 'data' => $_files))));