require_once("conn.php");
require_once("access.php");
require_once("includes.php");
//if($_SESSION[AccountStatus] != "active")
//{
// header("location:inactive.php");
// exit();
//}
//get the info
$q1 = "select * from yellow_posts where AgentID = '$_SESSION[AgentID]' and PostID= '$_GET[id]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
if(isset($_POST[s1]))
{
$LogoImage = $_FILES[logo][name];
if(!empty($LogoImage))
{
$MyLogo = $t."_logo_".$LogoImage;
copy($_FILES[logo][tmp_name], "yellow_images/".$MyLogo);
}
else
{
$MyLogo = $_POST[OldLogo];
}
//manage files
$MyImages = array();
if(!empty($_FILES[ResumeImages][name][0]))
{
while(list($key,$value) = each($_FILES[ResumeImages][name]))
{
if(!empty($value))
{
$NewImageName = $t."_resume_".$value;
copy($_FILES[ResumeImages][tmp_name][$key], "yellow_images/".$NewImageName);
$MyImages[] = $NewImageName;
}
}
if(!empty($MyImages))
{
if(empty($_POST[OldImages]))
{
$ImageStr = implode("|", $MyImages);
}
else
{
$ImageStr = implode("|", $MyImages);
$ImageStr = $ImageStr."|".$_POST[OldImages];
}
}
}
else
{
$ImageStr = $_POST[OldImages];
}
if(!empty($_POST[website]))
{
if(!ereg("^http://", $_POST[website]))
{
$NewWebsite = "";
}
elseif(strlen($_POST[website]) < '11')
{
$NewWebsite = "";
}
else
{
$NewWebsite = $_POST[website];
}
}
$q1 = "update yellow_posts set
CompanyName = '$_POST[CompanyName]',
CategoryID = '$_POST[CategoryID]',
SubCategoryID = '$_POST[SubCategoryID]',
Price = '$_POST[Price]',
City = '$_POST[city]',
resume = '$_POST[resume]',
logo = '$MyLogo',
ResumeImages = '$ImageStr'
where PostID = '$_POST[PostID]' ";
mysql_query($q1);
header("location:editlisting.php?id=$_POST[PostID]");
exit();
}
if($a1[news] == 'y')
{
$ch1 = "checked";
}
if($a1[news] == 'n')
{
$ch2 = "checked";
}
if($a1[NewsletterType] == 'html')
{
$ch3 = "checked";
}
if($a1[NewsletterType] == 'plain')
{
$ch4 = "checked";
}
/////////////////////////
///// image block
/////////////////////////
$images = "";
if(!empty($a1[ResumeImages]))
{
$images = explode("|", $a1[ResumeImages]);
while(list(,$v2) = each($images))
{
$ImageBlock .= "
delete
";
$i++;
}
}
if($i < '5')
{
for($z = '1'; $z <= (5 - $i); $z++)
{
$ImageBlock .= "
\n";
}
}
if(!empty($a1[website]))
{
$MyWeb = $a1[website];
}
else
{
$MyWeb = "http://";
}
//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/EditListTemplate.php");
require_once("templates/FooterTemplate.php");
?>