<?
  if($_SERVER['HTTP_HOST'] == '127.0.0.1'){
		$conn2 = mysql_connect("localhost","root","root", "true");
		$conn_res2 = mysql_select_db($g_baza_out, $conn2) or die("unable to select database");
		mysql_query("SET NAMES 'utf8' ", $conn2);
	}else{
		$conn2 = @mysql_connect("localhost","utexel2","diXLegB942", "true");
		
		//print $conn2." ".$g_baza_out." aa<br>";
		
		$conn_res2 = @mysql_select_db($g_baza_out, $conn2) or die("spajanje neuspjesno");
		mysql_query("SET NAMES 'utf8' ", $conn2);
	}
	
	//print $conn_res2." -- <br>\n";
	
	$x = get_data('select * from users order by id ', 1, $conn2);
	//print_r($x);
	
	for($i = 0; $i < sizeof($x['id']); $i++){
		//print 'select guid from zaposlenik where rbr_users_outer_db = '.$x['id'][$i]."<br><br>\n\n";
		
		$y = get_item('select guid from zaposlenik where rbr_users_outer_db = '.$x['id'][$i], $conn);
		
		//print $y." xx <br>\n<br>\n";
		if(!$y){
			$uuid = get_item('SELECT UUID() as uuid');
			
			$sql = 'insert into zaposlenik(guid, Ime, Prezime, DisplayName, EMail, rbr_users_outer_db) values("'.$uuid.'", "'.$x['firstname'][$i].'", "'.$x['lastname'][$i].'", '.
				' "'.$x['lastname'][$i].' '.$x['firstname'][$i].'", "'.$x['email_address'][$i].'", '.$x['id'][$i].')';
			//print $sql." --- <br>\n";
			sql_exe($sql, false, $conn);
		}
	}
	
	
?>
	<div class="visWrap">
		<p class="newUser"><b>Novi korisnici upravo su aktivirani.</b></p>
	</div>
