//ustawianie domyslnie sortowania dla liter wg. tablic
If(!isset($show)){
$show="last";
}
If(isset($show) and $show <> "last"){
$sort2 = "tab";
}
?>
// MySQL settings
$db_user = "gtdpl"; // MySQL username
$db_pass = "ola1605darek"; // MySQL password
$db_host = "localhost"; // MySQL host, mostly localhost
$db_db = "gtdpl"; // MySQL database
//Polaczenie do bazy...
$link = mysql_connect($db_host, $db_user , $db_pass )
or die('Nie można się połączyć: ' . mysql_error());
mysql_query('SET character_set_connection=utf8_polish_ci');
mysql_query('SET character_set_client=utf8_polish_ci');
mysql_query('SET character_set_results=utf8_polish_ci');
mysql_query('SET NAMES utf8 ');
//print ('Połączenie nawiązane');
mysql_select_db ($db_db, $link)
or die('Nie można wybrać bazy danych');
// print ('Baza wybrana');
//mysql_close($link); //zamknij polaczenie
?>
//formaty daty
function DateFormat($timestamp) {
global $weekday,$months,$offset,$dformat,$tformat;
list($wday,$nday,$mday,$day,$smonth,$mmonth,$month,$year,$syear,$hour,$minutes,$hour12,$ampm) = split("( )",date("w D d j m F n Y y H i h A",$timestamp));
$hour += $offset;
if ($tformat == "AMPM") {
$newtime = "$hour12:$minutes $ampm";
} elseif($tformat == "indeks_gorny") {
$newtime = "$hour:$minutes";
} else {
$newtime = "$hour:$minutes";
}
If($tformat != "notime" and $tformat != "beznawiasow"){
$newtime = ' ['.$newtime.']';
}elseif ($tformat == "beznawiasow"){
$newtime = $newtime;
}else{
$newtime = '';
}
if ($dformat == "USx") {
$newdate = "$mday-$month-$year";
} elseif ($dformat == "USx2") {
If($hour == "1" and $minutes == "01" and $year <= "1999"){
$newdate = "$year";
$d_typ = "y";
}
else{
$newdate = "$year-$month-$mday";
$d_typ = "n";
}
} elseif ($dformat == "USxG") {
If($hour == "1" and $minutes == "01" and $mday == "1"){
$newdate = "$year-00-00";
$d_typ = "y";
}
else{
$newdate = "$year-$month-$mday";
$d_typ = "n";
}
} elseif ($dformat == "US") {
$month -= 1;
$newdate = "$mday, $month, $year";
} elseif ($dformat == "Euro") {
$month -= 1;
$newdate = "$day $mmonth $year";
} elseif ($dformat == "Euro1") {
$month -= 1;
$newdate = "$day $mmonth $year";
} elseif ($dformat == "Normal1") {
$newdate = "$mday-$month-$year";
} elseif ($dformat == "Darus") {
$month -= 1;
$newdate = "$mday$smonth$syear";
} elseif ($dformat == "Darus2") {
$month -= 1;
$newdate = "$mday.$smonth.$year";
} elseif ($dformat == "Darus3") { //do poczekalni...
$month -= 1;
$newdate = "$mday.$smonth.$year";
} elseif ($dformat == "Darus-day") { //do poczekalni...
$month -= 1;
$newdate = "$nday";
} elseif ($dformat == "noday") { //do poczekalni...
$month -= 1;
$newdate = "";
}
elseif ($dformat == "EuroG") {
If($hour == "1" and $minutes == "01" and $mday == "1"){
$newdate = "$year";
$d_typ = "y";
}
else{
$newdate = "$day.$mmonth.$year";
$d_typ = "n";
}
} else {
If($hour == "1" and $minutes == "01" and $year <= "1999"){
$newdate = "$year";
$d_typ = "y";
}
else{
$newdate = "$mday.$month.$year";
$d_typ = "n";
}
}
return ($newdate=$newdate.$newtime);
//return ($newdate=$newdate.$newtime);
}
// zamina w dacie z ang na polskie nazwy miesięcy
If(isset($dformat) and $dformat == "Euro"){
$date = str_replace("January","Styczeń",$date);
$date = str_replace("February","Luty",$date);
$date = str_replace("March","Marzec",$date);
$date = str_replace("April","Kwiecień",$date);
$date = str_replace("May","Maj",$date);
$date = str_replace("June","Czerwiec",$date);
$date = str_replace("July","Lipiec",$date);
$date = str_replace("August","Sierpień",$date);
$date = str_replace("September","Wrzesień",$date);
$date = str_replace("October","Październik",$date);
$date = str_replace("November","Listopad",$date);
$date = str_replace("December","Grudzień",$date);
}
?>
If($is_klucz == date('YxxtMv')){ //zabezp. przed wczytywaniem statystyk
$ip=getenv("REMOTE_ADDR"); //adres IP wchodzacego...
$zapytanie_iw = "SELECT * FROM ".$is_baza." WHERE ip='$ip' ORDER BY data DESC limit 1";
$wynik_iw = mysql_query($zapytanie_iw);
$iw_stats = mysql_num_rows($wynik_iw);
//ustawienie flagi na swoim IP
If($ip == "62.93.96.14"){
$flag = "M";
}else{
$flag = "";
}
///////////
If($iw_stats == 0){
//wpis do bazy nowego wejscia...
$date = time();
$ip=getenv("REMOTE_ADDR");
$zapytanie="INSERT INTO ".$is_baza." SET data='$date', ip='$ip', host='', flag='$flag'";
$wynik = mysql_query($zapytanie);
} elseif($iw_stats >= 1){
//wejscie kontrolowane...(ip juz istnieje...)
$date = time();
while($rekord = mysql_fetch_array($wynik_iw)) {
$data_remote = $rekord['data'];
}
$data_remote_plus = $data_remote + 5000;
If($data_remote_plus < $date){
// //wpis do bazy...
$zapytanie_up="INSERT INTO ".$is_baza." SET data='$date', ip='$ip', host='', flag='$flag'";
$wynik_up = mysql_query($zapytanie_up);
}else{
// //pominiecie..za maly odstep czasowy..
//
}
}
}//koniec zabezp. wczytywania osobno statystyk...
//OBLICZANIE WEJSC...
$zapytanie_iw_all = "SELECT * FROM ".$is_baza." WHERE flag<>'M' ORDER BY data";
$wynik_iw_all = mysql_query($zapytanie_iw_all);
$iw_all_stats = mysql_num_rows($wynik_iw_all); //+200 jesli chcemy podpic statsy...
$iw_all_stats_txt = "
Stronę odwiedzono już ".$iw_all_stats." razy.
";
?>