// config.ini.php
$admin["user"] = "admin";
$admin["haslo"] = "saonetnet";
$max_waznosc = 30; // w dniach
set_time_limit(30*10);
$host = "localhost";
$username = "pruszkow";
$pass = "saonetp";
$wynik = mysqli_connect($host, $username, $pass, "pruszkow");
// $wynik = mysql_connect("localhost","pruszkow","saonetp");
if(!$wynik) {
echo "Nie mozna polaczyc sie z baza danych :(";
exit;
}
//mysql_select_db(pruszkow);
//////////////////////////////
// pobieranie obrazka
$zdjecia['rozmiar'] = 7000; // w bajtach
$zdjecia['width'] = 111; // w pixelach
$zdjecia['height'] = 86; // w pixelach
//////////////////////////////
$sciezka = $_SERVER["DOCUMENT_ROOT"] . "/drobne/"; // bezwzgledny adres do katalogu glownego
$oddzielacz = "
";
/////// TABLICA NAPISOW GRAFICZNYCH ////////////////////
////////////////////////////////////////////////////////
///////////////////////////////////////////////////////
while(list($key, $val) = each($_GET)) {
$$key = $val;
}
function wczytaj($plik) {
if(file_exists($plik)) {
include $plik;
}
else {
echo "nie mozna wczytac pliku: $plik.";
}
}
function iso($tresc, $kodowanie=false, $co_zrobic=false) {
if(!$co_zrobic) {
$tresc_back = $tresc;
}
if(!$kodowanie) {
$kodowanie= "iso";
}
if($kodowanie=="iso") {
$tresc = ereg_replace("¡", "¡", $tresc);
$tresc = ereg_replace("¦", "¦", $tresc);
$tresc = ereg_replace("¯", "¬", $tresc);
$tresc = ereg_replace("±", "±", $tresc);
$tresc = ereg_replace("¶", "¶", $tresc);
$tresc = ereg_replace("¼", "¼", $tresc);
}
if($kodowanie=="win") {
$tresc = ereg_replace("¡", "¡", $tresc);
$tresc = ereg_replace("¦", "¦", $tresc);
$tresc = ereg_replace("¬", "¯", $tresc);
$tresc = ereg_replace("±", "±", $tresc);
$tresc = ereg_replace("¶", "¶", $tresc);
$tresc = ereg_replace("¼", "¼", $tresc);
}
if($kofowanie=="ascii") {
$tresc = ereg_replace("¡", "A", $tresc);
$tresc = ereg_replace("¦", "S", $tresc);
$tresc = ereg_replace("¬", "Z", $tresc);
$tresc = ereg_replace("±", "a", $tresc);
$tresc = ereg_replace("¶", "s", $tresc);
$tresc = ereg_replace("¼", "z", $tresc);
}
if(!$co_zrobic) {
echo $tresc;
$tresc = $tresc_back;
}
else {
return $tresc;
}
}
# klasa, ktora zawiera odpowiada za kategorie ogloszen
class Ogloszenia {
var $kategorie;
function kategorie() {
global $sciezka;
if(file_exists("$sciezka/pliki/dane/lista.m[]") ) {
$f = file("$sciezka/pliki/dane/lista.m[]");
while (list ($key, $val) = each ($f)) {
$this -> kat['kolej'][] = ++$key;
$n = explode(";", $val);
$this -> kat['id'][] = $n[0];
$this -> kat['name'][] = chop($n[1]);
$this -> kat['mini_name'][] = chop($n[2]);
}
}
else {
echo "Nie mozna polaczyc sie z baza danych.";
}
}
function opis($id) {
global $sciezka;
$f = file("$sciezka/pliki/dane/lista.m[]");
while (list ($key, $val) = each ($f)) {
$n = split(";", $val);
if($n[0]==$id) {
return chop($n[1]);
$yest = 1;
break;
}
}
if(!$yest) { return "brak opisu dla id $id"; }
}
}
function ilosc_kolumn($ile_kolumn, $idy, $co, $b1) {
$podzielono = count($idy)/$ile_kolumn;
$podzielono = round($podzielono);
$kod = $licznik = $licznik = null;
for($x=0; $x < count($idy); $x++) {
$zapytanie = "SELECT COUNT(*) AS ILE FROM DROBNE WHERE DZIAL = '$idy[$x]' AND (TO_DAYS(WAZNE_DO) - TO_DAYS(NOW() ) ) > 0";
$wynik4 = mysqli_query ($b1, $zapytanie);
$wiersz = mysqli_fetch_array($wynik4, MYSQLI_ASSOC);
$kod .="» $co[$x] | [". $wiersz['ILE'] ."] |
\n";
$licznik++;
$licznik2++;
if($licznik==$podzielono && $licznik2!=count($idy)) {
$kod .= " | ";
$licznik = 0;
}
}
return $kod;
}
$ogloszenia = new Ogloszenia();
?>
|