Zatim ime fajla i određene podatke iz njega snima u svoj jedan novi .ini fajl.
Problem je u tome što se imena fajlova koji sadrže naša slova ne upišu dobro već umesto naših slova imam znak ?
Koristim Windows 8 i aplikaciju WAMP kao apache+php server. Najluđe je što ortaku sve normalno čita, on ima neki linuks i ne znam šta koristi kao servere, kaže jedino nam se apache možda razlikuje. Probao sam da instaliram XAMPP na ubuntu, ali .run fajl se ne pokreće, niš se ne dešava, dao sam mu chmod i pokrećem ga duplim klikom, run with, ./ ma ništa se ne desi tako da ne mogu da probam iz linuxa.
Windows mi u regional settings pa bla truć ima Serbian latin za encoding.
U php.ini sam upisao
mbstring.language = "uni" (probao i sa sr_RS)
mbstring.internal_encoding = "UTF-8"
mbstring.http_input = "UTF-8"
mbstring.http_output = "UTF-8"
U httpd.conf
AddDefaultCharset utf-8
Kod, malo prećerah šta sve nisam upisao al opet džaba, probao sam i da uvijam inpute u utf8_encode decode i čuda al džaba isto:
<?php
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
header('Content-Type: text/html; charset=utf-8');
setlocale(LC_ALL, 'sr_RS.UTF-8@latin', 'sr_RS.UTF-8@Latn', 'sr_CS.UTF-8@Latn');
$path_to_check = 'C:\Users\oktopod\AppData\Roaming\VanDyke\Config\Sessions\\';
$hostname = 'Hostname'; $protocol = '"Protocol Name"'; $current = ''; $file = 'sessions.ini';
$matchesHost[1]=$matchesIP[1]=$matchesProtocol[1]='';
foreach(glob($path_to_check.'*.ini') as $filename)
{
foreach(file($filename) as $fli=>$fl)
{
if(mb_strpos($fl, $hostname, 0, 'UTF-8')!==false)
{
$result = $filename.' on line '.($fli+1).': '.$fl;
echo $result; echo "<br />";
preg_match("/Sessions\\\(.*?)\b.ini\b/", $result, $matchesHost);
preg_match("/Hostname\"=(.*?)$/", $result, $matchesIP);
$matchesHost[1] = trim($matchesHost[1]); $matchesIP[1] = trim($matchesIP[1]);
$current .= $matchesHost[1] . "##" . $matchesIP[1] ."\n";
file_put_contents($file, $current);
}
}
}
?>
Primer komada fajla, snimiti kao npr Bežanija.ini u path koji podesite u $path_to _check varijablu
D:"Is Session"=00000001
S:"Protocol Name"=SSH2
D:"Request pty"=00000001
S:"Shell Command"=
D:"Use Shell Command"=00000000
D:"Force Close On Exit"=00000000
D:"Forward X11"=00000000
S:"XAuthority File"=
S:"XServer Host"=127.0.0.1
D:"XServer Port"=00001770
D:"XServer Screen Number"=00000000
D:"Enforce X11 Authentication"=00000001
D:"Request Shell"=00000001
D:"Max Packet Size"=00001000
D:"Pad Password Packets"=00000001
S:"Sftp Tab Local Directory"=C:\Users\oktopod\Documents
S:"Sftp Tab Remote Directory"=
S:"Hostname"=192.168.192.168