<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
include("../setari.php");
$idoferta="$_GET[idoferta]";
$error=0;
if ($_POST[submit])
{
if(!trim($_POST[descriere]))
{echo "<font color=red face=verdana size=1><b>No description!<br>Press BACK </font><br><br>";
$error++;}
if(!trim($_POST[titlu]))
{echo "<font color=red face=verdana size=1><b>No title!<br>Press BACK </font><br><br>";
$error++;}
if(!trim($_POST[contact]))
{echo "<font color=red face=verdana size=1><b>No contact!<br>Press BACK </font><br><br>";
$error++;}
if($error==0)
{
$tranzactie= $_POST[tranzactie];
$titlu=$_POST["titlu"];
$judet=$_POST["judet"];
$idoferta=$_POST["offer"];
$descriere = preg_replace("#(\n)#","<br />",$_POST["descriere"]);
$contact = preg_replace("#(\n)#","<br />",$_POST["contact"]);
$pret=$_POST["pret"];
$azi = date("Y-m-d");
$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");
}
$idclient=$myrow['id'];
$pass=$myrow['parola'];
}
$insert="UPDATE oferte SET tranzactie='$_POST[tranzactie]', judet='$_POST[judet]', titlu='$_POST[titlu]', suprafata='$_POST[suprafata]', descriere='$descriere', pret='$_POST[pret]', rank='$_POST[rank]', moneda='$_POST[moneda]', contact='$contact' WHERE idoferta='$idoferta' AND pass='$pass' LIMIT 1";
$rsult = mysql_query($insert) or die("Query failed aici");
header("Location: detaliianunt.php?anuntnr=$idoferta");
MYSQL_CLOSE();
}}}
else {
$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
{
$query99 ="SELECT * FROM oferte WHERE idoferta='$idoferta'";
$result99 = mysql_query($query99) or die("Query failed");
while ($myrow99 = mysql_fetch_array($result99)) {
if ($pass != $myrow99['pass'])
{
header("Location: login.php");
}
$tranzactie=$myrow99['tranzactie'];
$judet=$myrow99['judet'];
$titlu=$myrow99['titlu'];
$suprafata=$myrow99['suprafata'];
$descriere0=$myrow99['descriere'];
$descriere=str_replace("<br />", "",$descriere0);
$pret=$myrow99['pret'];
$contact=str_replace("<br />", "",$myrow99['contact']);
$moneda=$myrow99['moneda'];
$rank=$myrow99['rank'];
}
?>
<html>
<head>
<title>ADMIN</title>
</head>
<style type="text/css"><!--
A{text-decoration:none}
-->
</style>
<body bgcolor="#333333">
<div align="center">
<br><br>
<?php
include 'sus.php';
?>
<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="2"><b> Your
Listing:</span></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=#E6EDF7 align="center">
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
<input type="hidden" name="offer" value="<?php echo $idoferta;?>">
<p style="margin-top: 0; margin-bottom: 0"> </p>
<table border="0" width="79%" cellpadding="2">
<tr>
<td colspan="2" bgcolor="#4C83C8">
<p align="left" style="margin-top: 0; margin-bottom: 0"><b>
<font color="#FFFFFF" size="2" face="Verdana">Details:</span></font></b></td>
</tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">Category:</font></span></td>
<td bgcolor="#FFFFFF" width="60%" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">
<input type="text" name="judet" size="28" READONLY value="<?php echo $judet;?>"></font></tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">Sub-category:</span></font></td>
<td bgcolor="#FFFFFF" width="60%" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<select size="1" name="tranzactie">
<option><?php echo $tranzactie;?></option>
<?php
$q99 ="SELECT localitate FROM localitati WHERE judet like '$judet' and localitate not like '$tranzactie' order by localitate asc";
$r99 = mysql_query($q99) or die("Query failed");
while ($m99 = mysql_fetch_array($r99)) {
echo "<option>".$m99[localitate]."</option>";}?>
</select>
</tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left">
<font size="1" face="Verdana">Rank:</font></td>
<td bgcolor="#FFFFFF" width="60%" align="left">
<select size="1" name="rank">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option selected><?php echo $rank;?></option>
</select></tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left">
<font size="1" face="Verdana">Title:</font></span></td>
<td bgcolor="#FFFFFF" width="60%" align="left">
<font face="Verdana" size="1">
<input type="text" name="titlu" size="57" value="<?php echo $titlu;?>"></td>
</tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left" >
<p style="margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana">Area</span>:</font></td>
<td width="60%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">
<input type="text" name="suprafata" size="22" value="<?php echo $suprafata;?>"></font></td>
</tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left" >
<p style="margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana">Details:</font></td>
<td width="60%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">
<textarea rows="10" name="descriere" cols="49"><?php echo $descriere;?></textarea></font></td>
</tr>
<tr>
<td width="30%" bgcolor="#FFFFFF" align="left" >
<p style="margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana">Price</span>:</font></td>
<td width="60%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1"><input type="text" name="pret" size="12" value="<?php echo $pret;?>">
<input type="text" name="moneda" size="21" value="<?php echo $moneda;?>"></font></td>
</tr>
<tr>
<td width="30%" align="left" bgcolor="#FFFFFF" >
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">Contact:</font></td>
<td width="60%" align="left" bgcolor="#FFFFFF">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1">
<textarea rows="5" name="contact" cols="49"><?php echo $contact;?></textarea></font></td>
</tr>
</table>
<font face="Arial" size="2">
<p style="margin-top:0; margin-bottom:0">
</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="submit" value="Submit >>" name="submit"><br><br></p>
</form>
</td>
</tr>
</td>
</tr>
</table>
<?php
}}}
else
//if the cookie does not exist, they are taken to the login screen
{
header("Location: login.php");
}
?>
<p style="margin:0 15px; ">
</p>
</div>
</td>
</tr>
</table>
</div>
</div>
<tr>
<td colspan="2">
</td>
</tr>
</table>
</tr></td></table>
</body>
</html>
<?php }?>