Exemplo n.º 1
1
 public function setup_database($attr)
 {
     $config_dir = get_config_dir();
     if (!is_dir($config_dir)) {
         if (!@mkdir($config_dir, 0700)) {
             $message = 'Não foi possível criar o diretório "config" um nível' . ' acima em relação à raiz. Por favor, crie manualmente' . ' no servidor o diretório "' . $config_dir . '".';
             throw new Exception($message);
         }
     }
     $root_username = $attr['root_username'];
     $root_password = $attr['root_password'];
     $db_name = $attr['db_name'];
     $db_username = $attr['db_username'];
     $db_password = $attr['db_password'];
     try {
         $db = new PDO('mysql:host=localhost;charset=utf8', $root_username, $root_password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
     } catch (PDOException $e) {
         throw new DatabaseException();
     }
     if (!$db) {
         throw new DatabaseException();
     }
     $sql_codes = ["CREATE SCHEMA IF NOT EXISTS `{$db_name}`\n          DEFAULT CHARACTER SET utf8;", "CREATE USER '{$db_username}'@localhost\n          IDENTIFIED BY '{$db_password}'", "USE `{$db_name}`; " . file_get_contents_utf8(get_etc_dir() . 'schema.sql'), "GRANT\n          SELECT, INSERT, TRIGGER, UPDATE, DELETE\n          ON TABLE *\n          TO '{$db_username}'@localhost;"];
     foreach ($sql_codes as $sql) {
         $db->exec($sql);
     }
     $file = fopen($config_dir . 'dbsettings.ini', 'w');
     fwrite($file, "db_name     = \"{$db_name}\"\n");
     fwrite($file, "db_username = \"{$db_username}\"\n");
     fwrite($file, "db_password = \"{$db_password}\"\n");
     fclose($file);
 }
Exemplo n.º 2
0
 /**
  * @return bool|string
  */
 public function getContent()
 {
     if (file_exists($this->datafile_path)) {
         return file_get_contents_utf8($this->datafile_path);
     }
     return '';
 }
 /**
  * @param $checksum
  *
  * @return bool|string
  */
 public function getCacheContent($checksum)
 {
     $cache_file = $this->getFilePath($checksum . self::FILE_EXTENSION);
     if (file_exists($cache_file)) {
         return file_get_contents_utf8($cache_file);
     }
     return '';
 }
Exemplo n.º 4
0
 function writeContent($clearCache)
 {
     if (!file_exists(self::$cachedFile) || $clearCache) {
         $file = fopen(self::$cachedFile, 'w');
         fwrite($file, "{");
         fwrite($file, '"songs":{');
         $this->writeSongs($file);
         fwrite($file, '}');
         fwrite($file, ',"sessions":[');
         $this->writeSessions($file);
         fwrite($file, ']');
         fwrite($file, '}');
         fclose($file);
     }
     function file_get_contents_utf8($fn)
     {
         $content = file_get_contents($fn);
         return $content;
     }
     $content = file_get_contents_utf8(self::$cachedFile);
     echo $content;
 }
Exemplo n.º 5
0
<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: X-Requested-With, Content-Type');
function file_get_contents_utf8($fn)
{
    $content = file_get_contents($fn);
    $content = mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
    return $content;
}
$content = file_get_contents_utf8(@$_GET['link']);
echo $content;
Exemplo n.º 6
0
<?php

/* Connexion */
include '../connection/connection.php';
$json = file_get_contents_utf8('php://input');
$obj = json_decode($json);
//var_dump($obj);
$sql = 'UPDATE `photo` SET 
                                `active`="0" 
            WHERE `photo_id`="' . $obj->{'photo_id'} . '"';
//print $sql;
if (mysqli_query($con, $sql)) {
    echo "success";
} else {
    echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
Exemplo n.º 7
0
function _getsha($file, $filefullpath)
{
    if (check_if_image($file)) {
        $d = file_get_contents($filefullpath);
        $s = filesize($filefullpath);
        //strlen( $encoded_image );
        $x = sha1("blob " . $s . "" . $d);
    } else {
        $d = str_replace("\r\n", "\n", file_get_contents_utf8($filefullpath));
        $s = strlen($d);
        $x = sha1("blob " . $s . "" . $d);
    }
    return $x;
}
Exemplo n.º 8
0
function return_xmllog()
{
    $ms = new MasterServer();
    // Update the log if necessary.
    $logPath = $ms->xmlLogFile();
    if ($logPath !== false) {
        $result = file_get_contents_utf8($logPath, 'text/xml', 'utf-8');
        if ($result !== false) {
            // Return the log to the client.
            header("Content-Type: text/xml; charset=utf-8");
            echo mb_ereg_replace('http', 'https', $result);
        }
    }
}
Exemplo n.º 9
0
 /**
  * @return mixed
  */
 public function getContent()
 {
     if (!isset($this->content) && !$this->external) {
         if (file_exists($this->path) && is_readable($this->path)) {
             $this->content = file_get_contents_utf8($this->path);
         }
     } else {
         $this->ignored = true;
     }
     return $this->content;
 }
Exemplo n.º 10
0
    
    	    if (filesize('ical/temp_gr'.$id.'.ics') > 500)
    			copy('ical/temp_gr'.$id.'.ics','ical/'.$id.'.ics');
    		unlink('ical/temp_gr'.$id.'.ics');
    	} */
} else {
    $contenuIcalVide = " ";
    // ECOLE
    $json = json_decode(file_get_contents("../dictionaries/sections.json"), TRUE);
    $listeSections = $json["sections"];
    foreach ($listeSections as $section) {
        if (isset($section["url"])) {
            $ics = file_get_contents_utf8($section["url"]);
            echo $section["url"];
        } else {
            $ics = file_get_contents_utf8("http://planning-ade.umontpellier.fr/jsp/custom/modules/plannings/anonymous_cal.jsp?resources={$section['id_ade']}&projectId=23&calType=ical&nbWeeks=16");
            echo $section["nom"] . "<br />";
        }
        file_put_contents("../../cache/temp/{$section['nom']}.ics", $ics);
        if (filesize("../../cache/temp/{$section['nom']}.ics") > 500) {
            copy("../../cache/temp/{$section['nom']}.ics", "../../cache/ics/{$section['nom']}.ics");
        } else {
            file_put_contents("../../cache/ics/{$section['nom']}.ics", $contenuIcalVide);
        }
        unlink("../../cache/temp/{$section['nom']}.ics");
    }
    // ROOMS
    /* $json = json_decode(file_get_contents("../rooms.json"), TRUE);
    	$listeRooms = $json["rooms"];
    
    	foreach ($listeRooms as $room) {
Exemplo n.º 11
0
 /**
  * Create a new model.
  * IF creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionAjaxCreate()
 {
     function cut_str($string, $sublen, $start = 0, $code = 'UTF-8')
     {
         if ($code == 'UTF-8') {
             $pa = "/[-]|[�-�][�-�]|�[�-�][�-�]|[�-�][�-�][�-�]|�[�-�][�-�][�-�]|[�-�][�-�][�-�][�-�]/";
             preg_match_all($pa, $string, $t_string);
             if (count($t_string[0]) - $start > $sublen) {
                 return join('', array_slice($t_string[0], $start, $sublen)) . "..";
             }
             return join('', array_slice($t_string[0], $start, $sublen));
         } else {
             $start = $start * 2;
             $sublen = $sublen * 2;
             $strlen = strlen($string);
             $tmpstr = '';
             for ($i = 0; $i < $strlen; $i++) {
                 if ($i >= $start && $i < $start + $sublen) {
                     if (ord(substr($string, $i, 1)) > 129) {
                         $tmpstr .= substr($string, $i, 2);
                     } else {
                         $tmpstr .= substr($string, $i, 1);
                     }
                 }
                 if (ord(substr($string, $i, 1)) > 129) {
                     $i++;
                 }
             }
             if (strlen($tmpstr) < $strlen) {
                 $tmpstr .= "..";
             }
             return $tmpstr;
         }
     }
     function file_get_contents_utf8($fn)
     {
         $content = file_get_contents($fn);
         return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'big5, UTF-8, ISO-8859-1'));
     }
     function getMetaTitle($content)
     {
         //$pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui";
         $pattern = "/<title>(.+)<\\/title>/siU";
         /*	$pattern = "<meta\s+name=['\"]??title['\"]??\s+content=['\"]??(.+)['\"]??\s*\/?>"; */
         if (preg_match($pattern, $content, $match)) {
             return $match[1];
         } else {
             return false;
         }
     }
     function getMetaDesc($content)
     {
         $pattern = "<meta\\s+name=['\"]??description['\"]??\\s+content=['\"]??(.+)['\"]??\\s*\\/?>";
         // Remove it when done
         if (preg_match("/{$pattern}/siU", $content, $match)) {
             return $match[1];
         } else {
             return false;
         }
     }
     $model = new Post();
     // Check for valid.
     $this->performAjaxValidation($model);
     // Create Tag Model
     $tag_model = new Tag();
     // Retrieve category list
     $category_list = array();
     $category_list['category_id'] = CHtml::listData($this->portlets['category'], 'id', 'name');
     // Need to speed up
     // Extract html content
     $urlData = array();
     if (isset($_POST['url'])) {
         $url = $_POST['url'];
         $urlData['url'] = $url;
         // First phrase
         $content = @file_get_contents_utf8($url);
         $urlDataFlag = false;
         if (($urlData['title'] = getMetaTitle($content)) == false) {
             $urlDataFlag = true;
         }
         if (($urlData['description'] = getMetaDesc($content)) == false) {
             $urlDataFlag = true;
         }
         //			$urlData['title'] = getMetaTitle($content);
         //			$urlData['description'] = getMetaDesc($content);
         // Second phrase
         if ($urlDataFlag) {
             $boilerpipeUrl = "http://boilerpipe-web.appspot.com/extract?url={$url}&output=json";
             $struHTML = json_decode(file_get_contents($boilerpipeUrl));
             if ($struHTML->{'status'} === "success") {
                 $urlData['title'] = $struHTML->{'response'}->{'title'};
                 $urlData['description'] = $struHTML->{'response'}->{'content'};
             }
             // Handle error msg
         }
         // Cut str
         $urlData['title'] = cut_str($urlData['title'], 20, 0);
         $urlData['description'] = cut_str($urlData['description'], 80, 0);
     }
     $this->renderPartial('ajaxCreate', array('urlData' => $urlData, 'model' => $model, 'category_list' => $category_list, 'tag_model' => $tag_model), false, true);
 }
function get_dell_warranty_days($this_serial_number)
{
    // We assume this is a UK machine, if US, use the second URL, since the US like their dates to be a little strange ;¬)
    //
    $this_url = "http://support.euro.dell.com/support/topics/topic.aspx/emea/shared/support/my_systems_info/en/details?c=uk&l=en&s=gen&servicetag=";
    //$this_url="http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=uk&cs=usbsdt1&servicetag=";
    // Add the serial number to the URL
    $this_url = $this_url . $this_serial_number;
    $this_web_page = get_web_page($this_url);
    //print_r($this_web_page);
    $this_content = $this_web_page[content];
    $content = file_get_contents_utf8($this_url, FALSE, NULL, 0, 20);
    // Objective, find the fields on the Dell Warranty page - Description	Provider	Start Date	End Date	Days Left
    // Search for the string of the warranty date fields
    //
    // $this_string is a unique string on the warranty page just before the first date field
    //
    // this gives us an offset from the start of the page to look for the first field (Start Date)
    // from this, we need to look for the first 'contract_oddrow' characters this will give us the first
    // character of the date, but since the date is not fixed length, we then need to read up to the start of the next tag '<'
    // Next we look for the start of the next field, read the next date using the same method, and finally look for the days remaining
    // which is slightly more complicated as it is either a number at the end of a next field or a zero surrounded by <b> and <red> tags
    // Search for the string at the start of the date fields
    //
    $this_string = "DELL</td><td class=";
    // $this_string = '\"<td class=\"contract_oddrow\">DELL<\/td><td class=\"contract_oddrow\">';
    //Find the start of the data
    $this_warranty_data_pos = stripos($content, $this_string, 0);
    // define the offset for the start date
    //$this_string = '<td class=\"contract_oddrow\">';
    $this_string = 'contract_oddrow';
    $this_end_string = '<';
    $this_warranty_start_date_offset = stripos($content, $this_string, $this_warranty_data_pos) + 17;
    $this_warranty_start_date_length = stripos($content, $this_end_string, $this_warranty_start_date_offset) - $this_warranty_start_date_offset;
    $this_warranty_end_date_offset = stripos($content, $this_string, $this_warranty_start_date_offset) + 17;
    $this_warranty_end_date_length = stripos($content, $this_end_string, $this_warranty_end_date_offset) - $this_warranty_end_date_offset;
    $this_warranty_start_date_pos = $this_warranty_start_date_offset;
    $this_warranty_end_date_pos = $this_warranty_end_date_offset;
    $this_warranty_start_date = substr($content, $this_warranty_start_date_pos, $this_warranty_start_date_length);
    $this_warranty_end_date = substr($content, $this_warranty_end_date_pos, $this_warranty_end_date_length);
    if (isset($timezone)) {
        date_default_timezone_set($timezone);
    } else {
        date_default_timezone_set('Europe/London');
    }
    $warranty_days_left = strtotime($this_warranty_end_date);
    $this_date = strtotime("now");
    if (is_like_a_date($this_warranty_end_date)) {
        //
        $date = explode("/", $this_warranty_end_date);
        //var_dump(checkdate($date[1], $date[0], $date[2]));
        // echo "Warranty End date ".date("D d M Y",mktime(0,0,0,$date[1],$date[0],$date[2]))." ";
        // Convert to US style date, (not needed if you use the US web page...)
        $this_us_date = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
        $days_left = $this_us_date - $this_date;
    } else {
        $days_left = 0;
    }
    // If we are over the warrenty period we always have zero
    if ($days_left < 0) {
        $days_left = 0;
    } else {
    }
    // $days_left = get_formated_duration($days_left);
    $days_left = get_days_left($days_left);
    // echo "Warranty Remaining ".$days_left." days.";
    return $days_left;
}
Exemplo n.º 13
0
    $stagiaireTraite[4] = $stagiaire[4];
    // Transformation en coordonnées GPS
    $concatAdresse = trim($stagiaire[9]) . " " . trim($stagiaire[11]);
    $adressePourUrl = urlencode($concatAdresse);
    $adresseGoogle = "http://maps.google.com/maps/api/geocode/json?address={$adressePourUrl}&sensor=false";
    print_r($stagiaireTraite);
    if ($i < $limiteTest && count($stagiaireTraite) < 13) {
        $moissonGoogle = file_get_contents_utf8($adresseGoogle);
        $decodeGoogle = json_decode($moissonGoogle, true);
        if ($decodeGoogle[results][0]["geometry"]["location"]["lat"]) {
            $stagiaireTraite[] = array($decodeGoogle[results][0]["geometry"]["location"]["lng"], $decodeGoogle[results][0]["geometry"]["location"]["lat"]);
            $i++;
            usleep(120);
        } else {
            $adresseMapbox = "https://api.mapbox.com/v4/geocode/mapbox.places/{$adressePourUrl}.json?access_token=pk.eyJ1Ijoia2V2aW5zZSIsImEiOiJjaWZpZHhoOWkwMHdndGNseGRxc3A0d3U1In0.N5FbDKd9BQlcYh8bwsLVCA";
            $moissonMapbox = file_get_contents_utf8($adresseMapbox);
            $decodeMapbox = json_decode($moissonMapbox, true);
            if ($decodeMapbox[features][0]["geometry"]) {
                $stagiaireTraite[] = array($decodeMapbox[features][0]["geometry"]["coordinates"][0], $decodeMapbox[features][0]["geometry"]["coordinates"][1]);
                $i++;
                usleep(120);
            } else {
                $stagiaireTraite[] = false;
                // Aucune API n'a réussi à convertir l'adresse (RIP)
            }
        }
    }
    $sauvegardeResultats[] = $stagiaireTraite;
}
$renvoi["polyMap"] = $sauvegardeResultats;
$fichier = "../files/studentsPolytech2.geojson";
Exemplo n.º 14
0
$cachefile = $cachedir . md5($cachepage) . '.' . $cacheext;
if (@file_exists($cachefile)) {
    $cachelast = @filemtime($cachefile);
} else {
    $cachelast = 0;
}
@clearstatcache();
// Mostramos el archivo si aun no vence
if (time() - $cachetime < $cachelast) {
    // echo 'cache hit';
    echo file_get_contents($cachefile);
    exit;
}
ob_start();
$url = 'http://www.metrovias.com.ar/V2/InfoSubteSplash.asp';
$data = file_get_contents_utf8($url);
//pausecontent[\d+]\s=\s(.*);
// pausecontent[0] = '&nbsp;&nbsp;<b>L?nea A:</b>&nbsp; Servicio normal.';pausecontent[1] =
$results = preg_match_all('/pausecontent\\[[\\d+]\\]\\s=\\s\'([^\']+)\';/', $data, $matches);
$json = array();
foreach ($matches[1] as $line) {
    // echo $line . "\n";
    // $line = str_replace(array('&nbsp;', 'á', 'é', 'í', 'ó', 'ú'), array(' ', '&aacute;', '&eacute;', '&iacute;', '&oacute;', '&uacute;'), $line);
    $line = str_replace(array('&nbsp;'), array(' '), $line);
    // echo $line;
    // $line = str_replace(array('&nbsp;'), array(' '), $line);
    $line = strip_tags(html_entity_decode($line, ENT_QUOTES, 'UTF-8'));
    // preg_match('/nea\s([A-Z]{1}):.*(\s)([A-Za-z]+)\.?$/', $line, $data);
    preg_match('/nea\\s([A-Z]{1}):\\s\\s?(.*)/', $line, $data);
    // echo $line . "\n";
    $json[$data[1]] = array('status' => parseMessage($data[2]), 'message' => htmlentities($data[2], ENT_QUOTES, 'UTF-8'));
Exemplo n.º 15
0
<?php

if (is_post('url') == false) {
    die('no url');
}
$url = trim($_POST['url']);
$html = file_get_contents_utf8($url);
if ($html === false) {
    die('no response');
}
$h1 = get_text_between_tags($html, 'h1');
$title = get_text_between_tags($html, 'title');
/**
 * Controls image titles.
 */
if (stristr($url, '.jpg') || stristr($url, '.jpeg') || stristr($url, '.gif') || stristr($url, '.png')) {
    $parts = explode('/', $url);
    $title[] = "Image: " . end($parts);
}
if (stristr($url, '.pdf')) {
    $parts = explode('/', $url);
    $title[] = "PDF: " . end($parts);
}
if (isset($title[0]) == false || trim($title[0]) == "") {
    $title[0] = 'Untitled: ' . $url;
}
$h1 = array_map('trim', $h1);
$title = array_map('trim', $title);
$h1 = array_filter($h1, function ($str) {
    if ($str != '') {
        return true;
Exemplo n.º 16
0
<?php 
function file_get_contents_utf8($fn)
{
    $content = file_get_contents($fn);
    return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
$str = file_get_contents_utf8("http://www.meteosat.com/tiempo/almeria/tiempo-almeria.html");
$str2 = $str;
$str3 = $str;
$str = explode('<font size=4 color=#333333>', $str, 2);
//genera un $str['0'] y un $str['1']
$str = explode('</font>', $str['1'], 2);
$dia = $str['0'];
//$str['0'] contiene lo cortado
$num = count($pic);
$num = $num - 1;
//quitamos el error generado por el while
echo $dia;
$str3 = explode('<td class="pluss">', $str3, 2);
//genera un $str['0'] y un $str['1']
$str3 = explode('</td>', $str3['1'], 2);
$temperatura = $str3['0'];
//$str['0'] contiene lo cortado
echo $temperatura;
$recomendacion = "";
if ($temperatura < 20) {
    echo "<br>Hoy hará frio, se recomienda que se lleve una chaqueta. ";
    $recomendacion = "hoy+hara+frio+se+recomienda+que+se+lleve+una+chaqueta";
} else {
    if ($temperatura > 30) {
Exemplo n.º 17
0
    }
}
// load utilities
if (!$err && !@(include_once '../../../../private/MovieMasher/lib/idutils.php')) {
    $err = 'Problem loading utility script';
}
//move file and set its permissions
if (!$err) {
    $label = $file['name'];
    //$id = unique_id('media' . $label);
    $id = 'x' . $mash_id;
    $url = 'media/user/' . $id . '.' . $extension;
    $path = $upload_dir . $id . '.' . $extension;
    $dest_filepath = $CFG->dataroot . '/' . $moviemasher->course . '/moddata/moviemasher/' . $cm->id . '/' . $mash->user_id . '/' . $id . '.' . $extension;
    move_uploaded_file($file['tmp_name'], $dest_filepath);
    $mash->text = addslashes(file_get_contents_utf8($dest_filepath));
    if ($extension == "txt") {
        $mash->text = "<html> <pre style='word-wrap: break-word; white-space: pre-wrap;'>" . $mash->text . "</pre></html>";
    }
}
function file_get_contents_utf8($fn)
{
    $content = file_get_contents($fn);
    return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
update_record('moviemasher_mash', $mash);
//$err = 'kljlkj';
if ($err) {
    $attibs = 'get=\'javascript:alert("' . $err . '");\'';
} else {
    $attibs = 'trigger="browser.parameters.group=SL"' . ' get=\'javascript:window.parent.frames["player_frame"].location.reload();alert("Carregado");javascript:window.parent.showRecorder();\'';
Exemplo n.º 18
0
echo utf8_encode(file_get_contents("http://www.rimforsafk.se" . $root . "getcomps.php?count=2"));
?>
				
				<div class="comp-item last" >
					<a href="<?php 
echo $root;
?>
tavlingar">Alla tävlingar</a>
				</div>
			</div>
				
			<div class="guestbook col-xs-3 col-md-2 right-column">				
				<h3><span class="vertical-centered">Gästbok</span></h3>
				<?php 
//Load the two latest guestbook posts
echo file_get_contents_utf8("http://www.rimforsafk.se" . $root . "getposts.php?count=2&start=1");
?>
				<div class="gb-post last">
					<a href="<?php 
echo $root;
?>
gastbok">Till gästboken</a>
				</div>
			</div>
				
			<footer class="col-xs-12 col-md-12">
				<hr>
        <?php 
//Update latest updated message
$gb = "uppdaterad.txt";
$fh = fopen($gb, 'r');
Exemplo n.º 19
0
 /**
  * create a child parser (for compiling an import)
  * @param $fname
  *
  * @return RokBooster_Compressor_CssAggregator
  */
 protected function createChild($fname)
 {
     $css = new self(@file_get_contents_utf8($fname), $this->rootDir);
     return $css;
 }
Exemplo n.º 20
0
<?php

function file_get_contents_utf8($fn)
{
    $content = file_get_contents($fn);
    return mb_convert_encoding($content, 'UTF-8', mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true));
}
require 'variables.php';
$con = mysqli_connect("rimforsafk.se.mysql", "rimforsafk_se", INSERT_PASSWORD_HERE, "rimforsafk_se");
$sql = "DROP TABLE Guestbook";
mysqli_query($con, $sql);
$sql = "CREATE TABLE Guestbook\n    (\n      ID int AUTO_INCREMENT,\n      name varchar(255) NOT NULL ,\n      description varchar(255) NOT NULL,\n      time varchar(255) NOT NULL,\n      PRIMARY KEY (ID)\n    )";
mysqli_query($con, $sql);
$gb_path = $file_system_path . "/gb/";
$pattern = "/.*<b>(.*) skrev<\\/b><br><br>(.*)/";
for ($i = 15; $i <= 281; $i++) {
    $file_path = "{$gb_path}{$i}.txt";
    $text = file_get_contents_utf8($file_path);
    preg_match($pattern, $text, $matches);
    $name = $matches[1];
    $message = $matches[2];
    $file_path = $gb_path . "d" . "{$i}.txt";
    $text2 = file_get_contents_utf8($file_path);
    $sql = "INSERT INTO Guestbook VALUES (NULL, '" . utf8_encode($name) . "', '" . utf8_encode($message) . "', '" . $text2 . "')";
    mysqli_query($con, $sql);
}