<?php  
	require_once("mysqlconnect.php");
	require_once("global/functions.php");
	require_once("global/constants.php");
	require_once("../lib/init.php");
	session_start();
	
	$u=$_GET['u'];
	
	if(!$_SESSION["mobile_admin_logged_in"] || $u<>$uhash) header('location: index.php');
	
	

	?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//SK" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>4mobile - všetko pre Váš mobil</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="book.css">
<script language="JavaScript" src="book.js">
</script>
<style type="text/css">
<!--
.form_name {  font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; color: #666666; text-decoration: none; text-align: left;}
.form_tlac {  font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; color: #666666; background-color: #FFFFFF; border: 1px solid #CCCCCC}
.form_text { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: normal; color: #666666; text-decoration: none ; text-align: justify; background-color: #FFFFFF; border: #CCCCCC; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
.form_text2 { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; font-weight: bold; color: #666666; text-decoration: none ; text-align: justify }
.msg { font-family: Verdana; font-size: 7pt; color:#999999; }
.field1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt; color: #CC0000; background-color: #CCCCCC; border: #000000; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}

-->
</style>
</head>

<body bgcolor="#000000">
<?php 
	include "menu.php"; 
?>
<div align='center'>
<? 

	$action=$_GET["action"];
		
	if($action=='add_file' && $_POST['od']<>'' && $_POST['do']<>'' && $_POST['sekvencia']<>'' && $_POST['kategoria']<>'' && $_POST['rozlisenie']<>'')
	{
		for($i=$_POST['od'];$i<=$_POST['do'];$i++)
		{
			$filename = str_replace('%#%', $i, $_POST['sekvencia']);
			$file_hash = md5_file('/home/clients/peterpech.com/peterpech.com/4mobile/pozadia2/'.$filename);
			$query = "INSERT INTO mobile_pozadia (file, cat, res, pridal, hash) VALUES ('$filename', '".$_POST['kategoria']."', '".$_POST['rozlisenie']."', -1, '$file_hash')";
			mysql_query($query) or die(mysql_error);
			$err = 'Pridané!!!';
//			echo $query."<br />\n";
		}
	}else $err = 'Error';


			$categories = array
	(
		1 => 'auto-moto',
		2 => 'erotika',
		3 => 'modelky',
		4 => 'autá & ženy',
		5 => 'funny',
		6 => 'animované',
		7 => 'bábätká',
		8 => 'pre ženy',
		9 => 'filmy',
		10 => 'príroda',
		11 => 'mix',
		12 => 'láska',
		13 => 'zvieratká',
		14 => 'šport',
		15 => 'art',
		16 => 'logá',
		17 => 'celebrity',
		18 => 'Vianoce',
		19 => 'hudba',
		20 => 'rozprávky',
		21 => 'realityshow',
	);
			
			$rozlisenia = array
	(
		array 
		(
			'menu' => '101x80',
			'res' => 4
		),
		array 
		(
			'menu' => '128x128',
			'res' => 1
		),
		array 
		(
			'menu' => '128x160',
			'res' => 3
		),
		array 
		(
			'menu' => '132x176',
			'res' => 6
		),
		array 
		(
			'menu' => '176x220',
			'res' => 5
		),
		array 
		(
			'menu' => '208x208',
			'res' => 7
		),
		array 
		(
			'menu' => '240x320',
			'res' => 8
		),
		array 
		(
			'menu' => 'iné',
			'res' => 0
		),
	);
			
		echo"<div>
		<form name=\"q\" action=\"mass_image_add.php?u=$u&action=add_file\" method=POST>
			<table width=400 border=0 align=center cellspacing=1>
				<tr bgcolor=#222222>
					<td class=form_name>Od:</td>
					<td class=form_name style=\" padding-top:3px; padding-bottom:3px;\"><input name=od type=text size=5 class=form_text></td>
				</tr>
				<tr bgcolor=#222222>
					<td class=form_name>Do:</td>
					<td class=form_name style=\" padding-top:3px; padding-bottom:3px;\"><input name=do type=text size=5 class=form_text></td>
				</tr>
				<tr bgcolor=#222222>
					<td class=form_name>Nazov sekvencie: (file.ext, %#% replaces sequence)</td>
					<td class=form_name style=\" padding-top:3px; padding-bottom:3px;\"><input name=sekvencia type=text size=30 class=form_text></td>
				</tr>	
				<tr bgcolor=#222222>
					<td class=form_name>Kategória:</td>
					<td class=form_name style=\" padding-top:3px; padding-bottom:3px;\"><select name=kategoria class=form_text>
					<option value=\"\">Kategória</option>";
					foreach($categories	as $k => $v)
					{
						echo "<option value=$k>$v</option>";
					}
					echo "
					</select></td>
				</tr>	
				<tr bgcolor=#222222>
					<td class=form_name>Rozlíšenie:</td>
					<td class=form_name style=\" padding-top:3px; padding-bottom:3px;\"><select name=rozlisenie class=form_text>
					<option value=\"\">Rozlíšenie</option>";
				foreach($rozlisenia	as $k)
				{
					echo "<option value=".$k['res'].">".$k['menu']."</option>";
				}
				echo "
					</select></td>
				</tr>
				<tr bgcolor=#222222>
					<td colspan=2 align=center><input type=submit value=OK class=form_tlac style=\"cursor:hand\";>  
          			<input type=reset value=Vymazať class=form_tlac style=\"cursor:hand\";></td>
				</tr>
			</table>
		</form></div>";
	echo"<div align=center class=form_text style=\"text-align: center;\">$err</div>";		
			
	
	
	?>

</div>
</body>
</html>
