Sign in to follow this  
ITalianBadBoy

Crossout Tool Price And Material Calculator

Recommended Posts

Crossout Tool Price And Material Calculator

Hello! The Italian community is happy to present a new tool for to calculate the prices and the materials required for crafting: Crossout Calculator

iWZPcgt.jpg

Charts:

Spoiler

 

nlmswU1.png

 

ppcViwu.png

 

 

It's very simple and quickly to use! This tool can:

  • Automatically update the raw materials prices with the latest market data. (5 minute interval)
  • Allows the customization of raw material prices and the number of material and modules already owned.

  • Calculate the required and / or remaining materials and their cost.

  • Calculate the unit valour regardless of the objects owned.

  • Calculate the earnings, the profits and the minimum selling price.

  • Calculate the prices related to the work benches used and to the speeding process.

  • View the historical charts for the: Scrap,  Copper,  Wires,  Electronics and for the Unit Valour.

  • Allows you to save and load the last calculated setting.

  • The informations are saved with AES (Advanced Encryption Standard) and the relative SHA-3 (Secure Hash Algorithm).

  • It has a responsive layout that adapts to the size of the screen, allowing the easy reading from mobile and tablet.

 

It's recommended the use of Firefox or Chrome for the correct page display.

The service is based on a free hosting with various protections against malicious attacks guaranteeing an unlimited, stable and fast service.

Any positive or negative criticism is welcome. Any proposal for to improve the service will also be considered for the implementation.

In case of problems delete the temporary files and if it should persist write it here. I'll fix it as soon as possible.

 

Thanks for your attention, kind regards from the FDG corporation!

 

Updates:

  • 27/01/2018 - Improved the images for the web viewing, the API's PHP code and fixed a bug with the horizontal scroll bar in the mobile view.
  • 02/02/2018 - Implemented the saving of temporary files, the management and the printing of the historical chart and improved the JavaScript and the PHP code.
  • 04/02/2018 - Implemented the printing of the historical charts for the: Scraps, Coppers, Wires and Electronics. Improved some details of the CSS.
  • 05/02/2018 - Fixed a bug with the time of the graphs, added the "Interval" setting and the icon in full-screen graphs, added the "Reset Price" button.

 

Spoiler

I personally wrote HTML, CSS, PHP and JavaScript.

Tools used:

Tester tools:

Edited by ITalianBadBoy
  • Like 1
  • Thanks 3
  • Upvote 5

Share this post


Link to post
Share on other sites

Updates 02/02/2018:

  • Implemented the saving of temporary files:

For to reduce the stress on the database and improve response times during multiple accesses the data provided by the database are saved and reused for a time equal to the update times.

(5 minutes for the raw material prices - 1 hour for the data used for to print the chart)

 

  • The management and printing of the historical chart:

Added the historical graph that represents the trend of the unit valour of the type of the selected module.

The sampling interval of the data is 1 hour and it is possible to choose the displayed interval. (the last: 24 Hours, 7Days or 30Days)

By clicking on the graph you can view it in full screen.

 

  • Improved the JavaScript and the PHP code.
Edited by ITalianBadBoy

Share this post


Link to post
Share on other sites

Great calculator! May I ask one simple addition? For example I have a lot of, let's say, wires and I want some weapon/device. Of course I'm thinking: to buy or to make? Can you add extra window which will show how much wires I need in the first case (sell wires->buy weapon) and in the second case (sell part of wires->buy other resources and rent workbench->make the weapon)?

  • Upvote 1

Share this post


Link to post
Share on other sites
On 10/2/2018 at 2:10 AM, freshIL said:

Of course I'm thinking: to buy or to make?

Now It's a generic calculator. For to answer at this question I have to implement the price management related to the chosen module, it will be done. ;)

 

On 10/2/2018 at 2:10 AM, freshIL said:

Can you add extra window which will show how much wires I need in the first case (sell wires->buy weapon) and in the second case (sell part of wires->buy other resources and rent workbench->make the weapon)?

Yes, it is possible. A table that shows: the profit from the sale of excess materials, the number of modules that can be purchased with that profit and/or the relative number of materials to be purchased for to craft the module.

 

Thanks for the advice, I think that I will release this update for the end of the month :3

(At the moment I have some work to do)

Edited by ITalianBadBoy

Share this post


Link to post
Share on other sites

Pls checkout my posts (I need a clan too)

Share this post


Link to post
Share on other sites

You have made a lovely tool, @ITalianBadBoyI see it takes actually the input from "Resources Price" fields, so it is usable for all platforms, as long as the user supplies the resource price manually.

I have one small remark though: Scrap and Copper are “uncountable nouns”, they have no plural, so it is always Scrap and Copper, no matter the quantity:

https://www.englishclub.com/grammar/nouns-countable-un.htm

(like rice, sugar, butter, water in that article)

I am a second language speaker too.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Zicore it's an HTML page, it is already open source.

For to see the code with Chrome: Right click on the page -> Inspects -> Debugger

The files written by me are: index.html, core.js and  api.php (click on the {} button for the "Pretty Print")

The file that is not visible is api.php.

index.html:

Spoiler
<!DOCTYPE html>
<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Crossout Price Calculator</title>
  <meta name="author" content="ItalianBadBoy">
  <meta name="description" content="">
  <link rel="stylesheet" href="http://it4ly.altervista.org/w3s/w3.css">
  <style>
    html {overflow: auto}
    body {
      color:white; text-align: center;
      font-family: "Exo 2", sans-serif;
      background-image:url("img/wall_1920x1080_3.jpg");
      background-position:center center; background-size:cover;
      background-repeat:no-repeat; background-attachment:fixed;
      text-shadow:1px 1px 3px black
    }
    fieldset {
      min-width:500px; max-width:500px; border:outset; border-radius:16px;
      background-color:rgba(0,0,0,0.8); text-align: center;
      font-size:15px; margin:10px auto
    }
    legend {font-weight:bold; font-size:medium; padding:4px 8px}
    input[type="radio"], input[type="checkbox"] {cursor:pointer;vertical-align:middle;top:0px;margin: auto;}
    input[type="text"], button {height:40px; border-radius:16px; font-weight:bold}
	  table {max-width:500px;margin: auto;}
    table th, table td {vertical-align:middle!important; padding:5px 3px!important; height: 36px}
    table p {text-shadow:1px 1px 3px black; font-size:16px; margin:5px 0}
    a:link {color:#43B8D5; background-color:transparent; text-decoration:none}
    a:visited {color:#b300b3; background-color:transparent; text-decoration:none}
    a:hover {color:white; background-color:transparent; text-decoration:underline}
    a:active {color:yellow; background-color:transparent; text-decoration:underline}
    header div.Shadow {width: 100%;height: 100%;box-shadow: inset 0 1px rgba(255, 255, 255, .3), inset 0 10px rgba(255, 255, 255, .2), inset 0 10px 20px rgba(255, 255, 255, .25), inset 0 -15px 30px rgba(0, 0, 0, .4);border-radius: 50px;}
    label {cursor:pointer;font-weight:bold;}
    fieldset.Rarity p {margin-top:-15px;margin-bottom:5px}
    img.rarity {width: 137px;height: 82px}
    img.coin {width:13px;height:13px;vertical-align:middle;margin-bottom: 3px;margin-left:3px}
    img.resource {width:48px;height:48px}
	  table.WorkLine td {display: inline-flex}
	  table.WorkLine p {height:25px;margin:auto;padding:0 4px}
	  table.WorkLine input {width: 45px;padding: 4px;text-align: center;height:30px}
	  table.WorkLine i {margin:auto;padding-right:5px;padding-top:3px}
	  fieldset.speedup table td label {margin-right:5px;}
	  fieldset.speedup table td img {margin-right:5px;margin-top:-1px;}
	  fieldset.speedup table td input {margin-top:-4px;margin-left:-6px;}
	  table.Workbench input[type="radio"] {right: -10px;}
  </style>
  <style>#iubenda-cs-banner{top:0!important;left:0!important;position:fixed!important;width:100%!important;z-index:99999998!important;background:#000;background:rgba(0,0,0,.85)}.iubenda-cs-content{display:block;margin:0 auto;padding:10px 50px 10px 20px;width:auto;font-family:Helvetica,Arial,FreeSans,sans-serif;font-size:12px;color:#fff!important}.iubenda-cs-rationale{max-width:900px;position:relative;margin:0 auto}.iubenda-banner-content>p{font-family:Helvetica,Arial,FreeSans,sans-serif;line-height:1.5}.iubenda-cs-close-btn{color:#fff!important;text-decoration:none;font-size:12px;position:absolute;top:-5px;right:-20px;border:1px solid #fff!important;display:inline-block;width:20px;height:20px;line-height:20px;text-align:center;border-radius:10px}.iubenda-cs-cookie-policy-lnk{text-decoration:underline;color:#fff!important;font-size:12px;font-weight:900}</style>
  <script>/*<![CDATA[*/
    var _iub = _iub || [];
    _iub.csConfiguration = {
      siteId: 864509, cookiePolicyId: 8174482, lang: 'it', localConsentDomain: 'it4ly.altervista.org',
      banner: { applyStyles: false, content: "Questo sito utilizza cookie di terze parti per inviarti pubblicità in linea con le tue preferenze. Se vuoi saperne di più o negare il consenso a tutti o ad alcuni cookie, %{cookie_policy_link}. Chiudendo questo banner, scorrendo questa pagina, cliccando su un link o proseguendo la navigazione in altra maniera, acconsenti all'uso dei cookie.", cookiePolicyLinkCaption: "clicca qui"}
    };
    (function (w, d) {
      var loader = function () { var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/cookie_solution/iubenda_cs.js"; tag.parentNode.insertBefore(s, tag); };
      if (w.addEventListener) { w.addEventListener("load", loader, false); } else if (w.attachEvent) { w.attachEvent("onload", loader); } else { w.onload = loader; }
    })(window, document);
  /*]]>*/</script>
</head>
<body>
  <script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-82751931-3', 'auto');
    ga('send', 'pageview');
  </script>
  <div class="w3-container">
    <header class="w3-display-container w3-content w3-section" style="min-width:500px">
      <img class="w3-image" src="img/wall_1920x1080.jpg" alt="Header" style="border-radius: 50px;border: 2px solid rgba(0, 0, 33, 0.5);width:100%;height:100%;max-height: 315px">
      <img class="w3-image w3-display-middle" src="img/crossout_logo1.png" alt="Star Conflict" style="max-height: 188px">
      <div class="w3-display-middle Shadow" style="width:100%;height:100%;max-height: 315px"></div>
    </header>
  </div>
  <div class="w3-container w3-row">
    <div class="w3-col l6 w3-center">
      <fieldset class="Rarity">
        <legend>Rarity</legend>
        <div class="w3-cell-row">
          <div class="w3-cell w3-cell-middle" style="width:100px">
            <label  id="ThQuantity_0" style="cursor:default !important">How many:</label>
          </div>
          <div class="w3-cell" style="width:200px">
            <input id="InQuantity_0" class="w3-input" type="text" value="1" oninput="DoLyt('SetWLine-1')" onclick="this.select()">
          </div>
        </div>
        <div class="w3-row-padding w3-section">
          <div class="w3-col s4 w3-center" style="display:grid">
            <label class="w3-padding-small" for="Rarity_0"><img src="img/Rare.jpg" class="rarity" alt="Rare"></label>
            <label class="w3-padding-small" for="Rarity_0" style="color:#06c">Rare</label>
            <input name="Rarity" id="Rarity_0" class="w3-radio" onclick="DoLyt('SwitchLayout')" type="radio" checked>
          </div>
          <div class="w3-col s4 w3-center" style="display:grid">
            <label class="w3-padding-small" for="Rarity_1"><img src="img/Epic.jpg" class="rarity" alt="Epic"></label>
            <label class="w3-padding-small" for="Rarity_1" style="color:#b900ff">Epic</label>
            <input name="Rarity" id="Rarity_1" class="w3-radio" onclick="DoLyt('SwitchLayout')" type="radio">
          </div>
          <div class="w3-col s4 w3-center" style="display:grid">
            <label class="w3-padding-small" for="Rarity_2"><img src="img/Legend.jpg" class="rarity" alt="Legendary"></label>
            <label class="w3-padding-small" for="Rarity_2" style="color:#ffa040">Legendary</label>
            <input name="Rarity" id="Rarity_2" class="w3-radio" onclick="DoLyt('SwitchLayout')" type="radio">
          </div>
        </div>
        <table class="w3-table w3-centered WorkLine">
          <tr>
            <td>
              <input id="InWLine_0" class="w3-input" type="text" oninput="DoLyt('SetWLine0')" onclick="this.select()">
              <p id="ThWLine_0" style="color:#d2d2d2">Common</p>
            </td>
            <td style="width: 104px;">
              <i class="fa fa-long-arrow-right"></i>
              <input id="InWLine_1" class="w3-input" type="text" oninput="DoLyt('SetWLine1')" onclick="this.select()">
              <p id="ThWLine_1" style="color:#06c">Rare</p>
            </td>
            <td class="epic" style="width: 100px;">
              <i class="fa fa-long-arrow-right"></i>
              <input id="InWLine_2" class="w3-input" type="text" oninput="DoLyt('SetWLine2')" onclick="this.select()">
              <p id="ThWLine_2" style="color:#b900ff">Epic</p>
            </td>
            <td class="legendary">
              <i class="fa fa-long-arrow-right"></i>
              <input id="InWLine_3" class="w3-input" type="text" oninput="DoLyt('SetWLine3')" onclick="this.select()">
              <p id="ThWLine_3" style="color:#ffa040">Legend.</p>
            </td>
          </tr>
        </table>
      </fieldset>
    </div>
    <div class="w3-col l6 w3-center">
      <fieldset>
        <legend>Workbench</legend>
        <table class="w3-table w3-centered Workbench">
          <tr>
            <th style="color:#06c">Rare:</th>
            <td><input name="Work_Rare" id="Work_00" class="w3-radio" onclick="Start('calcedit')" type="radio" checked></td>
            <td><label for="Work_00">5 - 25</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Rare" id="Work_01" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_01">10 - 47.50</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Rare" id="Work_02" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_02">15 - 67.50</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr class="epic">
            <th style="color:#b900ff">Epic:</th>
            <td><input name="Work_Epic" id="Work_10" class="w3-radio" onclick="Start('calcedit')" type="radio" checked></td>
            <td><label for="Work_10">5 - 100</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Epic" id="Work_11" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_11">10 - 190</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Epic" id="Work_12" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_12">15 - 270</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr class="legendary">
            <th style="color:#ffa040">Legendary:</th>
            <td><input name="Work_Legendary" id="Work_20" class="w3-radio" onclick="Start('calcedit')" type="radio" checked></td>
            <td><label for="Work_20">5 - 400</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Legendary" id="Work_21" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_21">10 - 760</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><input name="Work_Legendary" id="Work_22" class="w3-radio" onclick="Start('calcedit')" type="radio"></td>
            <td><label for="Work_22">15 - 1080</label><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
        </table>
      </fieldset>
      <fieldset class="speedup">
        <legend>Speed Up</legend>
          <table class="w3-table w3-centered">
            <tr>
              <td>
                <label for="SpeedUp_0" style="color:#06c">Rare:</label>
                <input id="SpeedUp_0" type="checkbox" name="Speed" onclick="Start('calcedit')">
                <label for="SpeedUp_0">1H - 5</label>
                <img src="img/Coin.png" class="coin" alt="Coin">
              </td>
              <td class="epic">
                <label for="SpeedUp_1" style="color:#b900ff">Epic:</label>
                <input id="SpeedUp_1" type="checkbox" name="Speed" onclick="Start('calcedit')">
                <label for="SpeedUp_1">6H - 20</label>
                <img src="img/Coin.png" class="coin" alt="Coin">
              </td>
              <td class="legendary">
                <label for="SpeedUp_2" style="color:#ffa040">Legend.:</label>
                <input id="SpeedUp_2" type="checkbox" name="Speed" onclick="Start('calcedit')">
                <label for="SpeedUp_2">21H - 80</label>
                <img src="img/Coin.png" class="coin" alt="Coin">
              </td>
            </tr>
          </table>
      </fieldset>
      <fieldset>
        <legend>Chart</legend>
          <table class="w3-table w3-centered">
            <tr>
              <th>
                Interval:
              </th>
              <td>
                <input name="Interval" id="Interval_00" class="w3-radio" onclick="Start('modulechart')" type="radio" checked>
                <label for="Interval_00">1 Day</label>
              </td>
              <td>
                <input name="Interval" id="Interval_01" class="w3-radio" onclick="Start('modulechart')" type="radio">
                <label for="Interval_01">7 Days</label>
              </td>
              <td>
                <input name="Interval" id="Interval_02" class="w3-radio" onclick="Start('modulechart')" type="radio">
                <label for="Interval_02">30 Days</label>
              </td>
            </tr>
          </table>
      </fieldset>
    </div>
  </div>
  <div class="w3-container w3-row">
    <div class="w3-col l6 w3-center">
      <fieldset>
        <legend>Resources Price</legend>
        <table class="w3-table w3-centered">
          <tr>
            <td><img src="img/Common.jpg" class="resource" alt="Commons"></td>
            <th id="ThPrice_0">Commons x1:</th>
            <td><input id="InPrice_0" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td></td>
          </tr>
          <tr>
            <td><img src="img/Scrap.jpg" class="resource" alt="Scraps"></td>
            <th id="ThPrice_1">Scrap x100:</th>
            <td><input id="InPrice_1" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><i class="fa fa-line-chart" style="font-size:24px;cursor:pointer" onclick="Start('scrapchart')"></i></td>
          </tr>
          <tr>
            <td><img src="img/Copper.jpg" class="resource" alt="Coppers"></td>
            <th id="ThPrice_2">Copper x10:</th>
            <td><input id="InPrice_2" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><i class="fa fa-line-chart" style="font-size:24px;cursor:pointer" onclick="Start('copperchart')"></i></td>
          </tr>
          <tr class="epic">
            <td><img src="img/Wire.jpg" class="resource" alt="Wires"></td>
            <th id="ThPrice_3">Wires x10:</th>
            <td><input id="InPrice_3" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><i class="fa fa-line-chart" style="font-size:24px;cursor:pointer" onclick="Start('wirechart')"></i></td>
          </tr>
          <tr class="legendary">
            <td><img src="img/Electronic.jpg" class="resource" alt="Electronics"></td>
            <th id="ThPrice_4">Electronics x10:</th>
            <td><input id="InPrice_4" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td><i class="fa fa-line-chart" style="font-size:24px;cursor:pointer" onclick="Start('electronicchart')"></i></td>
          </tr>
        </table>
      </fieldset>
    </div>
    <div class="w3-col l6 w3-center">
      <fieldset>
        <legend>Resources Owned</legend>
        <table class="w3-table w3-centered">
          <tr>
            <td><img src="img/Common.jpg" class="resource" alt="Commons"></td>
            <th id="ThOwned_0">Commons:</th>
            <td><input id="InOwned_0" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
          </tr>
          <tr>
            <td><img src="img/Scrap.jpg" class="resource" alt="Scraps"></td>
            <th id="ThOwned_1">Scrap:</th>
            <td><input id="InOwned_1" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
          </tr>
          <tr>
            <td><img src="img/Copper.jpg" class="resource" alt="Coppers"></td>
            <th id="ThOwned_2">Copper:</th>
            <td><input id="InOwned_2" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
          </tr>
          <tr class="epic">
            <td><img src="img/Wire.jpg" class="resource" alt="Wires"></td>
            <th id="ThOwned_3">Wires:</th>
            <td><input id="InOwned_3" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
          </tr>
          <tr class="legendary">
            <td><img src="img/Electronic.jpg" class="resource" alt="Electronics"></td>
            <th id="ThOwned_4">Electronics:</th>
            <td><input id="InOwned_4" class="w3-input" type="text" value="0" oninput="PrintTxt()"></td>
          </tr>
        </table>
      </fieldset>
    </div>
  </div>
  <div class="w3-container w3-row">
    <div class="w3-center">
      <fieldset>
        <table class="w3-table w3-centered">
          <tr>
            <td style="width:25%"><button class="w3-button w3-white" onclick="Start('calc')">Calculate</button></td>
            <td style="width:25%"><button class="w3-button w3-white" onclick="Start('save')">Save</button></td>
            <td style="width:25%"><button class="w3-button w3-white" onclick="Start('load')">Load</button></td>
            <td style="width:25%"><button class="w3-button w3-white" onclick="Start('resetprice')">Reset Price</button></td>
          </tr>
          <tr>
            <th>Info:</th>
            <td id="Info" colspan="2"></td>
          </tr>
        </table>
      </fieldset>
    </div>
  </div>
  <div id="modal" class="w3-modal" style="background-color: rgba(0,0,0,0.9);">
    <div class="w3-modal-content" style="width: 100%;height: 100%;min-width: 500px;background-color: transparent !important;">
      <table class="w3-table w3-centered" style="cursor:pointer" onclick="document.getElementById('modal').style.display='none'">
        <tr>
          <th rowspan="2" id="modal_icon"></th>
          <th>Min</th>
          <th>Max</th>
          <th>Average</th>
        </tr>
        <tr>
          <td id="modal_Chart_0"></td>
          <td id="modal_Chart_1"></td>
          <td id="modal_Chart_2"></td>
        </tr>
      </table>
      <div id="modal_curve_chart" class="w3-centered" style="height: 80%;cursor:pointer" onclick="document.getElementById('modal').style.display='none'"><i class="fa fa-spinner fa-spin" style="font-size:48px;margin-top:70px"></i></div>
      <table class="w3-table w3-centered">
        <tr>
          <th>Interval:</th>
          <td>
            <input name="Interval1" id="Interval_10" class="w3-radio" onclick="Start('lastchart')" type="radio" checked>
            <label for="Interval_10">1 Day</label>
          </td>
          <td>
            <input name="Interval1" id="Interval_11" class="w3-radio" onclick="Start('lastchart')" type="radio">
            <label for="Interval_11">7 Days</label>
          </td>
          <td>
            <input name="Interval1" id="Interval_12" class="w3-radio" onclick="Start('lastchart')" type="radio">
            <label for="Interval_12">30 Days</label>
          </td>
        </tr>
      </table>
    </div>
  </div>
  <div class="w3-container w3-row">
    <div class="w3-col l6 w3-center">
      <fieldset class="need w3-hide">
        <legend>Resources Needed</legend>
        <table class="w3-table w3-centered">
          <tr>
            <th colspan="2">Resources</th>
            <th>Needed</th>
            <th colspan="2">Cost</th>
          </tr>
          <tr>
            <th style="width:48px"><img src="img/Common.jpg" class="resource" alt="Commons"></th>
            <th style="width:100px">Commons:</th>
            <td id="Need_00"></td>
            <td id="Need_10" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th><img src="img/Scrap.jpg" class="resource" alt="Scraps"></th>
            <th>Scrap:</th>
            <td id="Need_01"></td>
            <td id="Need_11" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th><img src="img/Copper.jpg" class="resource" alt="Coppers"></th>
            <th>Copper:</th>
            <td id="Need_02"></td>
            <td id="Need_12" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr class="epic">
            <th><img src="img/Wire.jpg" class="resource" alt="Wires"></th>
            <th>Wires:</th>
            <td id="Need_03"></td>
            <td id="Need_13" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr class="legendary">
            <th><img src="img/Electronic.jpg" class="resource" alt="Electronics"></th>
            <th>Electronics:</th>
            <td id="Need_04"></td>
            <td id="Need_14" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th colspan="2">Workbench:</th>
            <td id="Need_05"></td>
            <td id="Need_15" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th colspan="2">Speed Up:</th>
            <td id="Need_06"></td>
            <td id="Need_16" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th></th>
            <th>Tot:</th>
            <td id="Need_07"></td>
            <td id="Need_17" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
        </table>
      </fieldset>
    </div>
    <div class="w3-col l6 w3-center">
      <fieldset class="profit w3-hide">
        <legend>Profit</legend>
        <table class="w3-table w3-centered">
          <tr>
            <th>Unit Valour:</th>
            <td id="Profit_0"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <th id="ThQuantity_1">Selling one for:</th>
            <td style="width: 130px"><input id="InQuantity_1" class="w3-input" type="text" value="0" oninput="Start('profit')" onclick="this.select()"></td>
            <td><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
        </table>
        <table class="w3-table w3-centered">
          <tr>
            <th colspan="2">Selling Gain</th>
            <th colspan="2">Production Cost</th>
            <th colspan="2">Tax 10%</th>
            <th colspan="2">Profit</th>
            <th colspan="2">Actual Profit</th>
          </tr>
          <tr>
            <td id="Profit_1" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td id="Profit_2" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td id="Profit_3" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td id="Profit_4" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
            <td id="Profit_5" style="text-align:right !important"></td>
            <td style="text-align:left !important"><img src="img/Coin.png" class="coin" alt="Coin"></td>
          </tr>
          <tr>
            <th>Info:</th>
            <td id="InfoP" colspan="9"></td>
          </tr>
        </table>
      </fieldset>
      <fieldset class="profit w3-hide">
        <legend>Chart</legend>
        <table class="w3-table w3-centered">
          <tr>
            <th>Min</th>
            <th>Max</th>
            <th>Average</th>
          </tr>
          <tr>
            <td id="Chart_0"></td>
            <td id="Chart_1"></td>
            <td id="Chart_2"></td>
          </tr>
        </table>
        <div id="curve_chart" class="w3-centered" style="width:475px;height:250px;cursor:pointer;" onclick="Start('modalchart')"><i class="fa fa-spinner fa-spin" style="font-size:48px;margin-top:70px"></i></div>
      </fieldset>
    </div>
  </div>
  <div class="w3-container">
    <fieldset style="max-width:550px!important">
      <legend>Info:</legend>
      <p>We recommend the use of <a href="https://www.mozilla.org/en-US/firefox/products/" rel="nofollow" target="_blank">Firefox</a> or <a href="https://www.google.it/chrome/browser/desktop/index.html" rel="nofollow" target="_blank">Chrome</a> for the correct page display.</p>
      <p>You can find updates or give us advice on the <a href="https://forum.crossout.net/index.php?/topic/282819-crossout-tool-price-and-material-calculator/" target="_blank">English</a> forums.</p>
      <p>We use Google <a href="https://analytics.google.com/" rel="nofollow" target="_blank">Universal Analytics</a> for to improve the service.</p>
      <a href="//www.iubenda.com/privacy-policy/8174482" class="iubenda-white no-brand iubenda-embed" title="Privacy Policy" rel="nofollow" target="_blank">Privacy Policy</a><script>(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src = "//cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document);</script>
    </fieldset>
  </div>
  <div class="w3-container">
    <script>
      /* <![CDATA[ */
      document.write('<s'+'cript type="text/javascript" src="http://ad.altervista.org/js.ad/size=728X90/?ref='+encodeURIComponent(location.hostname+location.pathname)+'&r='+new Date().getTime()+'"></s'+'cript>');
      /* ]]> */
    </script>
  </div>
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Exo+2">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <script src="https://www.gstatic.com/charts/loader.js"></script>
  <script src='http://it4ly.altervista.org/crypt/aes.js'></script>
  <script src='http://it4ly.altervista.org/crypt/sha3.js'></script>
  <script src='http://it4ly.altervista.org/w3s/w3.js'></script>
  <script src="core.js" defer></script>
</body>
</html>

 

 

core.js:

Spoiler
 "use strict";

function PrintTxt(){
  document.getElementById("Info").innerHTML = 'Input changed,  press "Calculate" for to apply!';
  document.getElementById("Info").style.color = "rgb(255, 191, 0)";
  return;
}

/*Closures Start*/
var DoLyt = (function (Set) {

var set = 0, common = 0, rare = 0, epic = 0, legendary = 0;

return function (Set) {return Main(Set);

function Main(Set) {
  switch(Set) {
    case "SwitchLayout": SwitchLayout(); break;
    case "SetWLine-1": SetWLine(-1); break;
    case "SetWLine0": SetWLine(0); break;
    case "SetWLine1": SetWLine(1); break;
    case "SetWLine2": SetWLine(2); break;
    case "SetWLine3": SetWLine(3);
  }
  return;
}

function SwitchLayout(){
  var i;

  for(i = 0; i < 3; i++) if(document.getElementById("Rarity_"+i).checked) set=i;
  switch(set) {
    case 0:
      document.getElementById("Rarity_0").checked = true;
      w3.addClass(".epic","w3-hide");
      w3.removeClass(".epic","w3-animate-zoom");
      w3.addClass(".legendary","w3-hide");
      w3.removeClass(".legendary","w3-animate-zoom");
      break;
    case 1:
      w3.removeClass(".epic","w3-hide");
      w3.addClass(".epic","w3-animate-zoom");
      w3.addClass(".legendary","w3-hide");
      w3.removeClass(".legendary","w3-animate-zoom");
      break;
    case 2:
      w3.removeClass(".epic","w3-hide");
      w3.addClass(".epic","w3-animate-zoom");
      w3.removeClass(".legendary","w3-hide");
      w3.addClass(".legendary","w3-animate-zoom");
  }
  SetWLine(-1);
  return;
}

function SetWLine(Mode) {
  var i, input, temp;

  PrintTxt();
  input = Test("Quantity_0");
  if(input != false) {
    switch(Mode){
      case -1:
        switch(set){
          case 0: Rare(input); break;
          case 1: Epic(input); break;
          case 2: Legendary(input);
        }
        break;
      case 0:
        temp = Test("WLine_0");
        if(temp == false) return;
        else if(temp > rare * 7) temp = rare * 7;
        Common(temp);
        break;
      case 1:
        temp = Test("WLine_1");
        if(temp == false) return;
        else if(set != Mode - 1) if(temp > epic * 6) temp = epic * 6;
        Rare(temp);
        break;
      case 2:
        temp = Test("WLine_2");
        if(temp == false) return;
        else if(set != Mode - 1) if(temp > legendary * 5) temp = legendary * 5;
        Epic(temp);
        break;
      case 3:
        temp = Test("WLine_3");
        if(temp == false) return;
        Legendary(temp);
    }
    if(set == Mode - 1) document.getElementById("InQuantity_0").value = temp;
  }

  function Common(N){
    common = N;
    document.getElementById("InWLine_0").value = common;
    document.getElementById("ThWLine_0").style.color = "#d2d2d2";
	return;
  }
  function Rare(N){
    rare = N;
    document.getElementById("InWLine_1").value = rare;
    document.getElementById("ThWLine_1").style.color = "#06c";
    Common(7 * N);
    return;
  }
  function Epic(N){
    epic = N;
    document.getElementById("InWLine_2").value = epic;
    document.getElementById("ThWLine_2").style.color = "#b900ff";
    Rare(6 * N);
    return;
  }
  function Legendary(N){
    legendary = N;
    document.getElementById("InWLine_3").value = legendary;
    document.getElementById("ThWLine_3").style.color = "#ffa040";
    Epic(5 * N);
    return;
  }

  return;
}

function Test(id) {
  var i, intxt = document.getElementById("In" + id), input = intxt.value.replace(/[^\d,.-]/g, "").replace(/,/g, "."), Info = document.getElementById("Info");
  intxt.value = input;
  try {
    if(input == "") throw "empty";
    input = Number(input);
    if(isNaN(input)) throw "not a number";
    if(input < 0) throw "negative";
    if(!Number.isInteger(input)) throw "not an integer";
    if(input == 0) throw "0, not valid";
  } catch(err) {
    Info.innerHTML = "The input is " + err + "!";
    Info.style.color = "red";
    document.getElementById("Th" + id).style.color = "red";
    if (id == "Quantity_0") for (i = 0; i < 4; i++) document.getElementById("InWLine_" + i).value = "";
    return false;
  }
  document.getElementById("Th" + id).style.color = "";
  return input;
}

/*Closures End*/
}})();

/*Closures Start*/
var Start = (function (Set) {

var Mode = 0, OriginalPrice = [0,0,0,0,0], History = false, Started = false, LastChart = false,
    Info = document.getElementById("Info"), Temp,
    Workbench = {Rare:0, Epic:0, Legend:0, Name:["Rare", "Epic", "Legend"]},
    SpeedUp = [false,false,false],
    Interval = 0,
    InData = {
      Quantity:[1], Price:[0,0,0,0,0,0,0], Owned:[0,0,0,0,0,0,0], WLine:[7,1,0,0],
      Name:["Quantity","Price","Owned","WLine"],
      Len: {
        Quantity:1,
        Price:5,
        Owned:5,
        WLine:4
      }
    },
    Resources = {
      Commons:[0,0],
      Scraps:[0,0],
      Coppers:[0,0],
      Wires:[0,0],
      Electronics:[0,0],
      Workbench:[0,0],
      SpeedUp:[0,0],
      Tot:[0,0],
      UnitCost:0,
      Name:["Commons", "Scraps", "Coppers", "Wires", "Electronics", "Workbench", "SpeedUp", "Tot"]
    };

return function (Set) {return Start(Set);
	
function Start(Set){
  switch(Set) {
    case "calc": Main(); Profit(); if(History != false) PrintChart("module"); break;
    case "save": SaveData("InData"); break;
    case "load": if(LoadData("InData")) {Main(); Profit(); if(History != false) PrintChart("module");} break;
    case "reset": Reset(true); break;
    case "resetprice": ResetPrice(); break;
    case "profit": Profit(); break;
    case "getprice": if(!LoadData("RawMaterials")) GetData("rawmaterials"); break;
    case "gethistory": if(!LoadData("History")) GetData("history"); break;
    case "calcedit": if(Started) {Main(); Profit(); if(History != false) PrintChart("module");} break;
    case "modulechart": PrintChart("module"); break;
    case "modalchart": PrintChart("modalmodule"); break;
    case "scrapchart": PrintChart("scrap"); break;
    case "copperchart": PrintChart("copper"); break;
    case "wirechart": PrintChart("wire"); break;
    case "electronicchart": PrintChart("electronic"); break;
    case "lastchart": PrintChart("last"); if(Started) {Temp = LastChart; PrintChart("module"); LastChart = Temp;}
  }
  return;
}

function Main(){
  Reset(false);
  SetMode();
  if(TestInput()) Calculation();
  return;
}

function Reset(Hard){
  var i, j;

  document.getElementById("ThQuantity_0").style.color = "";
  for(i = 0; i < 8; i++) {
    document.getElementById("Need_0" + i).innerHTML = "";
	  document.getElementById("Need_1" + i).innerHTML = "";
  }
  for(i = 0; i < 5; i++) {
    document.getElementById("Profit_" + i).innerHTML = "";
    document.getElementById("Profit_" + i).style.color = "";
    document.getElementById("ThPrice_" + i).style.color = "";
    document.getElementById("ThOwned_" + i).style.color = "";
  }
  document.getElementById("Profit_5").innerHTML = "";
  document.getElementById("Profit_5").style.color = "";

  document.getElementById("ThWLine_0").style.color = "#d2d2d2";
  document.getElementById("ThWLine_1").style.color = "#06c";
  document.getElementById("ThWLine_2").style.color = "#b900ff";
  document.getElementById("ThWLine_3").style.color = "#ffa040";

  Info.style.color = "";
  Info.innerHTML = "";

  w3.addClass(".need","w3-hide");
  w3.removeClass(".need","w3-animate-zoom");
  w3.addClass(".profit","w3-hide");
  w3.removeClass(".profit","w3-animate-zoom");

  for(i = 0; i < 3; i++) SpeedUp[i] = document.getElementById("SpeedUp_" + i).checked;
  for(j = 0; j < InData.Name.length; j++) for(i = 0; i < InData.Len[InData.Name[j]]; i++) InData[InData.Name[j]][i] = 0;
  for(i = 0; i < Resources.Name.length; i++) {
    Resources[Resources.Name[i]][0] = 0;
    Resources[Resources.Name[i]][1] = 0;
  }
  Resources.UnitCost = 0;
  for(i = 0; i < 3; i++) Workbench[Workbench.Name[i]] = 0;

  Started = false;
  if(Hard) {
    Mode = 0; OriginalPrice = [0,0,0,0,0]; History = false; Started = false; LastChart = false;
    Info = document.getElementById("Info"); Temp = "";
    Workbench = {Rare:0, Epic:0, Legend:0, Name:["Rare", "Epic", "Legend"]};
    SpeedUp = [false,false,false];
    Interval = 0;
    InData = {
      Quantity:[1], Price:[0,0,0,0,0,0,0], Owned:[0,0,0,0,0,0,0], WLine:[7,1,0,0],
      Name:["Quantity","Price","Owned","WLine"],
      Len: {
        Quantity:1,
        Price:5,
        Owned:5,
        WLine:4
      }
    };
    Resources = {
      Commons:[0,0],
      Scraps:[0,0],
      Coppers:[0,0],
      Wires:[0,0],
      Electronics:[0,0],
      Workbench:[0,0],
      SpeedUp:[0,0],
      Tot:[0,0],
      UnitCost:0,
      Name:["Commons", "Scraps", "Coppers", "Wires", "Electronics", "Workbench", "SpeedUp", "Tot"]
    };
    document.getElementById("InQuantity_0").value = 1;
    for(i = 0; i < 5; i++) {
      document.getElementById("InOwned_" + i).value = 0;
    }
    for(i = 0; i < 3; i++) {
      document.getElementById("Work_" + i + "0").checked = true;
      document.getElementById("SpeedUp_" + i).checked = false;
    }
    document.getElementById("Interval_00").checked = true;
    document.getElementById("Interval_10").checked = true;
    document.getElementById("Rarity_0").checked = true;
  }
  return;
}

function SetMode(){
  var i, j;

  Mode = 0;
  for(i = 0; i < 3; i++) if(document.getElementById("Rarity_" + i).checked) Mode += i;
  switch(Mode) {
    case 0:
      document.getElementById("Rarity_0").checked = true;
      w3.addClass(".epic","w3-hide");
      w3.removeClass(".epic","w3-animate-zoom");
      w3.addClass(".legendary","w3-hide");
      w3.removeClass(".legendary","w3-animate-zoom");
      break;
    case 1:
      w3.removeClass(".epic","w3-hide");
      w3.addClass(".epic","w3-animate-zoom");
      w3.addClass(".legendary","w3-hide");
      w3.removeClass(".legendary","w3-animate-zoom");
      break;
    case 2:
      w3.removeClass(".epic","w3-hide");
      w3.addClass(".epic","w3-animate-zoom");
      w3.removeClass(".legendary","w3-hide");
      w3.addClass(".legendary","w3-animate-zoom");
  }
  for(j = 0; j <= Mode; j++) for(i = 0; i < 3; i++) if(document.getElementById("Work_" + j + i).checked) Workbench[Workbench.Name[j]] = i;
  return;
}

function TestInput(){
  var i, j;
  
  for(j = 0; j < InData.Name.length; j++) for(i = 0; i < InData.Len[InData.Name[j]]; i++) if(i < Mode + 3 && (InData.Name[j] != "WLine" || i < Mode + 2)){
    InData[InData.Name[j]][i] = document.getElementById("In" + InData.Name[j] + "_" + i).value.replace(/[^\d,.-]/g, "").replace(/,/g, ".");
    document.getElementById("In" + InData.Name[j] + "_" + i).value = InData[InData.Name[j]][i];
    try {
      if(InData[InData.Name[j]][i] == "") throw "empty";
      InData[InData.Name[j]][i] = Number(InData[InData.Name[j]][i]);
      if(isNaN(InData[InData.Name[j]][i])) throw "not a number";
      if(InData[InData.Name[j]][i] < 0) throw "negative";
      if(InData.Name[j] != "Price") {if(!Number.isInteger(InData[InData.Name[j]][i])) throw "not an integer";}
      else {
        InData[InData.Name[j]][i] = Number(InData[InData.Name[j]][i].toFixed(2));
        document.getElementById("In" + InData.Name[j] + "_" + i).value = InData[InData.Name[j]][i];
      }
      if(InData.Name[j] == "Quantity" || InData.Name[j] == "WLine") if(InData[InData.Name[j]][i] == 0) throw "0, not valid";
    } catch(err) {
      Info.innerHTML = "The input is " + err + "!";
      Info.style.color = "red";
      document.getElementById("Th" + InData.Name[j] + "_" + i).style.color = "red";
      return false;
    }
  }
  return true;
}

function Calculation(){
  var i, SpeedCost = [5,20,80], WorkN = [5,10,15],
      WorkPrice = {
        Rare: [25, 47.50, 67.50],
        Epic: [100, 190, 270],
        Legend: [400, 760, 1080]
      };

  for(i = 0; i < 3; i++) if(!SpeedUp[i]) SpeedCost[i] = 0;

  InData.Price[1] = InData.Price[1] / 100;
  for(i = 2; i < InData.Len.Price; i++) InData.Price[i] = InData.Price[i] / 10;

  switch(Mode) {
    case 0: Rare(InData.Quantity[0]); break;
    case 1: Epic(InData.Quantity[0]); break;
    case 2: Legend(InData.Quantity[0]);
  }

  for(i = 0; i < Resources.Name.length - 1; i++) Resources.Tot[1] += Resources[Resources.Name[i]][1];
  Resources.UnitCost = Resources.Tot[1];
  document.getElementById("Profit_0").innerHTML = (Resources.UnitCost / InData.Quantity[0]).toFixed(2);
  document.getElementById("InQuantity_1").value = (Resources.UnitCost / InData.Quantity[0] * 1.111113).toFixed(2);

  for(i = 0; i < Resources.Name.length; i++) {
    Resources[Resources.Name[i]][0] = 0;
    Resources[Resources.Name[i]][1] = 0;
  }

  switch(Mode) {
    case 0: Rare(0); break;
    case 1: Epic(0); break;
    case 2: Legend(0);
  }

  for(i = 0; i < 5; i++) {
    if(Resources[Resources.Name[i]][0] - InData.Owned[i] > 0) {
      Resources[Resources.Name[i]][0] -= InData.Owned[i];
      Resources[Resources.Name[i]][1] -= InData.Price[i] * InData.Owned[i];
      Resources.Tot[0] += Resources[Resources.Name[i]][0];
      Resources.Tot[1] += Resources[Resources.Name[i]][1];
    } else {
      Resources[Resources.Name[i]][0] = 0;
      Resources[Resources.Name[i]][1] = 0;
    }
    document.getElementById("Need_0" + i).innerHTML = Resources[Resources.Name[i]][0];
    document.getElementById("Need_1" + i).innerHTML = Resources[Resources.Name[i]][1].toFixed(2);
  }
  Resources.Tot[1] += Resources.SpeedUp[1] + Resources.Workbench[1];
  document.getElementById("Need_1" + 5).innerHTML = Resources.Workbench[1].toFixed(2);
  document.getElementById("Need_1" + 6).innerHTML = Resources.SpeedUp[1].toFixed(2);

  document.getElementById("Need_0" + 7).innerHTML = Resources[Resources.Name[7]][0];
  document.getElementById("Need_1" + 7).innerHTML = Resources[Resources.Name[7]][1].toFixed(2);
  document.getElementById("Profit_2").innerHTML = Resources[Resources.Name[7]][1].toFixed(2);

  InData.Price[1] = InData.Price[1] * 100;
  for(i = 2; i < InData.Len.Price; i++) InData.Price[i] = InData.Price[i] * 10;

  w3.removeClass(".need","w3-hide");
  w3.addClass(".need","w3-animate-zoom");
  w3.removeClass(".profit","w3-hide");
  w3.addClass(".profit","w3-animate-zoom");
  Info.innerHTML = "Calculation completed!";
  Info.style.color = "green";

  Started = true;

  ga('send', 'event', 'Price Calculator', 'Start', '');

  function Rare(N){
    if(N == 0) {
      Resources.Commons[0] += InData.WLine[0];
      Resources.Commons[1] += InData.Price[0] * InData.WLine[0];
      Resources.Scraps[0] += 450 * InData.WLine[1];
      Resources.Scraps[1] += InData.Price[1] * 450 * InData.WLine[1];
      Resources.Coppers[0] += 50 * InData.WLine[1];
      Resources.Coppers[1] += InData.Price[2] * 50 * InData.WLine[1];
      Resources.Workbench[1] += WorkPrice.Rare[Workbench.Rare] / WorkN[Workbench.Rare] * InData.WLine[1];
      Resources.SpeedUp[1] += SpeedCost[0] * InData.WLine[1];
    } else {
      Resources.Commons[1] += InData.Price[0] * 7 * N;
      Resources.Scraps[1] += InData.Price[1] * 450 * N;
      Resources.Coppers[1] += InData.Price[2] * 50 * N;
      Resources.Workbench[1] += WorkPrice.Rare[Workbench.Rare] / WorkN[Workbench.Rare] * N;
      Resources.SpeedUp[1] += SpeedCost[0] * N;
    }
    return;
  }
  function Epic(N){
    if(N == 0) {
      Rare(0);
      Resources.Scraps[0] += 250 * InData.WLine[2];
      Resources.Scraps[1] += InData.Price[1] * 250 * InData.WLine[2];
      Resources.Coppers[0] += 150 * InData.WLine[2];
      Resources.Coppers[1] += InData.Price[2] * 150 * InData.WLine[2];
      Resources.Wires[0] += 750 * InData.WLine[2];
      Resources.Wires[1] += InData.Price[3] * 750 * InData.WLine[2];
      Resources.Workbench[1] += WorkPrice.Epic[Workbench.Epic] / WorkN[Workbench.Epic] * InData.WLine[2];
      Resources.SpeedUp[1] += SpeedCost[1] * InData.WLine[2];
    } else {
      Rare(6 * N);
      Resources.Scraps[1] += InData.Price[1] * 250 * N;
      Resources.Coppers[1] += InData.Price[2] * 150 * N;
      Resources.Wires[1] += InData.Price[3] * 750 * N;
      Resources.Workbench[1] += WorkPrice.Epic[Workbench.Epic] / WorkN[Workbench.Epic] * N;
      Resources.SpeedUp[1] += SpeedCost[1] * N;
    }
    return;
  }
  function Legend(N){
    if(N == 0) {
      Epic(0);
      Resources.Scraps[0] += 100 * InData.WLine[3];
      Resources.Scraps[1] += InData.Price[1] * 100 * InData.WLine[3];
      Resources.Coppers[0] += 450 * InData.WLine[3];
      Resources.Coppers[1] += InData.Price[2] * 450 * InData.WLine[3];
      Resources.Wires[0] += 750 * InData.WLine[3];
      Resources.Wires[1] += InData.Price[3] * 750 * InData.WLine[3];
      Resources.Electronics[0] += 1000 * InData.WLine[3];
      Resources.Electronics[1] += InData.Price[4] * 1000 * InData.WLine[3];
      Resources.Workbench[1] += WorkPrice.Legend[Workbench.Legend] / WorkN[Workbench.Legend] * InData.WLine[3];
      Resources.SpeedUp[1] += SpeedCost[2] * InData.WLine[3];
    } else {
      Epic(5 * N);
      Resources.Scraps[1] += InData.Price[1] * 100 * N;
      Resources.Coppers[1] += InData.Price[2] * 450 * N;
      Resources.Wires[1] += InData.Price[3] * 750 * N;
      Resources.Electronics[1] += InData.Price[4] * 1000 * N;
      Resources.Workbench[1] += WorkPrice.Legend[Workbench.Legend] / WorkN[Workbench.Legend] * N;
      Resources.SpeedUp[1] += SpeedCost[2] * N;
    }
    return;
  }
  return;
}

function Profit(){
  var Price, Tax, InfoP = document.getElementById("InfoP"), temp;

  Price = (document.getElementById("InQuantity_1").value.replace(/[^\d,.-]/g, "")).replace(/,/g, ".");
  document.getElementById("InQuantity_1").value = Price;
  document.getElementById("ThQuantity_1").style.color = "";
  try {
    if(Price == "") throw "empty";
    Price = Number(Price);
    if(isNaN(Price)) throw "not a number";
    if(Price < 0) throw "negative";
    Price = Number(Price.toFixed(2));
  } catch(err) {
    InfoP.innerHTML = "The input is " + err + "!";
    InfoP.style.color = "red";
    document.getElementById("ThQuantity_1").style.color = "red";
    return;
  }
  Price = Price * InData.Quantity[0];
  Tax = Price / 10;
  document.getElementById("Profit_1").innerHTML = Price.toFixed(2);
  document.getElementById("Profit_3").innerHTML = Tax.toFixed(2);
  temp = Number((Price * 0.9 - Resources.Tot[1]).toFixed(2));
  if(temp < 0.004 && temp > -0.005) temp = 0.00;
  document.getElementById("Profit_4").innerHTML = temp;
  temp = Number((Price * 0.9 - Resources.UnitCost).toFixed(2));
  if(temp < 0.004 && temp > -0.005) temp = 0.00;
  document.getElementById("Profit_5").innerHTML = temp;
  InfoP.innerHTML = "Calculation completed!";
  InfoP.style.color = "green";
  return;
}

function SaveData(Name) {
  var Box, Data = {},
      key = CryptoJS.enc.Base64.parse("2Vt16unuPql"),
      iv = CryptoJS.enc.Base64.parse("1a81QPRYu9v");

  if (Name == "InData") {
    Data.Work = Workbench;
    Data.Data = InData;
    Data.SpeedUp = SpeedUp;
    Data.Mode = Mode;
    Data.Interval = Interval;
  } else if (Name == "RawMaterials") {
    Data.Data = OriginalPrice;
  } else if (Name == "History") {
    Data.Data = History;
  }
  Data.Version = 1.2;
  Data = JSON.stringify(Data);

  try {
    if (typeof(Storage) === "undefined") throw "Can't access to the memory.";
    Box = {
      Time: new Date().getTime(),
      Data: ObjFormatter.toObj(CryptoJS.AES.encrypt(Data, key, {iv: iv})),
      Checksum: CryptoJS.SHA3(Data).toString()
    };
    localStorage.setItem(Name, JSON.stringify(Box));
  } catch(err) {
    if (Name == "InData") {
      Info.innerHTML = err;
      Info.style.color = "red";
    }
    return;
  }
  if (Name == "InData") {
    Info.innerHTML = "Data Saved Successfully!";
    Info.style.color = "green";
  }
  return;
}

function LoadData(Name) {
  var i, j, Box, Now = {Time: new Date().getTime()},
      key = CryptoJS.enc.Base64.parse("2Vt16unuPql"),
      iv = CryptoJS.enc.Base64.parse("1a81QPRYu9v");

  try {
    if(typeof(Storage) == "undefined") throw "Can't access to the memory.";
    if (Name == "RawMaterials") if(typeof(localStorage.RawMaterials) == "undefined") throw "Data not found in memory.";
    if (Name == "History") if(typeof(localStorage.History) == "undefined") throw "Data not found in memory.";
    if (Name == "InData") if(typeof(localStorage.InData) == "undefined") throw "Data not found in memory.";
    Box = JSON.parse(localStorage.getItem(Name));
    if (Name == "RawMaterials" && Box.Time + 1000 * 60 * 5 < Now.Time) throw "Data not loaded, older than 5 min.";
    if (Name == "History" && Box.Time + 1000 * 60 * 60 < Now.Time) throw "Data not loaded, older than a hour.";
    Now.Data = CryptoJS.AES.decrypt(ObjFormatter.toCipher(Box.Data), key, {iv : iv}).toString(CryptoJS.enc.Utf8);
    Now.Checksum = CryptoJS.SHA3(Now.Data).toString();
    if (Box.Checksum !== Now.Checksum) throw "Data not loaded, damaged.";
    Now.Data = JSON.parse(Now.Data);
    if (Now.Data.Version != 1.2) throw "Data not loaded, old version.";
  } catch(err) {
    Info.innerHTML = err;
    Info.style.color = "red";
    return false;
  }
  if (Name == "InData") {
    InData = Now.Data.Data;
    Workbench = Now.Data.Work;
    SpeedUp = Now.Data.SpeedUp;
    Mode = Now.Data.Mode;
    Interval = Now.Data.Interval;
    for(j = 0; j < InData.Name.length; j++) for(i = 0; i < InData.Len[InData.Name[j]]; i++) if(i < Mode + 3) document.getElementById("In" + InData.Name[j] + "_" + i).value = InData[InData.Name[j]][i];
    for(j = 0; j <= Mode; j++) document.getElementById("Work_" + j + Workbench[Workbench.Name[j]]).checked = true;
    for(j = 0; j <= Mode; j++) document.getElementById("SpeedUp_" + j).checked = SpeedUp[j];
    document.getElementById("Rarity_" + Mode).checked = true;
    document.getElementById("Interval_0" + Interval).checked = true;
    document.getElementById("Interval_1" + Interval).checked = true;
  } else if (Name == "RawMaterials") {
    OriginalPrice = Now.Data.Data;
    for(i = 0; i < 5; i++) document.getElementById("InPrice_" + i).value = OriginalPrice[i];
    Info.innerHTML = "Updated Prices!";
    Info.style.color = "green";
  } else if (Name == "History") {
    History = Now.Data.Data;
  }
  return true;
}

function GetData(Name) {
  var Req = SetRequest(Name), xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange = function() {
    if(this.status != 0 && this.status != 200) Info.innerHTML = Req.API + ": StatusText = " + this.statusText + " / Status = " + this.status + ".";
    if(this.readyState == 4) {
      if(this.status == 200 && this.responseText != "") {
        //Info.innerHTML = Req.API + ": Response is ready.";
        Req.OnReady(this.responseText);
      } else if(this.status == 0) {
        Info.innerHTML = Req.API + ": Network Error.";
        Info.style.color = "red";
      }
    }
    //Req.OnElse(this.statusText, this.status);
  };
  xmlhttp.open(Req.Method, Req.Url, true);
  xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlhttp.send(Req.Data);
  return;
}

function SetRequest(Name) {
  var Req = {};
  Req.TxtState = [["Request not initialized."],["Connection established."],["Request received."],["Processing request."]];
  //Req.OnElse = function(StatusText, Status) {return; };
  Req.Data = "category=" + Name;
  if (window.location.protocol == "https:") Req.Url = "https://it4ly.altervista.org/tool/price_calculator/api.php";
  else Req.Url = "http://it4ly.altervista.org/tool/price_calculator/api.php";
  Req.Method = "POST";
  Req.API = "Tool API";
  Req.OnReady = function(Response) {
    var i, j;
    Response = JSON.parse(Response);
    if(Response.success == true) {
      if (Name == "rawmaterials") {
        for(i = 0; i < 5; i++) {
          InData.Price[i] = Number((Response.data[i].price / 100).toFixed(2));
          OriginalPrice[i] = Number((Response.data[i].price / 100).toFixed(2));
          document.getElementById("InPrice_" + i).value = InData.Price[i];
        }
        SaveData("RawMaterials");
      } else if (Name == "history") {
        var i, j, IdName = ["scrap","copper","wire","electronic"];
        History = Response.data;
        for (i = 0; i < 720; i++) History[IdName[0]][i][0] = Number((History[IdName[0]][i][0] / 10000).toFixed(5));
        for (j = 1; j < 4; j++) for (i = 0; i < 720; i++) History[IdName[j]][i][0] = Number((History[IdName[j]][i][0] / 1000).toFixed(5));
        SaveData("History");
        if (LastChart != false) PrintChart("last");;
      }
      Info.innerHTML = "Updated Prices!";
      Info.style.color = "green";
    } else {
      Info.innerHTML = Req.API + ": Network Error.";
      Info.style.color = "red";
    }
    return;
  };
  return (Req);
}

function PrintChart(job) {
  var AllData;

  AllData = SetChartData(job);
  if(History == false) return;

  google.charts.setOnLoadCallback(drawChart);

  function drawChart() {
    var data = google.visualization.arrayToDataTable(AllData.Data);

    var options = {
        title: AllData.Title,
        titleTextStyle: { color: "white", fontSize: 15, bold: true},
        curveType: "function",
        backgroundColor: "transparent",
        legend: {position: "bottom", textStyle: {color: "white", fontSize: 12}},
        chartArea: {width:"85%",height:"60%"},
        vAxis: {textStyle: {color: "white"}},
        hAxis: {textStyle: {color: "white"},format: 'dd/MM/yy HH:mm'},
        pointSize: AllData.PointSize,
        series: {
          0:{color: AllData.Color}
        }
      };

    var chart = new google.visualization.LineChart(document.getElementById(AllData.IdDiv));

    var dateFormatter = new google.visualization.DateFormat({pattern: 'dd/MM/yy HH:mm'});
    dateFormatter.format(data, 0);

    chart.draw(data, options);
  }

  return;
}

function SetChartData(job){
  var i, j, TotPrice = 0, Calc, NInterval = 0, ImgClass = "", ImgUrl = "", TimeZone,
    AllData = {Data: [], IdDiv: "", Color: "rgb(210, 210, 210)", PointSize: 0, Title: ""},
    CalcData = {Ar: [], Min: 0, Max: 0, Media: 0};

  if (job == "last") {job = LastChart;}
  else {LastChart = job;}

  if (job == "module") {
    AllData.IdDiv = "curve_chart";
    for (i = 0; i < 3; i++) if(document.getElementById("Interval_0" + i).checked == true) Interval = i;
    document.getElementById("Interval_1" + Interval).checked = true;
  } else {
    if (job == "modalmodule") {ImgUrl = Workbench.Name[Mode]; ImgClass = "rarity";}
    else {ImgUrl = job.substring(0, 1).toUpperCase() + job.substring(1), ImgClass = "resource"}
    document.getElementById("modal_icon").innerHTML = '<img src="img/' + ImgUrl + '.jpg" class="' + ImgClass + '" alt="' + ImgUrl + '">';
    AllData.IdDiv = "modal_curve_chart";
    document.getElementById("modal").style.display = "block";
    for (i = 0; i < 3; i++) if(document.getElementById("Interval_1" + i).checked == true) Interval = i;
    document.getElementById("Interval_0" + Interval).checked = true;
  }

  if(History == false) return;

  switch (Interval) {
    case 0: NInterval = 24; AllData.PointSize = 5; break;
    case 1: NInterval = 168; AllData.PointSize = 1; break;
    case 2: NInterval = 720; AllData.PointSize = 0;
  }

  TimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;

  if (job == "module" || job == "modalmodule") {
    AllData.Title = "Historical Unit Valour - Time Zone: " + Intl.DateTimeFormat().resolvedOptions().timeZone;
    switch (Mode) {
      case 0: Calc = CalcRare; AllData.Color = "rgb(0, 102, 204)"; break;
      case 1: Calc = CalcEpic; AllData.Color = "rgb(185, 0, 255)"; break;
      case 2: Calc = CalcLegend; AllData.Color = "rgb(255, 160, 64)";
    }
    AllData.Data[0] = ['Time', 'Unit Valour'];
    for (i = 0; i < NInterval ; i++) {
      TotPrice = 0;
      j = (NInterval - 1) - i;
      Calc(1);
      TotPrice = Number(TotPrice.toFixed(2));
      CalcData.Ar[i] = TotPrice;
      AllData.Data[i + 1] = [new Date(CalcTime()), TotPrice];
    }

    CalcData.Min = CalcData.Ar[0];
    CalcData.Max = CalcData.Ar[0];
    CalcData.Media = 0;
    for (i = 1; i < NInterval; i++) {
      if (CalcData.Min > CalcData.Ar[i]) CalcData.Min = CalcData.Ar[i];
      if (CalcData.Max < CalcData.Ar[i]) CalcData.Max = CalcData.Ar[i];
      CalcData.Media += CalcData.Ar[i];
    }
    CalcData.Media = CalcData.Media / CalcData.Ar.length;
  } else {
    if (job == "scrap") Calc = 100;
    else Calc = 10;
    AllData.Title = "Historical " + ImgUrl + " x" + Calc + " - Time Zone: " + Intl.DateTimeFormat().resolvedOptions().timeZone;
    AllData.Data[0] = ['Time', ImgUrl];
    for (i = 0; i < NInterval ; i++) {
      j = (NInterval - 1) - i;
      AllData.Data[i + 1] = [new Date(Number((History[job][j][1] * 1000).toFixed())), Number((History[job][j][0] * Calc).toFixed(2))];
    }
    CalcData.Min = History[job][0][0];
    CalcData.Max = History[job][0][0];
    CalcData.Media = 0;
    for (i = 1; i < NInterval; i++) {
      if (CalcData.Min > History[job][i][0]) CalcData.Min = History[job][i][0];
      if (CalcData.Max < History[job][i][0]) CalcData.Max = History[job][i][0];
      CalcData.Media += History[job][i][0];
    }
    CalcData.Media = (CalcData.Media / NInterval) * Calc;
    CalcData.Min *= Calc;
    CalcData.Max *= Calc;
  }

  if (AllData.IdDiv == "curve_chart") {
    document.getElementById("Chart_0").innerHTML = CalcData.Min;
    document.getElementById("Chart_1").innerHTML = CalcData.Max;
    document.getElementById("Chart_2").innerHTML = CalcData.Media.toFixed(2);
  } else {
    document.getElementById("modal_Chart_0").innerHTML = CalcData.Min.toFixed(2);
    document.getElementById("modal_Chart_1").innerHTML = CalcData.Max.toFixed(2);
    document.getElementById("modal_Chart_2").innerHTML = CalcData.Media.toFixed(2);
  }

  function CalcTime(){
    return Number(((History.scrap[j][1] + History.copper[j][1] + History.wire[j][1] + History.electronic[j][1]) / 4 * 1000).toFixed());
  }

  function CalcRare(N){
    TotPrice += 0.20 * 7 * N;
    TotPrice += History.scrap[j][0] * 450 * N;
    TotPrice += History.copper[j][0] * 50 * N;
    TotPrice += 67.50 / 15 * N;
    return;
  }

  function CalcEpic(N){
    CalcRare(6 * N);
    TotPrice += History.scrap[j][0] * 250 * N;
    TotPrice += History.copper[j][0] * 150 * N;
    TotPrice += History.wire[j][0] * 750 * N;
    TotPrice += 270 / 15 * N;
    return;
  }

  function CalcLegend(N){
    CalcEpic(5);
    TotPrice += History.scrap[j][0] * 100;
    TotPrice += History.copper[j][0] * 450;
    TotPrice += History.wire[j][0] * 750;
    TotPrice += History.electronic[j][0] * 1000;
    TotPrice += 1080 / 15;
    return;
  }

  return AllData;
}

function ResetPrice(){
  var i;

  for (i = 0; i < 5; i++) {
    InData.Price[i] = Number(OriginalPrice[i].toFixed(2));
    document.getElementById("InPrice_" + i).value = Number(OriginalPrice[i].toFixed(2));
  }
  Info.innerHTML = "Prices Reseted!";
  Info.style.color = "rgb(255, 191, 0)";
  return;
}

/*Closures End*/
}})();

Start("reset");
DoLyt("SwitchLayout");
google.charts.load('current', {'packages':['corechart']});
Start("getprice");
Start("gethistory");

 

 

api.php:

Spoiler
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_SERVER['HTTP_HOST'] == 'it4ly.altervista.org') {
  $category = $success = $text = $data = '';
  $category = TestInput($_POST['category']);
  $conn = new mysqli($ConnData["host"], $ConnData["user"], $ConnData["pass"], $ConnData["database"]);
  
  if ($conn->connect_error) {
    $success = false;
    $text = "Connection failed: " . $conn->connect_error;
  } else {
    if($category == "rawmaterials"){
      $sql = "SELECT time FROM times WHERE name = 'resource'";
      $result = $conn->query($sql);
      $row = $result->fetch_assoc();
      $temp = $row['time'];
      if ($temp + 5 * 60 > time()) {
        $sql = "SELECT name, price FROM resources";
        $result = $conn->query($sql);
        $i = 0;
        while($row = $result->fetch_assoc()) {
          $data[$i] = $row;
          settype ($data[$i]["price"], "int");
          $i++;
        }
        $success = true;
        $text = "SELECT okay.";
      } else {
        $newData = file_get_contents("https://crossoutdb.com/api/v1/items?rarity=common&category=resources");
        if($newData != "") {
          $newData = json_decode($newData, true);
          $length = sizeof($newData);
          $idData = [0, 53, 76, 216, 201];
          $nameData = ["common", "scrap", "copper", "wire", "electronic"];
          $data = array(array("name"=>"common", "price"=>20));
          for($j = 1; $j < 5; $j++) {
            for($i = 0; $i < $length; $i++) {
              if($newData[$i]["id"] == $idData[$j]) {
                $data[$j] = array("name"=>$nameData[$j], "price"=>$newData[$i]["buyPrice"]);
                settype ($data[$j]["price"], "int");
                $j++;
                $i = 0;
              }
            }
          }
          $text = "UPDATE okay.";
          for($j = 0; $j < 5; $j++) {
            $sql = "UPDATE resources SET price = " . $data[$j]['price'] . " WHERE id = " . $j;
            if ($conn->query($sql) != TRUE) {
              $text = "UPDATE Error: " . $conn->error;
            }
          }
          $sql = "UPDATE times SET time = " . time() . " WHERE name = 'resource'";
          if ($conn->query($sql) != TRUE) {
            $text = "UPDATE Error: " . $conn->error;
          }
          $success = true;
        } else {
          $sql = "SELECT name, price FROM resources";
          $result = $conn->query($sql);
          $i = 0;
          while($row = $result->fetch_assoc()) {
            $data[$i] = $row;
            settype ($data[$i]["price"], "int");
            $i++;
          }
          $success = true;
          $text = "GET Error.";
        }
      }
    } else if ($category == "history") {
      $data = array("scrap" => array(), "copper" => array(), "wire" => array(), "electronic" => array());
      $name = ["scrap", "copper", "wire", "electronic"];
      $sql = "SELECT time FROM times WHERE name = 'history'";
      $result = $conn->query($sql);
      $row = $result->fetch_assoc();
      $temp = $row['time'];
      if ($temp + 60 * 60 > time()) {
        $temp = array();
        for ($i = 0; $i < 4; $i++) {
          $sql = "SELECT price, time FROM hist" . $name[$i];
          $result = $conn->query($sql);
          $j = 0;
          while($row = $result->fetch_assoc()) {
            $temp[0] = $row["price"];
            $temp[1] = $row["time"];
            $data[$name[$i]][$j] = $temp;
            settype ($data[$name[$i]][$j][0], "int");
            settype ($data[$name[$i]][$j][1], "int");
            $j++;
          }
        }
        $success = true;
        $text = "SELECT okay.";
      } else {
        $status = true;
        $idname = [53, 76, 216, 201];
        $temp = array();
        $text = "UPDATE okay.";
        for ($i = 0; $i < 4; $i++) {
          $newData = file_get_contents("https://crossoutdb.com/api/v1/market/buyprice/" . $idname[$i] . "?unixTimestamp");
          if($newData != "") {
            $newData = json_decode($newData, true);
            $length = sizeof($newData);
            if ($length > 720) {
              $length = 720;
            }
            for ($j = 0; $j < $length; $j++) {
              $temp[0] = ceil(($newData[$j * 9 + 0][1] + $newData[$j * 9 + 1][1] + $newData[$j * 9 + 2][1] + $newData[$j * 9 + 3][1] + $newData[$j * 9 + 4][1] + $newData[$j * 9 + 5][1] + $newData[$j * 9 + 6][1] + $newData[$j * 9 + 7][1] + $newData[$j * 9 + 8][1]) / 9);
              $temp[1] = ceil(($newData[$j * 9 + 0][0] + $newData[$j * 9 + 1][0] + $newData[$j * 9 + 2][0] + $newData[$j * 9 + 3][0] + $newData[$j * 9 + 4][0] + $newData[$j * 9 + 5][0] + $newData[$j * 9 + 6][0] + $newData[$j * 9 + 7][0] + $newData[$j * 9 + 8][0]) / 9);;
              $data[$name[$i]][$j] = $temp;
              $sql = "UPDATE hist" . $name[$i] . " SET price = " . $data[$name[$i]][$j][0] . ", time = ". $data[$name[$i]][$j][1] . " WHERE id = " . $j;
              if ($conn->query($sql) != TRUE) {
                $text = "UPDATE Error: " . $conn->error;
              }
            }
          } else {
            $sql = "SELECT price, time FROM hist" . $name[$i];
            $result = $conn->query($sql);
            $j = 0;
            $temp = array();
            while($row = $result->fetch_assoc()) {
              $temp[0] = $row["price"];
              $temp[1] = $row["time"];
              $data[$name[$i]][$j] = $temp;
              settype ($data[$name[$i]][$j][0], "int");
              settype ($data[$name[$i]][$j][1], "int");
              $j++;
            }
            $status = false;
            $text = "GET Error.";
          }
        }
        if ($status == true) {
          $sql = "UPDATE times SET time = " . time() . " WHERE name = 'history'";
          if ($conn->query($sql) != TRUE) {
            $text = "UPDATE Error: " . $conn->error;
          }
        }
        $success = true;
      }
    }
    $conn->close();
  }
  //header('Access-Control-Allow-Origin: *');
  header('Content-Type: application/json; charset=UTF-8');
  $response = array("success" => $success, "text" => $text, "data" => $data);
  echo json_encode($response);
}

function TestInput($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
}
?>

 

In this period I have a lot of work to do, so for now the project is stopped, I'm sorry.

Edited by ITalianBadBoy
  • Like 1

Share this post


Link to post
Share on other sites

At the moment the code is "dirty" for the various changes and the implementations over the time.

I should rewrite the algorithm and improve the semantics of the variables, of the page's ids and add some comments.

I apologize for the inconvenience...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.