<?php
include("../setari.php");
$cxn = @ConnectToDb($dbServer, $dbUser9, $dbPass9, $dbName9);
if(isset($_COOKIE['vanzinch_email']))
{
$username = $_COOKIE['vanzinch_email'];
$pass = $_COOKIE['vanzinch_pass'];
$check = mysql_query("SELECT * FROM clienti WHERE email = '$username'")or die(mysql_error());
while($myrow = mysql_fetch_array( $check ))
{
//if the cookie has the wrong password, they are taken to the login page
if ($pass != $myrow['parola'])
{
header("Location: login.php");
}
else
{
$judet=$_GET[judet];
$judet2=str_replace (" ", "+", $judet);
?>
<html>
<head>
<title>ADMIN</title>
<style type="text/css"><!--
A{text-decoration:none}
-->
</style>
</head>
<body bgcolor="#333333">
<div align="center">
<br><br>
<?php
include 'sus.php';
?>
<div align="center">
<table border="1" width="860" cellspacing="0" cellpadding="0" bordercolor="#006699" bordercolorlight="#808080" bgcolor="#ffffff">
<tr><td>
<div align="center">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="800" align=center bgcolor="#FFFFFF" valign="top">
<div align="center">
<table cellspacing="1" cellpadding="2" width="860">
<tr><td valign="top" bgcolor="#CC3300" width="418">
<font color="#FFFFFF" face="Verdana" size="1"><b>
</span>Select sub-category for <?php echo $judet?>:</b></font><td bgcolor="#333333">
<p align="center"><b><font color="#FFFFFF" size="1" face="Verdana">
<a href="cont.php"><font color="#FFFFFF"><<<</font></a></span></font></b><a href="cont.php"><b><font face="Verdana" size="1" color="#FFFFFF">Back
to Main Page</font></b></span></a><td class=anunttitlu2 width=20% bgcolor="#FF0000">
<p align=center><b><a href=logout.php>
<font face=Verdana color=#ffffff size=1>Logout</font></a><font face=Verdana color=#FFFFFF size=1>>>></font></span></b></p></td></tr></table>
<table width=860 cellpadding=0>
<tr><td width="80%" bgcolor=#AFC7E2 align="center">
<br>
<table border="0" width="60%" cellpadding="3">
<tr>
<td bgcolor="#FFFFFF" width="74%"><img src=arrow.jpg border=0>
<b><font color=#666666 face=arial size=2><?php echo $judet?></font>
</td><td width="24%" bgcolor="#FFFFFF" align=center>
<a href=adauga_anunt0.php><font color=#FF0000 face=verdana size=1>back</font></a></td></tr>
<tr>
<td bgcolor="#AFC7E2" width="100%" colspan="2">
</td></tr>
<tr>
<td bgcolor="#333333" width="74%">
<font color="#FFFFFF" face="Verdana" size="2"><b>Select a sub-category:</b></font></td>
<td bgcolor="#FF0000" width="24%">
<p align="center">
<a href="newsubcateg.php?judet=<?php echo $judet2;?>">
<b><font color="#FFFFFF" face="Verdana" size="1"><u>or create a new one</u></font></a></b></td>
</tr>
<tr>
<td bgcolor="#AFC7E2" width="100%" colspan="2">
</td>
</tr>
</table>
<table width=60% cellspacing=2 border=0 cellpadding=4>
<?php
$check = mysql_query("SELECT * FROM localitati where judet='$judet' ORDER BY localitate ASC limit 0,50")or die(mysql_error());
$check2 = mysql_num_rows($check);
if ($check2 == 0) {
echo "<tr><td bgcolor=#ffffff><font color=#333333 size=2 face=verdana>You have no sub-categories in <b>".$judet."</b>!<br>To add a new sub-category, just click on <a href=newsubcateg.php?judet=".$judet2.">ADD NEW</a><br>Your website needs at least one category and one subcategory
<br><br><font size=1>Example 1: New York City > <font color=red>Manhattan</font> <br>(New York City is the Main Category and Manhattan is the sub-category)
<br><br>Example 2: New York City > <font color=red>Apartments for Rent</font> <br>(New York City is the Main Category and Apartments for Rent is the sub-category)
<br><br>Example 3: Apartments for Rent > <font color=red>Manhattan</font> <br>(Apartments for Rent is the Main Category and Manhattan is the sub-category)
</td/></tr>";
}
else
{
while($zzz = mysql_fetch_array( $check ))
{
$zz=str_replace (" ", "+", $zzz[judet]);
$zzzzz=str_replace (" ", "+", $zzz[localitate]);
echo "<tr><td bgcolor=#ffffff width=80%><a href=adauga_anunt.php?judet=".$zz."&tranzactie=".$zzzzz."><font face=Verdana size=1 color=red><b><u>".$zzz[localitate]."</u></b></a></td/><td bgcolor=#ffffff width=20% align=center><font color=#666666 size=1 face=verdana>delete [<a href= deletesubcategory.php?judet=".$zz."&localitate=".$zzzzz."><font color=red>x</font></a>]</font></tr>";
}
}
echo "<tr><td><br><br><br></td></tr></table>";
}}}
else
//if the cookie does not exist, they are taken to the login screen
{
header("Location: login.php");
}
?>
</table>
</td>
</tr>
</td>
</tr>
</table></div>
</td>
</tr>
</table>
<tr>
<td colspan="2">
</td>
</tr>
</table>
</tr></td></table>
</body>
</html>