='$today') AND (idkategorije='1')"; $result2= mysql_query($query2); $nakup = mysql_result($result2,0,"COUNT(*)"); $query3 = "SELECT COUNT(*) FROM oglasi WHERE (veljavnost>='$today') AND (idkategorije='2')"; $result3= mysql_query($query3); $prodaja = mysql_result($result3,0,"COUNT(*)"); $query4 = "SELECT COUNT(*) FROM oglasi WHERE (veljavnost>='$today') AND (idkategorije='3')"; $result4= mysql_query($query4); $izposoja = mysql_result($result4,0,"COUNT(*)"); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
  
"; echo "

 
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 "; echo ""; echo ""; echo ""; echo ""; //***************************************************************************** if ((isset($_GET['action'])) || (isset($_POST['action']))){ if (isset($_GET['action']) ==""){ $action = $_POST['action']; } else { $action = $_GET['action']; } if ($action == "prikazoglasa") { Oglas(); } if ($action == "kategorija") { Kategorija(); } } else { Zadnihpet (); } //************************************************** // le za prikazoglasa if ((isset($_GET['action'])) || (isset($_POST['action']))){ if (isset($_GET['action']) ==""){ $action = $_POST['action']; } else { $action = $_GET['action']; } if ($action !="kategorija") { echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Izberite kategorijo:
 
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
NAKUP($nakup)
PRODAJA($prodaja)
IZPOSOJA($izposoja)
"; echo "
"; echo "
 
Vpis novega oglasa!
"; echo "

 

"; echo "

 

"; echo "

 

"; echo "
 
"; echo "
 
"; echo "
 
"; } } } function Zadnihpet () { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Zadnjih 5 vpisov:
 
"; echo ""; $today = date("Y-m-d"); $query = "SELECT * FROM oglasi WHERE veljavnost>='$today' ORDER BY id DESC LIMIT 5"; $result= mysql_query($query); $num = mysql_num_rows($result); $i=0; while ($i < $num) { $idoglasa = mysql_result($result,$i,"id"); $naslov = mysql_result($result,$i,"naslov"); $opis = mysql_result($result,$i,"dodatek"); $cena = mysql_result($result,$i,"cena"); $url1 = mysql_result($result,$i,"url1"); // dobim pravilen format datuma $vpissql = mysql_result($result,$i,"vpis"); $datearr = split('-',$vpissql); $tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]); $vpis = date('d.m.Y',$tstamp); //se ponavljajo oglasi (en oglas) echo ""; echo ""; echo ""; $i++; } //od while // konec enega oglasa echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
$naslov$vpis
"; echo "
"; echo ""; echo ""; echo ""; if ($url1 != "") { //dobim url slike global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm1 = replacestring('v_','m_',$url1); $slika1 = $g_imagesurl . $url1; $slikam1 = $g_imagesurl . $urlm1; echo ""; } else { echo ""; } echo ""; echo "
"; echo ""; if ($opis !="") { echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo "
Opis:$opis
Cena:$cena
"; echo "
"; echo "
 
"; echo "
"; echo "
 
"; echo ""; // konec iz Oglas prikaz (ker je action="" if ne potegne) echo ""; echo ""; echo ""; echo " "; echo ""; echo ""; echo ""; echo ""; echo ""; echo " "; echo ""; echo ""; } function Kategorija () { if ( isset($_GET['idkategorije'])) { $idkategorije = $_GET['idkategorije']; } if ( isset($_GET['start'])) { $start = $_GET['start']; } else { $start=0; } if ( isset($_GET['stran'])) { $stran = $_GET['stran']; } else { $stran=1; } echo ""; echo ""; echo ""; if ($idkategorije==1) { echo ""; } if ($idkategorije==2) { echo ""; } if ($idkategorije==3) { echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
NAKUP:PRODAJA:IZPOSOJA:
 
"; echo ""; global $g_nastran; $today = date("Y-m-d"); $query2 = "SELECT COUNT(*) FROM oglasi WHERE (veljavnost>='$today') AND (idkategorije='$idkategorije')"; $result2= mysql_query($query2); $count = mysql_result($result2,0,'count(*)'); $strani = round($count/$g_nastran+0.49); $query = "SELECT * FROM oglasi WHERE (veljavnost>='$today') AND (idkategorije='$idkategorije') ORDER BY id DESC LIMIT $start,$g_nastran"; $result= mysql_query($query); $num = mysql_num_rows($result); $i=0; while ($i < $num) { $idoglasa = mysql_result($result,$i,"id"); $naslov = mysql_result($result,$i,"naslov"); $opis = mysql_result($result,$i,"dodatek"); $cena = mysql_result($result,$i,"cena"); $url1 = mysql_result($result,$i,"url1"); // dobim pravilen format datuma $vpissql = mysql_result($result,$i,"vpis"); $datearr = split('-',$vpissql); $tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]); $vpis = date('d.m.Y',$tstamp); //se ponavljajo oglasi (en oglas) echo ""; echo ""; echo ""; $i++; } //od while // konec enega oglasa echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
$naslov$vpis
"; echo "
"; echo ""; echo ""; echo ""; if ($url1 != "") { //dobim url slike global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm1 = replacestring('v_','m_',$url1); $slika1 = $g_imagesurl . $url1; $slikam1 = $g_imagesurl . $urlm1; echo ""; } else { echo ""; } echo ""; echo "
"; echo ""; if ($opis !="") { echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo "
Opis:$opis
Cena:$cena
"; echo "
"; echo "
 
"; echo "
"; echo "
 
"; echo ""; //iz Oglasnik prikaz (na koncu) echo ""; echo ""; echo ""; echo " "; echo ""; echo ""; echo ""; echo ""; // številka strani *************************************************************** $s=0; $start=0; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; //DODAN echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; if ($stran==1) { echo ""; } else { $strannazaj="$stran" - "1"; $startnazaj=("$strannazaj"-"1")*$g_nastran; echo ""; } echo ""; if ($stran==$strani) { echo ""; } else { $strannaprej="$stran" + "1"; $startnaprej=("$strannaprej"-"1")*$g_nastran; echo ""; } //echo ""; echo ""; echo "
Stran $stran / $strani"; while($s < $strani ){ $s++; if ($stran==$s) { echo " $s"; } else { echo " [ $s ]"; } $start = $start + $g_nastran; } // while echo "
nazaj
|
naprej naprej 
"; echo "
"; echo "
 
"; echo ""; echo ""; // konec številke strani*************************************************************** echo ""; echo " "; echo ""; echo ""; } function Oglas(){ if ( isset($_GET['idoglasa'])) { $idoglasa = $_GET['idoglasa']; } if ( isset($_GET['urlizbrana'])) { $urlizbrana = $_GET['urlizbrana']; } else { $urlizbrana = ""; } $query = "SELECT * FROM oglasi WHERE id='$idoglasa'"; $result= mysql_query($query); $naslov = mysql_result($result,0,"naslov"); $opis = mysql_result($result,0,"dodatek"); $cena = mysql_result($result,0,"cena"); $godba = mysql_result($result,0,"godba"); $imepriimek = mysql_result($result,0,"imepriimek"); $telefon = mysql_result($result,0,"telefon"); $email = mysql_result($result,0,"email"); $url1 = mysql_result($result,0,"url1"); $url2 = mysql_result($result,0,"url2"); $url3 = mysql_result($result,0,"url3"); // dobim pravilen format datuma $vpissql = mysql_result($result,0,"vpis"); $datearr = split('-',$vpissql); $tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]); $vpis = date('d.m.Y',$tstamp); $veljavnostsql = mysql_result($result,0,"veljavnost"); $datearr2 = split('-',$veljavnostsql); $tstamp2 = mktime(0,0,0,$datearr2[1],$datearr2[2],$datearr2[0]); $veljavnost = date('d.m.Y',$tstamp2); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
$naslov
 
"; echo ""; if ($opis !="") { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Opis:$opis
Cena:$cena
Naziv godbe:$godba
Kontaktna oseba: $imepriimek
Telefon:$telefon
E-mail:$email
Datum vpisa:$vpis
Datum veljavnosti:$veljavnost
"; echo "
 
"; echo ""; echo ""; //echo ""; if (($urlizbrana == "") OR ($urlizbrana == 1)) { if ($url1 !="") { //dobim url slike global $g_imagesurl,$g_IMG_SREDNJA_WIDTH,$g_IMG_SREDNJA_HEIGHT; $urls1 = replacestring('v_','s_',$url1); $slikas1 = $g_imagesurl . $urls1; echo ""; } // else { // echo ""; // } } if ($urlizbrana == 2) { //dobim url slike global $g_imagesurl,$g_IMG_SREDNJA_WIDTH,$g_IMG_SREDNJA_HEIGHT; $urls2 = replacestring('v_','s_',$url2); $slikas2 = $g_imagesurl . $urls2; echo ""; } if ($urlizbrana == 3) { //dobim url slike global $g_imagesurl,$g_IMG_SREDNJA_WIDTH,$g_IMG_SREDNJA_HEIGHT; $urls3 = replacestring('v_','s_',$url3); $slikas3 = $g_imagesurl . $urls3; echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; if (($url1 !="") AND ($url2 !="")) { global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm1 = replacestring('v_','m_',$url1); $slikam1 = $g_imagesurl . $urlm1; echo ""; } else { echo ""; } echo ""; if ($url2 !="") { global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm2 = replacestring('v_','m_',$url2); $slikam2 = $g_imagesurl . $urlm2; echo ""; } else { echo ""; } echo ""; if ($url3 !="") { global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm3 = replacestring('v_','m_',$url3); $slikam3 = $g_imagesurl . $urlm3; echo ""; } else { echo ""; } echo ""; echo "
   
"; echo "
 
"; echo "
"; echo ""; } function Vpisoglasa() { if ( isset($_POST['kategorija'])) { $kategorija = $_POST['kategorija']; } else { $kategorija=0; } if ( isset($_POST['ime_priimek'])) { $ime_priimek = $_POST['ime_priimek']; } else { $ime_priimek=""; } if ( isset($_POST['godba'])) { $godba = $_POST['godba']; } else { $godba=""; } if ( isset($_POST['telefon'])) { $telefon = $_POST['telefon']; } else { $telefon=""; } if ( isset($_POST['email'])) { $email = $_POST['email']; } else { $email=""; } if ( isset($_POST['cena'])) { $cena = $_POST['cena']; } else { $cena=""; } if ( isset($_POST['naslov'])) { $naslov = $_POST['naslov']; } else { $naslov=""; } if ( isset($_POST['opis'])) { $opis = $_POST['opis']; } else { $opis=""; } if ( isset($_POST['veljavnost'])) { $veljavnost = $_POST['veljavnost']; } else { $veljavnost=""; // $veljavnost= date("d.m.Y"); // $veljavnost = mktime(0, 0, 0, date("m")+1, date("d"), date("Y")); } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
  
"; echo "

 
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 "; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Vpis novega oglasa!
"; echo ""; echo ""; echo ""; echo ""; //echo ""; } if ($kategorija == 2) { echo ""; echo ""; echo " *"; } if ($kategorija == 3) { echo ""; echo ""; echo " *"; } } else { echo ""; echo ""; echo ""; echo " *"; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Rubrika: *
Ime in priimek: *
Naziv godbe: *
Telefon: *
Vaš E-mail: *
Cena: *
Veljavnost oglasa:"; echo ""; echo "Koledar *
Naslov oglasa: *
Dodaten opis:
Priloge:Vstavite lahko do 3 fotografije. Najprej potrdite oglas!
  
 "; echo ""; echo ""; echo "
"; echo "

Polja označena z * so obvezna za vpis!
"; echo "
 
"; echo "
 
"; } function Potrdioglas() { if ( isset($_POST['kategorija'])) { $kategorija = $_POST['kategorija']; } else { $kategorija=0; } if ( isset($_POST['ime_priimek'])) { $ime_priimek = $_POST['ime_priimek']; } else { $ime_priimek=""; } if ( isset($_POST['godba'])) { $godba = $_POST['godba']; } else { $godba=""; } if ( isset($_POST['telefon'])) { $telefon = $_POST['telefon']; } else { $telefon=""; } if ( isset($_POST['email'])) { $email = $_POST['email']; } else { $email=""; } if ( isset($_POST['cena'])) { $cena = $_POST['cena']; } else { $cena=""; } if ( isset($_POST['naslov'])) { $naslovobr = $_POST['naslov']; $naslov = str_replace("\r\n","
",$naslovobr); } else { $naslov=""; } if ( isset($_POST['opis'])) { $opisobr = $_POST['opis']; $opis = str_replace("\r\n","
",$opisobr); } else { $opis=""; } if ( isset($_POST['veljavnost'])) { $veljavnost = $_POST['veljavnost']; $veljavnostd = substr($veljavnost,0,2); $veljavnostm = substr($veljavnost,3,2); $veljavnosty = substr($veljavnost,6,4); $veljavnostsql = $veljavnosty.$veljavnostm.$veljavnostd; } else { $veljavnost=""; } $vpis = date("Y.m.d"); $query1 = "SELECT max(id) FROM oglasi"; $rezultat=mysql_query($query1); $id=mysql_result($rezultat,0,"max(id)"); $id = "$id" + "1"; $query2 = "INSERT INTO oglasi VALUES ('$id','$ime_priimek','$godba','$telefon','$email','$naslov','$opis','$kategorija','','','','$veljavnostsql','$vpis','$cena')"; mysql_query($query2); Dodajsliko(); } function Dodajsliko() { if ( isset($_POST['idoglasa'])) { $idoglasa = $_POST['idoglasa']; } else { $query1 = "SELECT max(id) FROM oglasi"; $rezultat=mysql_query($query1); $idoglasa=mysql_result($rezultat,0,"max(id)"); } $query="SELECT * FROM oglasi WHERE id=$idoglasa"; $result=mysql_query($query); $kategorija = mysql_result($result,0,"idkategorije"); $ime_priimek=mysql_result($result,0,"imepriimek"); $godba=mysql_result($result,0,"godba"); $telefon=mysql_result($result,0,"telefon"); $email=mysql_result($result,0,"email"); $cena=mysql_result($result,0,"cena"); $naslov=mysql_result($result,0,"naslov"); $opis=mysql_result($result,0,"dodatek"); $url1=mysql_result($result,0,"url1"); $url2=mysql_result($result,0,"url2"); $url3=mysql_result($result,0,"url3"); // preformatiram datum iz baze YYYY-MM-DD v dd.mm.YYYY $veljavnostsql=mysql_result($result,0,"veljavnost"); $datearr = split('-',$veljavnostsql); $tstamp = mktime(0,0,0,$datearr[1],$datearr[2],$datearr[0]); $veljavnost = date('d.m.Y',$tstamp); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
  
"; echo "

 
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 "; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Vpis novega oglasa!
"; echo ""; echo ""; echo ""; echo ""; } if ($kategorija == 2) { echo "PRODAJA"; } if ($kategorija == 3) { echo "IZPOSOJA"; } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; if ($opis !="") { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Rubrika:"; if ($kategorija == 1) { echo "NAKUP
Ime in priimek:$ime_priimek
Naziv godbe:$godba
Telefon:$telefon
Vaš E-mail:$email
Cena:$cena
Veljavnost oglasa:$veljavnost
Naslov oglasa:$naslov
Dodaten opis:$opis
Priloge:"; echo ""; if (($url1=="") OR ($url2=="") OR ($url3=="")){ global $g_MAX_FILE_SIZE; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //od if if ($url1 != "") { //dobim url slik global $g_imagesurl,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT; $urlm1 = replacestring('v_','m_',$url1); $slika1 = $g_imagesurl . $url1; $slikam1 = $g_imagesurl . $urlm1; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //od if //echo ""; //echo ""; //echo ""; //echo ""; //echo ""; echo "
"; echo ""; echo "
*tu lahko vstavite do 3 fotografije:
"; echo ""; echo ""; echo ""; echo ""; echo "
 
"; echo ""; echo ""; echo ""; echo ""; if ($url2 != "") { //dobim url slik $urlm2 = replacestring('v_','m_',$url2); $slika2 = $g_imagesurl . $url2; $slikam2 = $g_imagesurl . $urlm2; echo ""; echo ""; } //od if if ($url3 != "") { //dobim url slik $urlm3 = replacestring('v_','m_',$url3); $slika3 = $g_imagesurl . $url3; $slikam3 = $g_imagesurl . $urlm3; echo ""; } //od if echo ""; echo ""; echo "
"; echo "
"; //echo "
"; echo "
"; echo "
"; echo "
 
"; echo "
 
"; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 Vpisan oglas bo objavljen do vklučno $veljavnost. 
"; echo "
"; } function Shranisliko (){ $idoglasa = $_POST['idoglasa']; $url1 = $_POST['url1']; $url2 = $_POST['url2']; $url3 = $_POST['url3']; global $g_uploaddir,$g_IMG_MALA_WIDTH,$g_IMG_MALA_HEIGHT,$g_IMG_SREDNJA_WIDTH,$g_IMG_SREDNJA_HEIGHT; $imeo = basename($_FILES['FileName']['name']); $imev = "v_$idoglasa$imeo"; $uploadfile = $g_uploaddir . $imev; $url = basename($uploadfile); //vzame le osnovno ime (ime fila) if(trim($uploadfile) != "") { //se naredimo resize $IMG_MALA_WIDTH = $g_IMG_MALA_WIDTH; $IMG_MALA_HEIGHT = $g_IMG_MALA_HEIGHT; $IMG_SREDNJA_WIDTH = $g_IMG_SREDNJA_WIDTH; $IMG_SREDNJA_HEIGHT = $g_IMG_SREDNJA_HEIGHT; $JPG_QUALITY = 90; $use_imagecreatetruecolor = true; // enejbla ImageCreateTrueColor(); ImageCopyResampled(); $use_imagecopyresampled = true; $filename_mala =replacestring('v_','m_',$uploadfile); $filename_srednja =replacestring('v_','s_',$uploadfile); // $src_img=imagecreatefromjpeg($uploadfile); if (move_uploaded_file($_FILES['FileName']['tmp_name'],$uploadfile)) { // echo "File is valid, and was successfully uploaded.\n"; $img_sz = getimagesize( $uploadfile); $img_sz2= $img_sz[2]; if ($img_sz2 == 2) { //če je file JPG $src_img = ImageCreateFromJpeg($uploadfile); // switch( $img_sz[2] ){ // case 1: // Dodajsliko(); // echo "Izbrana vrsta datoteke (.GIF) ni podprta"; // break; // case 2: // $src_img = ImageCreateFromJpeg($uploadfile); // $img_type = "JPG"; // break; // case 3: // $src_img = ImageCreateFromPng($uploadfile); // $img_type = "PNG"; // break; // case 4: // $src_img = ImageCreateFromSwf($uploadfile); // $img_type = "SWF"; // break; // default: die("Izbrana vrsta datoteke ni podprta"); // } $old_x=imageSX($src_img); $old_y=imageSY($src_img); //najprej naredimo malo if ($old_x > $old_y) { $thumb_w=$IMG_MALA_WIDTH; $thumb_h= ceil($IMG_MALA_WIDTH * ($old_y / $old_x)); $thumb_ws=$IMG_SREDNJA_WIDTH; $thumb_hs= ceil($IMG_SREDNJA_WIDTH * ($old_y / $old_x)); } if ($old_x < $old_y) { $thumb_w= $IMG_MALA_WIDTH; $thumb_h= ceil($IMG_MALA_WIDTH * ($old_y / $old_x)); $thumb_ws= $IMG_SREDNJA_WIDTH; $thumb_hs= ceil($IMG_SREDNJA_WIDTH * ($old_y / $old_x)); } if ($old_x == $old_y) { $thumb_w=$IMG_MALA_WIDTH; $thumb_h=$IMG_MALA_HEIGHT; $thumb_ws=$IMG_SREDNJA_WIDTH; $thumb_hs=$IMG_SREDNJA_HEIGHT; } //za malo if( $use_imagecreatetruecolor && function_exists("imagecreatetruecolor")){ $dst_img = imagecreatetruecolor($thumb_w,$thumb_h) or die("Neušpesno izdelava male slike!"); $dst_imgs = imagecreatetruecolor($thumb_ws,$thumb_hs) or die("Neušpesno izdelava srednje slike!"); } else { $dst_img = imagecreate($thumb_w,$thumb_h) or die("Neušpesno izdelava male slike!"); $dst_imgs = imagecreate($thumb_ws,$thumb_hs) or die("Neušpesno izdelava srednje slike!"); } if($use_imagecopyresampled && function_exists("imagecopyresampled")){ imagecopyresampled($dst_img,$src_img, 0, 0, 0, 0,$thumb_w,$thumb_h,$old_x,$old_y) or die("Neušpesno resizanje male slike @ ImageCopyResampled()"); imagecopyresampled($dst_imgs,$src_img, 0, 0, 0, 0,$thumb_ws,$thumb_hs,$old_x,$old_y) or die("Neušpesno resizanje srednje slike @ ImageCopyResampled()"); }else{ imagecopyresized($dst_img,$src_img, 0, 0, 0, 0,$thumb_w,$thumb_h,$old_x,$old_y) or die("Neušpesno resizanje male slike @ ImageCopyResized()"); imagecopyresized($dst_imgs,$src_img, 0, 0, 0, 0,$thumb_ws,$thumb_hs,$old_x,$old_y) or die("Neušpesno resizanje srednje slike @ ImageCopyResized()"); } imagejpeg($dst_img,"$filename_mala",$JPG_QUALITY); //naredi JPG file z imenom $filename_mala imagejpeg($dst_imgs,"$filename_srednja",$JPG_QUALITY); imagedestroy($dst_img); imagedestroy($dst_imgs); imagedestroy($src_img); // zapišemo ime slike v bazo if ($url1=="") { $query = "UPDATE oglasi SET url1='$url' where id=$idoglasa"; mysql_query($query); } else { if ($url2=="") { $query = "UPDATE oglasi SET url2='$url' where id=$idoglasa"; mysql_query($query); } else { if ($url3=="") { $query = "UPDATE oglasi SET url3='$url' where id=$idoglasa"; mysql_query($query); } } } Dodajsliko(); } //od if $img_sz2=2 else { // zbriše file v_slika) global $g_uploaddir; $deletefile = $g_uploaddir . $url; unlink($deletefile); Dodajsliko(); echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 Izbrana vrsta datoteke ni podprta (datoteka mora biti formata JPEG ali JPG)! 
"; echo "
"; // echo "

Izbrana vrsta datoteke ni podprta (datoteka mora biti formata JPEG ali JPG)!

"; } } //od if move_uploaded_file else { Dodajsliko(); echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
 Izbrana datoteka ni ustrezna! Peverite velikost in format izbrane datoteke. 
"; echo "
"; // echo "

Nekaj več podatkov:

"; // print_r($_FILES); } } //od if trim: odreže spredaj in zadaj } // od funkcije function replacestring($search,$replace,$subject) { $srchlen=strlen($search); if ($srchlen==0) return $subject; $find = $subject; while ($find = stristr($find,$search)) { $srchtxt = substr($find,0,$srchlen); $find=substr($find,$srchlen); $subject = str_replace($srchtxt,$replace,$subject); } return $subject; } //********************************************** if ((isset($_GET['action'])) || (isset($_POST['action']))){ if (isset($_GET['action']) ==""){ $action = $_POST['action']; } else { $action = $_GET['action']; } if ($action=="vpisoglasa") { Vpisoglasa(); } if ($action=="potrdioglas") { Potrdioglas(); } if ($action=="shranisliko") { Shranisliko(); } if ($action=="prikazoglasa") { Oglasnikprikaz(); } if ($action=="kategorija") { Oglasnikprikaz(); } } else { Oglasnikprikaz(); } include ("templates/vsebina_noga.html"); echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 
\n"; echo " \n"; virtual("/cgi-bin/pasica2novice.pl"); echo "
\n"; echo "
 
\n"; include ("templates/pasica_desno_sub.html"); include ("templates/banner_2.html"); include ("templates/noga.html"); $dbconn = DBConnect("CLOSE"); ?>