free_sql ( $sql ); } /* ---------------------------------------------------------------------- 02.06.2022 Получаем информацию о пользователе ---------------------------------------------------------------------- */ function get_user_info(){ $a['id'] = $_SESSION['user_id']; return $this -> get_massiv( 'users', $a, 'json'); } function get_user_option(){ $a['user_id'] = $_SESSION['user_id']; return $this -> get_massiv( 'userOption', $a); } function formatBytes( $bytes, $precision = 2 ) { $units = array( 'B', 'KB', 'MB', 'GB', 'TB' ); $bytes = max( $bytes, 0 ); $pow = floor( ( $bytes ? log ( $bytes ) : 0 ) / log( 1024 ) ); $pow = min ( $pow, count( $units ) - 1 ); return round ( $bytes, $precision ) . ' ' . $units[$pow]; } /* ---------------------------------------------------------------------- 09.06.2022 Получаем историю заказов ---------------------------------------------------------------------- */ function get_orders( $limit=20 ){ $a['user_id'] = $_SESSION['user_id']; $this -> or_by_desc = 1; $orders = $this -> get_massiv( 'order', $a, 'id', $limit ); unset( $db -> or_by_desc ); $count = count($orders); for ($i=0; $i < $count; $i++){ $orders[$i]['t']=date("H:i d.m.Y", $orders[$i]['t']); unset($a); $a['id']=$orders[$i]['status']; $orders[$i]['status']=$this->get_val('order_status', $a, 'txt'); } return $orders; } } ?>