<?

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

*************************************************
*			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:				artglobal@wp.pl			*
*************************************************

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

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

require_once('inc/config.inc.php');
require_once('class/object.class.php');
$smarty -> assign('du', '');
$object = new obj;
//$id = html( $_GET['id'] );
//include('inc/seo.inc.php');

$smarty -> register_function('nopl', 'parse');


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

if ( isset( $_POST['addDiler'] ) )
{

       
        
		
$smarty -> assign('dilerNazwa', $_SESSION['dilerNazwa']);	
$smarty -> assign('dilerOfirmie', $_SESSION['dilerOfirmie']);
$smarty -> assign('dilerUlica', $_SESSION['dilerUlica']);
$smarty -> assign('dilerNrulicy', $_SESSION['dilerNrulicy']);
$smarty -> assign('dilerPoczta', $_SESSION['dilerPoczta']);
$smarty -> assign('dilerMiasto', $_SESSION['dilerMiasto']);
$smarty -> assign('dilerWWW', $_SESSION['dilerWWW']);
$smarty -> assign('dilerTel', $_SESSION['dilerTel']);
$smarty -> assign('dilerFax', $_SESSION['dilerFax']);
$smarty -> assign('dilerEmail', $_SESSION['dilerEmail']);
$smarty -> assign('dilerNr', $_SESSION['dilerNr']);

        
$object -> addDiler (  html( $_POST['dilerNazwa'] ), html( $_POST['dilerOfirmie'] ), html( $_POST['dilerUlica'] ),   html( $_POST['dilerNrulicy'] ), html( $_POST['dilerPoczta'] ), html( $_POST['dilerMiasto'] ), html( $_POST['dilerWWW'] ), html( $_POST['dilerTel'] ), html( $_POST['dilerFax'] ), html( $_POST['dilerEmail'] ), html( $_POST['dilerNr'] ), $mysql );

                $objectId = $mysql -> insert();
                $smarty -> assign('success', 'Dane został poprawnie dodane! Dziękujemy!');
                
             
                        if ( $_FILES['photo_logo']['tmp_name'] !== '' )
                        {
                                if ( $object -> walidPhoto( $_FILES['photo_logo']['name'] ) )
                                {
                                        $object -> uploadPhotoDiler ( $_FILES['photo_logo']['name'], $_FILES['photo_logo']['tmp_name'], $objectId, $mysql );
                                }
                        }
         
                

        
}


if ( isset( $_POST['eddDiler'] ) )
{


$smarty -> assign('dilerNazwa', $_SESSION['dilerNazwa']);	
$smarty -> assign('dilerOfirmie', $_SESSION['dilerOfirmie']);
$smarty -> assign('dilerUlica', $_SESSION['dilerUlica']);
$smarty -> assign('dilerNrulicy', $_SESSION['dilerNrulicy']);
$smarty -> assign('dilerPoczta', $_SESSION['dilerPoczta']);
$smarty -> assign('dilerMiasto', $_SESSION['dilerMiasto']);
$smarty -> assign('dilerWWW', $_SESSION['dilerWWW']);
$smarty -> assign('dilerTel', $_SESSION['dilerTel']);
$smarty -> assign('dilerFax', $_SESSION['dilerFax']);
$smarty -> assign('dilerEmail', $_SESSION['dilerEmail']);
$smarty -> assign('dilerNr', $_SESSION['dilerNr']);
$smarty -> assign('id_diler', $_SESSION['id_diler']);


        
$object -> eddDiler (  html( $_POST['dilerNazwa'] ), html( $_POST['dilerOfirmie'] ), html( $_POST['dilerUlica'] ),   html( $_POST['dilerNrulicy'] ), html( $_POST['dilerPoczta'] ), html( $_POST['dilerMiasto'] ), html( $_POST['dilerWWW'] ), html( $_POST['dilerTel'] ), html( $_POST['dilerFax'] ), html( $_POST['dilerEmail'] ), html( $_POST['dilerNr'] ),   $_POST['id_diler'],   $_POST['uzytkownik'],   $mysql );

                $objectId = $mysql -> insert();
                $smarty -> assign('success', 'Dane został poprawione! Dziękujemy!');
                
             
                        if ( $_FILES['photo_logo']['tmp_name'] !== '' )
                        {
                                if ( $object -> walidPhoto( $_FILES['photo_logo']['name'] ) )
                                {
                                        $object -> uploadPhotoDiler ( $_FILES['photo_logo']['name'], $_FILES['photo_logo']['tmp_name'], $objectId, $mysql );
                                }
                        }
         
                

        
}


 
 
$sql = "SELECT * FROM diler WHERE uzytkownik = '".$_SESSION['userId']."'  ";
$q = $mysql -> q( $sql );
$eDiler = array();
while ( $db = mysql_fetch_array( $q ) )
		{
						$eDiler[] = $db;
		}
$smarty -> assign('eDiler', $eDiler);

$num = mysql_num_rows( $q );
$smarty -> assign('num', $num);
$dilerid = $_SESSION['userId'];
$smarty -> assign('dilerid', $dilerid);

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

?>
