<?php
    require_once('config.php');
    if(isset($_GET['language'])){
        if($_GET['language']=="RU" || $_GET['language']=="ENG")
            $query = $odb->query("UPDATE `settings` SET `language` = \"".$_GET['language']."\"");
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    }
    $currentlanguage = $odb->query("SELECT `language` FROM `settings`")->FetchColumn(0);

    $query = $odb->query("SELECT * FROM `texts`");

    $pageText = [];
    while($setlocale = $query->fetch(PDO::FETCH_ASSOC)) {
        if($currentlanguage == "RU") $pageText[$setlocale['name']][] = $setlocale['text_RU'];
        else $pageText[$setlocale['name']][] = $setlocale['text_ENG'];
    }
?>