PHP Classes

File: uploady/admin/logic/mapChart.php

Recommend this page to a friend!
  Classes of Faris AL-Otabi   Uploady PHP Upload File to MySQL   uploady/admin/logic/mapChart.php   Download  
File: uploady/admin/logic/mapChart.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Uploady PHP Upload File to MySQL
Store file upload details in a MySQL database
Author: By
Last change: Update of uploady/admin/logic/mapChart.php
Date: 4 months ago
Size: 847 bytes
 

Contents

Class file image Download
<?php
header
("Content-Type: application/json");
require_once
'../session.php';

$counter = new Uploady\Handler\UploadHandler($db, $utils);

$files = $counter->getFiles();

$countries = $counter->getCountries();
$arrays = [];

$list = [];

$uploaded_files = [];

foreach (
$files as $file) {
   
$f = json_decode($file->user_data, true);
   
array_push($arrays, $f);
}

foreach (
$countries as $country_code => $country) {
   
array_push($list, [
       
"id" => $country_code,
       
"value" => 0,
    ]);
}

foreach (
$arrays as $array) {
    foreach (
$array as $key => $value) {
        if (
$key == "country") {
            foreach (
$list as $key => $country) {
                if (
$country["id"] == $value) {
                   
$list[$key]["value"]++;
                }
            }
        }
    }
}

echo
json_encode(["countries" => $list]);