<?
/* ------------------------------------------------------------------- */
/*

*************************************************
*			UWAGA! SKRYPT NIE JEST DARMOWY.			*
*		DALSZE ROZPOWSZECHNIANIE BEZ ZGODY 			*
*			FIRMY ArtGlobal JEST ZABRONIONE.			*
*************************************************

*************************************************
*	WWW.ArtGlobal.PL		PRODUCENT OPROGRAMOWANIA	*
*	NAZWA SKRYPTU:		NIERUCHOMOSCI 6.0			*
*	WERSJA FINALNA:	04.10.2010						*
*	KONTAKT:				kontakt@artglobal.pl			**
*************************************************

Copyright (c) 2010 ArtGlobal. Wszelkie prawa zastrzeżone.

*/
/* ------------------------------------------------------------------- */

$smarty -> assign('ba', '');

$usun = $usun;
$o = $o ;


$smarty -> assign('success', '');
$smarty -> assign('error', '');
$smarty -> assign('typ', $_GET['typ']);
$smarty -> assign('usun', $_GET['usun']);
$smarty -> assign('o', $_GET['o']);


/////////////////////////////// B1 /////////////////
if ( $_GET['typ'] == 'b1' ){



$tresc = '';  


$sql = mysql_query("select * from reklama order by kod");


$kod= array();
$count = 0;

//list($id,$kod,$url)
while (  $db =  mysql_fetch_array( $sql ) )
{
$kod[$count] = $db;
$kod[$count]['id'] = $db[0];
$count++;
}

$smarty -> assign('kod', $kod);

///////////////////////////////



if ( $_GET['usun']=='true')
		{
$tresc .= '<tr><td colspan=3 align=center>';
	$result=mysql_query("DELETE from reklama WHERE id='".$_GET['o']."'  LIMIT 1");
$tresc .= '<font color=red><b>Reklama '.$_GET['o'].' została skasowana (w:210 h:110):. </b></font><br><br></td></tr>';
	}



error_reporting(E_ALL);

$smarty -> assign('tresc', $tresc);

if(isset($_POST['edycja']) && $_POST['co'] =="1"){
  $url = strip_tags($_POST['url']);
  $q = mysql_fetch_array(mysql_query('SELECT * FROM reklama ORDER BY id DESC LIMIT 0,1'));
  $i = $q['id'];
  $i++;
  $path = pathinfo($_FILES['button']['name']);
  $roz = $path['extension'];
  $plik = 'reklama/' . $i . '.' . $roz;
  $r =  $_SERVER['DOCUMENT_ROOT'];
  $uploaddir = $r.'/' . $plik;
  $link = '/reklama/' . $i . '.' . $roz;


if( is_uploaded_file( $_FILES['button']['tmp_name'] ) )
{
  if( move_uploaded_file( $_FILES['button']['tmp_name'], $uploaddir  ) )
  {      $smarty -> assign('success', 'Plik został pomyślnie uploadowany!');   
   }
  else
  {     $smarty -> assign('error', 'Upload pliku nie powiódł się!');   
  }
 // echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
}
else
{   $smarty -> assign('error', 'Wystąpił błąd podczas wysyłania pliku na serwer!'); }


 
if($roz == "swf"){
$baner = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   align="middle" height="110" width="210"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="movie" value="' .$link. '" /> <embed src="' .$link. '"  height="110" width="210" allowScriptAccess="sameDomain" WMODE="transparent"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

  }
else{
$baner = '<img style=\"border: 3px double #b6c1ce \" src="' .$link. '" style="border:0px;" width="210" height="110" alt="Nieruchomosc" border="0" />';

  }



mysql_connect("localhost","........",".........");
mysql_select_db(".........");
  $zapyt = 'INSERT INTO reklama VALUES(\'\', \'' .$baner. '\', \'' .$url. '\')';
  $query = mysql_query($zapyt);
  if($query){
   $smarty -> assign('success', 'Dodano do bazy!');
  }
}
/////////////////////////////// KONIEC B1 /////////////////
/////////////////////////////// B2 /////////////////


}

if ( $_GET['typ'] == 'b2' ){



$trescB = '';  



$sql = mysql_query("select * from reklamaB order by kod");


$kodB= array();
$count = 0;

//list($id,$kod,$url)
while (  $dbB =  mysql_fetch_array( $sql ) )
{
$kodB[$count] = $dbB;
$kodB[$count]['id'] = $dbB[0];
$count++;
}

$smarty -> assign('kodB', $kodB);

///////////////////////////////



if ( $_GET['usun']=='true')
		{
$trescB .= '<tr><td colspan=3 align=center>';
	$result=mysql_query("DELETE from reklamaB WHERE id='".$_GET['o']."'  LIMIT 1");
$trescB .= '<font color=red><b>Reklama '.$_GET['o'].' została skasowana (w:340 h:60):. </b></font><br><br></td></tr>';
	}



error_reporting(E_ALL);

$smarty -> assign('trescB', $trescB);

if(isset($_POST['edycja']) && $_POST['co'] =="2"){
  $url = strip_tags($_POST['url']);
  $q = mysql_fetch_array(mysql_query('SELECT * FROM reklamaB ORDER BY id DESC LIMIT 0,1'));
  $i = $q['id'];
  $i++;
  $path = pathinfo($_FILES['button']['name']);
  $roz = $path['extension'];
  $plik = 'reklamaB/' . $i . '.' . $roz;
  $r =  $_SERVER['DOCUMENT_ROOT'];
  $uploaddir = $r.'/' . $plik;
  $link = '/reklamaB/' . $i . '.' . $roz;


if( is_uploaded_file( $_FILES['button']['tmp_name'] ) )
{
  if( move_uploaded_file( $_FILES['button']['tmp_name'], $uploaddir  ) )
  {      $smarty -> assign('success', 'Plik został pomyślnie uploadowany!');   
   }
  else
  {     $smarty -> assign('error', 'Upload pliku nie powiódł się!');   
  }
 // echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
}
else
{   $smarty -> assign('error', 'Wystąpił błąd podczas wysyłania pliku na serwer!'); }


 
if($roz == "swf"){
$baner = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   align="middle" height="60" width="340"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="movie" value="' .$link. '" /> <embed src="' .$link. '"  height="60" width="340" allowScriptAccess="sameDomain" WMODE="transparent"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

  }
else{
$baner = '<img style=\"border: 3px double #b6c1ce \" src="' .$link. '" style="border:0px;" width="340" height="60" alt="Nieruchomosc" border="0" />';

  }




mysql_connect("localhost","........",".........");
mysql_select_db(".........");
  $zapyt = 'INSERT INTO reklamaB VALUES(\'\', \'' .$baner. '\', \'' .$url. '\')';
  $query = mysql_query($zapyt);
  if($query){
   $smarty -> assign('success', 'Dodano do bazy!');
  }
}

}
/////////////////////////////// KONIEC B2 /////////////////

/////////////////////////////// B3 /////////////////
if ( $_GET['typ'] == 'b3' ){



$tresc = '';  


$sql = mysql_query("select * from reklamaC order by kod");


$kodC= array();
$count = 0;

//list($id,$kod,$url)
while (  $db =  mysql_fetch_array( $sql ) )
{
$kodC[$count] = $db;
$kodC[$count]['id'] = $db[0];
$count++;
}

$smarty -> assign('kodC', $kodC);

///////////////////////////////



if ( $_GET['usun']=='true')
		{
$tresc .= '<tr><td colspan=3 align=center>';
	$result=mysql_query("DELETE from reklamaC WHERE id='".$_GET['o']."'  LIMIT 1");
$tresc .= '<font color=red><b>Reklama '.$_GET['o'].' została skasowana (w:728 h:90):. </b></font><br><br></td></tr>';
	}



error_reporting(E_ALL);

$smarty -> assign('tresc', $tresc);

if(isset($_POST['edycja']) && $_POST['co'] =="3"){
  $url = strip_tags($_POST['url']);
  $q = mysql_fetch_array(mysql_query('SELECT * FROM reklamaC ORDER BY id DESC LIMIT 0,1'));
  $i = $q['id'];
  $i++;
  $path = pathinfo($_FILES['button']['name']);
  $roz = $path['extension'];
  $plik = 'reklamaC/' . $i . '.' . $roz;
  $r =  $_SERVER['DOCUMENT_ROOT'];
  $uploaddir = $r.'/' . $plik;
  $link = '/reklamaC/' . $i . '.' . $roz;


if( is_uploaded_file( $_FILES['button']['tmp_name'] ) )
{
  if( move_uploaded_file( $_FILES['button']['tmp_name'], $uploaddir  ) )
  {      $smarty -> assign('success', 'Plik został pomyślnie uploadowany!');   
   }
  else
  {     $smarty -> assign('error', 'Upload pliku nie powiódł się!');   
  }
 // echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
}
else
{   $smarty -> assign('error', 'Wystąpił błąd podczas wysyłania pliku na serwer!'); }


 
if($roz == "swf"){
$baner = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   align="middle" height="90" width="713"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="movie" value="' .$link. '" /> <embed src="' .$link. '"  height="90" width="728" allowScriptAccess="sameDomain" WMODE="transparent"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

  }
else{
$baner = '<img style=\"border: 3px double #b6c1ce \" src="' .$link. '" style="border:0px;" width="728" height="90" alt="Nieruchomosc" border="0" />';

  }



mysql_connect("localhost","........",".........");
mysql_select_db(".........");
  $zapyt = 'INSERT INTO reklamaC VALUES(\'\', \'' .$baner. '\', \'' .$url. '\')';
  $query = mysql_query($zapyt);
  if($query){
   $smarty -> assign('success', 'Dodano do bazy!');
  }
}
}
/////////////////////////////// KONIEC B3 /////////////////

/////////////////////////////// B4 /////////////////
if ( $_GET['typ'] == 'b4' ){



$tresc = '';  


$sql = mysql_query("select * from reklamaD order by kod");


$kodD= array();
$count = 0;

//list($id,$kod,$url)
while (  $db =  mysql_fetch_array( $sql ) )
{
$kodD[$count] = $db;
$kodD[$count]['id'] = $db[0];
$count++;
}

$smarty -> assign('kodD', $kodD);

///////////////////////////////



if ( $_GET['usun']=='true')
		{
$tresc .= '<tr><td colspan=3 align=center>';
	$result=mysql_query("DELETE from reklamaD WHERE id='".$_GET['o']."'  LIMIT 1");
$tresc .= '<font color=red><b>Reklama '.$_GET['o'].' została skasowana (w:728 h:90):. </b></font><br><br></td></tr>';
	}



error_reporting(E_ALL);

$smarty -> assign('tresc', $tresc);

if(isset($_POST['edycja']) && $_POST['co'] =="4"){
  $url = strip_tags($_POST['url']);
  $q = mysql_fetch_array(mysql_query('SELECT * FROM reklamaD ORDER BY id DESC LIMIT 0,1'));
  $i = $q['id'];
  $i++;
  $path = pathinfo($_FILES['button']['name']);
  $roz = $path['extension'];
  $plik = 'reklamaD/' . $i . '.' . $roz;
  $r =  $_SERVER['DOCUMENT_ROOT'];
  $uploaddir = $r.'/' . $plik;
  $link = '/reklamaD/' . $i . '.' . $roz;


if( is_uploaded_file( $_FILES['button']['tmp_name'] ) )
{
  if( move_uploaded_file( $_FILES['button']['tmp_name'], $uploaddir  ) )
  {      $smarty -> assign('success', 'Plik został pomyślnie uploadowany!');   
   }
  else
  {     $smarty -> assign('error', 'Upload pliku nie powiódł się!');   
  }
 // echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
}
else
{   $smarty -> assign('error', 'Wystąpił błąd podczas wysyłania pliku na serwer!'); }


 
if($roz == "swf"){
$baner = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   align="middle" height="90" width="713"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="movie" value="' .$link. '" /> <embed src="' .$link. '"  height="90" width="728" allowScriptAccess="sameDomain" WMODE="transparent"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

  }
else{
$baner = '<img style=\"border: 3px double #b6c1ce \" src="' .$link. '" style="border:0px;" width="728" height="90" alt="Nieruchomosc" border="0" />';

  }



mysql_connect("localhost","........",".........");
mysql_select_db(".........");
  $zapyt = 'INSERT INTO reklamaD VALUES(\'\', \'' .$baner. '\', \'' .$url. '\')';
  $query = mysql_query($zapyt);
  if($query){
   $smarty -> assign('success', 'Dodano do bazy!');
  }
}
}
/////////////////////////////// KONIEC B4 /////////////////

/////////////////////////////// B5 /////////////////
if ( $_GET['typ'] == 'b5' ){



$tresc = '';  


$sql = mysql_query("select * from reklamaS order by kod");


$kodS= array();
$count = 0;

//list($id,$kod,$url)
while (  $db =  mysql_fetch_array( $sql ) )
{
$kodS[$count] = $db;
$kodS[$count]['id'] = $db[0];
$count++;
}

$smarty -> assign('kodS', $kodS);

///////////////////////////////



if ( $_GET['usun']=='true')
		{
$tresc .= '<tr><td colspan=3 align=center>';
	$result=mysql_query("DELETE from reklamaS WHERE id='".$_GET['o']."'  LIMIT 1");
$tresc .= '<font color=red><b>Reklama '.$_GET['o'].' została skasowana (w:728 h:90):. </b></font><br><br></td></tr>';
	}



error_reporting(E_ALL);

$smarty -> assign('tresc', $tresc);

if(isset($_POST['edycja']) && $_POST['co'] =="5"){
  $url = strip_tags($_POST['url']);
  $q = mysql_fetch_array(mysql_query('SELECT * FROM reklamaS ORDER BY id DESC LIMIT 0,1'));
  $i = $q['id'];
  $i++;
  $path = pathinfo($_FILES['button']['name']);
  $roz = $path['extension'];
  $plik = 'reklamaS/' . $i . '.' . $roz;
  $r =  $_SERVER['DOCUMENT_ROOT'];
  $uploaddir = $r.'/' . $plik;
  $link = '/reklamaS/' . $i . '.' . $roz;


if( is_uploaded_file( $_FILES['button']['tmp_name'] ) )
{
  if( move_uploaded_file( $_FILES['button']['tmp_name'], $uploaddir  ) )
  {      $smarty -> assign('success', 'Plik został pomyślnie uploadowany!');   
   }
  else
  {     $smarty -> assign('error', 'Upload pliku nie powiódł się!');   
  }
 // echo 'Dodatkowe informacje o uploadowanym pliku: <pre>' . print_r( $_FILES, true ) . '</pre>';
}
else
{   $smarty -> assign('error', 'Wystąpił błąd podczas wysyłania pliku na serwer!'); }


 
if($roz == "swf"){
$baner = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"   align="middle" height="90" width="713"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><param name="quality" value="high" /><param name="movie" value="' .$link. '" /> <embed src="' .$link. '"  height="90" width="728" allowScriptAccess="sameDomain" WMODE="transparent"  type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

  }
else{
$baner = '<img style=\"border: 3px double #b6c1ce \" src="' .$link. '" style="border:0px;" width="728" height="90" alt="Nieruchomosc" border="0" />';

  }




mysql_connect("localhost","........",".........");
mysql_select_db(".........");
  $zapyt = 'INSERT INTO reklamaS VALUES(\'\', \'' .$baner. '\', \'' .$url. '\')';
  $query = mysql_query($zapyt);
  if($query){
   $smarty -> assign('success', 'Dodano do bazy!');
  }
}
}
/////////////////////////////// KONIEC B5 /////////////////
?>
