Location: PHPKode > scripts > Open4Listing > cont/adauga_anunt.php
<?php

include("../setari.php");

$tranzactie="$_GET[tranzactie]";

$tranzactie0=str_replace (" ", "+", $tranzactie);

$judet="$_GET[judet]";

$judet=stripslashes($judet);

$judet0=str_replace (" ", "+", $judet);







$error=0;

if ($_POST[submit])

{




if(!trim($_POST[titlu]))

{echo "<font color=red face=verdana size=1><b>Missing: Title</font><br><br>";

$error++;}


if(!trim($_POST[tranzactie]))

{echo "<font color=red face=verdana size=1><b>Missing: Sub-category</font><br><br>";

$error++;}



if(!trim($_POST[judet]))

{echo "<font color=red face=verdana size=1><b>Missing: Category</font><br><br>";

$error++;}





if(!trim($_POST[descriere]))

{echo "<font color=red face=verdana size=1><b>Missing: Description</font><br><br>";

$error++;}



if(!trim($_POST[contact]))

{echo "<font color=red face=verdana size=1><b>Missing: Contact</font><br><br>";

$error++;}




if($error==0)

{

$tranzactie= $_POST[tranzactie];

$judet=$_POST["judet"]; 

$descriere =  preg_replace("#(\n)#","<br />",$_POST["descriere"]);
$contact =  preg_replace("#(\n)#","<br />",$_POST["contact"]);

$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'];

}

$judet=stripslashes($_POST[judet]);



$insert="INSERT INTO oferte (idclient, tranzactie, judet, titlu, suprafata, descriere, pret, moneda, contact, adaugat, pass, rank)VALUES('$idclient', '$_POST[tranzactie]', '$judet', '$_POST[titlu]', '$_POST[suprafata] $_POST[area]', '$descriere', '$_POST[pret]', '$_POST[moneda] $_POST[month]', '$contact', '$azi', '$pass', $_POST[rank])";

$rsult = mysql_query($insert) or die("Query failed aici ".$idclient." , ".$_POST[tranzactie]." , ".$_POST[judet]."  , ".$_POST[suprafata]." ".$_POST[area]." , ".$descriere." , ".$_POST[pret]." , ".$_POST[moneda]." ".$_POST[month].", ".$contact." , ".$_POST[telefon]." , ".$azi);

header("Location: detaliianunt.php"); 

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 

{





$telefonclient=$myrow['telefon'];
$numeclient=$myrow['nume'];
$contact=$myrow['telefon'];
$moneda=$myrow['currency'];
$area=$myrow['system'];




?> 

<html>

<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">

		

		

		

	<table cellspacing="1" cellpadding="2" width="860">

<tr><td valign="top" bgcolor="#CC3300" width="418">

<p><font color="#FFFFFF" face="Verdana" size="2"><b>&nbsp;

</span>Add Listing</b></font><td bgcolor="#333333">

<p align="center"><b><font color="#FFFFFF" size="1" face="Verdana">

<a href="cont.php"><font color="#FFFFFF">&lt;&lt;&lt;</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>&gt;&gt;&gt;</font></span></b></p></td></tr></table>

	<div align="center">

<table width=860 cellpadding=0>

<tr><td width="80%" bgcolor=#AFC7E2 align="center">











<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">



<p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>



<table border="0" width="90%">

		<tr>

		<td colspan="2" bgcolor="#4C83C8">

		<p align="left" style="margin-top: 0; margin-bottom: 0">

		<b><font face="Verdana" size="2" color="#FFFFFF">

		Listing Details:</font></b></span></td>

		</tr>

		<tr>

		<td colspan="2" bgcolor="#FF0000">

		<p align="right"><font size="1" face="Verdana" color="#FFFFFF">You can 
		set implicit values (surface type, currency and contact) in </font>
		<font size="1" color="#FFFFFF" face="verdana">
		<a href="edit_cont.php">
		<font color="#006699" face="Verdana">website info</font></a></font></td>

		</tr>

		<tr>

		<td colspan="2" bgcolor="#AFC7E2">

		&nbsp;</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="68%" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

		<font face="Verdana" size="1">

		<input type="text" name="judet" size="30" value="<?php echo $judet; ?>" READONLY></font></td>

		</tr>

		<tr>

		<td width="30%"  bgcolor="#FFFFFF" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

		<font face="Verdana" size="1">Sub-category:</font></span></td>

		<td  bgcolor="#FFFFFF" width="68%" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

<input type="text" name="tranzactie" size="30" value="<?php echo $tranzactie;?>" READONLY>		

		

		

		</td>

		</tr>

		<tr>

		<td width="30%"  bgcolor="#FFFFFF" align="left">

		<font face="Verdana" size="1">Rank:</font></td>

		<td  bgcolor="#FFFFFF" width="68%" align="left">

		<select size="1" name="rank">
		<option>1</option>
		<option>2</option>
		<option selected>3</option>
		<option>4</option>
		<option>5</option>
		</select> <font size="1" face="Verdana">(for classifieds order: 5 
		important, 1 less important)</font></td>

		</tr>

		<tr>

		<td width="98%"  bgcolor="#AFC7E2" align="left" colspan="2">

		&nbsp;</td>

		</tr>

		<tr>

		<td width="30%"  bgcolor="#FFFFFF" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

		<font size="1" face="Verdana"><font color="#FF0000">Title*</font>:</font></td>

		<td  bgcolor="#FFFFFF" width="67%" align="left" valign="bottom">

		<font face="Verdana" size="1"><input type="text" name="titlu" size="64"></font></td>

		</tr>

				

<tr>
<td width="30%" bgcolor="#FFFFFF" align="left" >
<p style="margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana">Surface:</font></td>
<td  width="68%" bgcolor="#FFFFFF" align="left">
<p style="margin-top: 0; margin-bottom: 0">
<font face="Verdana" size="1"><input type="text" name="suprafata" size="12"> </font>
<font face="Verdana" size="2">
<select size="1" name="area">
<option><?php echo $area;?></option>
<option>Sq Ft</option>
<option>sqm</option>
<option>mt2</option>
<option>m2</option>
<option>mp</option>		
</select>



</font></span></td>

		</tr>

		

		

		<tr>

		<td width="30%" bgcolor="#FFFFFF" align="left" >

		<p style="margin-top: 0; margin-bottom: 0">

		<font size="1" face="Verdana" color="#FF0000">Description* :</font></td>

		<td  width="68%" bgcolor="#FFFFFF" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

		<font face="Verdana" size="1">

		<textarea rows="10" name="descriere" cols="61"></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="68%" bgcolor="#FFFFFF" align="left">

		<p style="margin-top: 0; margin-bottom: 0">

		<font face="Verdana" size="1"><input type="text" name="pret" size="12"> 

		</font>

		<font face="Verdana" size="2">&nbsp;<select size="1" name="moneda">

<option><?php echo $moneda;?></option>	
<option  value="EUR">Euro (EUR)</option>
<option  value="USD">US Dollar (USD)</option>
<option  value="AED">United Arab Emirates Dirham (AED)</option>
<option  value="ANG">Netherlands Antillean Guilder (ANG)</option>
<option  value="ARS">Argentine Peso (ARS)</option>
<option  value="AUD">Australian Dollar (AUD)</option>
<option  value="BDT">Bangladeshi Taka (BDT)</option>
<option  value="BGN">Bulgarian Lev (BGN)</option>
<option  value="BHD">Bahraini Dinar (BHD)</option>
<option  value="BND">Brunei Dollar (BND)</option>
<option  value="BOB">Bolivian Boliviano (BOB)</option>
<option  value="BRL">Brazilian Real (BRL)</option>
<option  value="BWP">Botswanan Pula (BWP)</option>
<option  value="CAD">Canadian Dollar (CAD)</option>
<option  value="CHF">Swiss Franc (CHF)</option>
<option  value="CLP">Chilean Peso (CLP)</option>
<option  value="CNY">Chinese Yuan (CNY)</option>
<option  value="COP">Colombian Peso (COP)</option>
<option  value="CRC">Costa Rican Colón (CRC)</option>
<option  value="CZK">Czech Republic Koruna (CZK)</option>
<option  value="DKK">Danish Krone (DKK)</option>
<option  value="DOP">Dominican Peso (DOP)</option>
<option  value="DZD">Algerian Dinar (DZD)</option>
<option  value="EEK">Estonian Kroon (EEK)</option>
<option  value="EGP">Egyptian Pound (EGP)</option>
<option  value="FJD">Fijian Dollar (FJD)</option>
<option  value="GBP">British Pound Sterling (GBP)</option>
<option  value="HKD">Hong Kong Dollar (HKD)</option>
<option  value="HNL">Honduran Lempira (HNL)</option>
<option  value="HRK">Croatian Kuna (HRK)</option>
<option  value="HUF">Hungarian Forint (HUF)</option>
<option  value="IDR">Indonesian Rupiah (IDR)</option>
<option  value="ILS">Israeli New Sheqel (ILS)</option>
<option  value="INR">Indian Rupee (INR)</option>
<option  value="ISK">Icelandic Króna (ISK)</option>
<option  value="JMD">Jamaican Dollar (JMD)</option>
<option  value="JOD">Jordanian Dinar (JOD)</option>
<option  value="JPY">Japanese Yen (JPY)</option>
<option  value="KES">Kenyan Shilling (KES)</option>
<option  value="KRW">South Korean Won (KRW)</option>
<option  value="KWD">Kuwaiti Dinar (KWD)</option>
<option  value="KYD">Cayman Islands Dollar (KYD)</option>
<option  value="KZT">Kazakhstani Tenge (KZT)</option>
<option  value="LBP">Lebanese Pound (LBP)</option>
<option  value="LKR">Sri Lankan Rupee (LKR)</option>
<option  value="LTL">Lithuanian Litas (LTL)</option>
<option  value="LVL">Latvian Lats (LVL)</option>
<option  value="MAD">Moroccan Dirham (MAD)</option>
<option  value="MDL">Moldovan Leu (MDL)</option>
<option  value="MKD">Macedonian Denar (MKD)</option>
<option  value="MUR">Mauritian Rupee (MUR)</option>
<option  value="MVR">Maldivian Rufiyaa (MVR)</option>
<option  value="MXN">Mexican Peso (MXN)</option>
<option  value="MYR">Malaysian Ringgit (MYR)</option>
<option  value="NAD">Namibian Dollar (NAD)</option>
<option  value="NGN">Nigerian Naira (NGN)</option>
<option  value="NIO">Nicaraguan Córdoba (NIO)</option>
<option  value="NOK">Norwegian Krone (NOK)</option>
<option  value="NPR">Nepalese Rupee (NPR)</option>
<option  value="NZD">New Zealand Dollar (NZD)</option>
<option  value="OMR">Omani Rial (OMR)</option>
<option  value="PEN">Peruvian Nuevo Sol (PEN)</option>
<option  value="PGK">Papua New Guinean Kina (PGK)</option>
<option  value="PHP">Philippine Peso (PHP)</option>
<option  value="PKR">Pakistani Rupee (PKR)</option>
<option  value="PLN">Polish Zloty (PLN)</option>
<option  value="PYG">Paraguayan Guarani (PYG)</option>
<option  value="QAR">Qatari Rial (QAR)</option>
<option  value="RON">Romanian Leu (RON)</option>
<option  value="RSD">Serbian Dinar (RSD)</option>
<option  value="RUB">Russian Ruble (RUB)</option>
<option  value="SAR">Saudi Riyal (SAR)</option>
<option  value="SCR">Seychellois Rupee (SCR)</option>
<option  value="SEK">Swedish Krona (SEK)</option>
<option  value="SGD">Singapore Dollar (SGD)</option>
<option  value="SKK">Slovak Koruna (SKK)</option>
<option  value="SLL">Sierra Leonean Leone (SLL)</option>
<option  value="SVC">Salvadoran Colón (SVC)</option>
<option  value="THB">Thai Baht (THB)</option>
<option  value="TND">Tunisian Dinar (TND)</option>
<option  value="TRY">Turkish Lira (TRY)</option>
<option  value="TTD">Trinidad and Tobago Dollar (TTD)</option>
<option  value="TWD">New Taiwan Dollar (TWD)</option>
<option  value="TZS">Tanzanian Shilling (TZS)</option>
<option  value="UAH">Ukrainian Hryvnia (UAH)</option>
<option  value="UGX">Ugandan Shilling (UGX)</option>
<option  value="UYU">Uruguayan Peso (UYU)</option>
<option  value="UZS">Uzbekistan Som (UZS)</option>
<option  value="VEF">Venezuelan Bolívar (VEF)</option>
<option  value="VND">Vietnamese Dong (VND)</option>
<option  value="XOF">CFA Franc BCEAO (XOF)</option>
<option  value="YER">Yemeni Rial (YER)</option>
<option  value="ZAR">South African Rand (ZAR)</option>
<option  value="ZMK">Zambian Kwacha (ZMK)</option>
</select>	

		<select size="1" name="month">
<option></option>
<option>/ month</option>
<option>/ week</option>
<option>/ year</option>
</font></span></td>

		</tr>

		<tr>

		<td colspan="2" bgcolor="#000000" align="left">

		<p align="left" style="margin-top: 0; margin-bottom: 0"><b>

		<font color="#FFFFFF" size="1" face="Verdana">Contact:</font></b></td>

		</tr>

		<tr>

		<td width="30%" align="left" bgcolor="#FFFFFF" >

		<p style="margin-top: 0; margin-bottom: 0">

		<font color="#FF0000" face="Verdana" size="1">Contact:*</font><p style="margin-top: 0; margin-bottom: 0">

		&nbsp;</td>

		<td  width="68%" align="left" bgcolor="#FFFFFF">

		<p style="margin-top: 0; margin-bottom: 0">

		<font face="Verdana" size="1">

		<textarea rows="3" name="contact" cols="50"><?php echo $contact;?></textarea></font></td>

		</tr>

		</table>

<font face="Arial" size="2">

	<p style="margin-top:0; margin-bottom:0">

&nbsp;</p>

<p style="margin-top: 0; margin-bottom: 0">

<input type="submit" value="Continue &gt;&gt;" 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; ">

&nbsp;</p>

	</div>

</td>

</tr>



</table>

</div>

</div>

<tr>

<td colspan="2">



</td>

</tr>



</table>





</tr></td></table>



</body>

</html>

<?php }?>
Return current item: Open4Listing