Forum Moderators: coopster
Parse error: syntax error, unexpected $end in /Applications/MAMP/htdocs/realestate/create_property.php on line 180
line 180 is the last line
[CODES]
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php
/*
----------------------------------------------
Note :
- GD must Enabled
- Autodetect file extension (.jpg/jpeg, .png, .gif, .wbmp)
but some server can't generate .gif / .wbmp file types
- If your GD not support 'ImageCreateTrueColor' function,
change one line from 'ImageCreateTrueColor' to 'ImageCreate'
(the position in 'show' and 'save' function)
*/############################################
class thumbnail
{
var $img;
function thumbnail($imgfile)
{
//detect image format
$this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile);
$this->img["format"]=strtoupper($this->img["format"]);
if ($this->img["format"]=="JPG" ¦¦ $this->img["format"]=="JPEG") {
//JPEG
$this->img["format"]="JPEG";
$this->img["src"] = ImageCreateFromJPEG ($imgfile);
} elseif ($this->img["format"]=="PNG") {
//PNG
$this->img["format"]="PNG";
$this->img["src"] = ImageCreateFromPNG ($imgfile);
} elseif ($this->img["format"]=="GIF") {
//GIF
$this->img["format"]="GIF";
$this->img["src"] = ImageCreateFromGIF ($imgfile);
} elseif ($this->img["format"]=="WBMP") {
//WBMP
$this->img["format"]="WBMP";
$this->img["src"] = ImageCreateFromWBMP ($imgfile);
} else {
//DEFAULT
echo "Not Supported File";
exit();
}
@$this->img["lebar"] = imagesx($this->img["src"]);
@$this->img["tinggi"] = imagesy($this->img["src"]);
//default quality jpeg
$this->img["quality"]=75;
}
function size_height($size=100)
{
//height
$this->img["tinggi_thumb"]=$size;
@$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"];
}
function size_width($size=100)
{
//width
$this->img["lebar_thumb"]=$size;
@$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"];
}
function size_auto($size=100)
{
//size
if ($this->img["lebar"]>=$this->img["tinggi"]) {
$this->img["lebar_thumb"]=$size;
@$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"];
} else {
$this->img["tinggi_thumb"]=$size;
@$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"];
}
}
function jpeg_quality($quality=75)
{
//jpeg quality
$this->img["quality"]=$quality;
}
function show()
{
//show thumb
@Header("Content-Type: image/".$this->img["format"]);
/* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
$this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
@imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);
if ($this->img["format"]=="JPG" ¦¦ $this->img["format"]=="JPEG") {
//JPEG
imageJPEG($this->img["des"],"",$this->img["quality"]);
} elseif ($this->img["format"]=="PNG") {
//PNG
imagePNG($this->img["des"]);
} elseif ($this->img["format"]=="GIF") {
//GIF
imageGIF($this->img["des"]);
} elseif ($this->img["format"]=="WBMP") {
//WBMP
imageWBMP($this->img["des"]);
}
}
function save($save="")
{
//save thumb
if (empty($save)) $save=strtolower("./thumb.".$this->img["format"]);
/* change ImageCreateTrueColor to ImageCreate if your GD not supported ImageCreateTrueColor function*/
$this->img["des"] = ImageCreateTrueColor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);
@imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);
if ($this->img["format"]=="JPG" ¦¦ $this->img["format"]=="JPEG") {
//JPEG
imageJPEG($this->img["des"],"$save",$this->img["quality"]);
} elseif ($this->img["format"]=="PNG") {
//PNG
imagePNG($this->img["des"],"$save");
} elseif ($this->img["format"]=="GIF") {
//GIF
imageGIF($this->img["des"],"$save");
} elseif ($this->img["format"]=="WBMP") {
//WBMP
imageWBMP($this->img["des"],"$save");
}
}
}
?>
<?php
if(isset($_FILES['photo']['name']))
{
$base_path = "images/";
$extension = explode(".",$_FILES['photo']['name']);
$filename = "imgtest.".$extension[1];
$target_path = $base_path.$filename;
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target_path))
{
$thumb = new thumbnail($target_path); // generate image_file, set filename to resize
$thumb->size_auto(200); // set the biggest width or height for thumbnail
$thumb->jpeg_quality(100); // [OPTIONAL] set quality for jpeg only (0 - 100) (worst - best), default = 75
$thumb->save($target_path); // save your thumbnail to file
}
$PropertyAddress = $_POST['PropertyAddress'];
$Area = $_POST['Area'];
$listedPrice = $_POST['listedPrice'];
$description = $_POST['description'];
$datebuild = $_POST['year'] . - $_POST['month'] . - $_POST['date'];
$listingdate = $_POST['lyear'] . - $_POST['lmonth'] . - $_POST['ldate'];
$nobedroom = $_POST['No_bedroom'];
$PropertyType = $_POST['PropertyType'];
?>
<?php
$query = "INSERT INTO properties (
PropertyType, PropertyAddress, No_bedroom, ListingDate, ListedPrice, DateBuild, Area, Description
)VALUES (
{$PropertyType}, '{$PropertyAddress}', {$nobedroom}, '{$listingdate}', {$listedPrice}, '{$datebuild}', {$Area}, '{$description}'
)";
$result = mysql_query($query, $connection);
if ($result) {
// Success!
header( 'Location: success.php' );
} else {
// Display error message.
echo "<p>Property addtion failed.</p>";
echo "<p>" . mysql_error() . "</p>";
}
?>
<?php mysql_close($connection); ?>
[/codes]
Here at first glance it looks like you are missing a closing curly bracket
$PropertyAddress = $_POST['PropertyAddress'];
$Area = $_POST['Area'];
$listedPrice = $_POST['listedPrice'];
$description = $_POST['description'];
$datebuild = $_POST['year'] . - $_POST['month'] . - $_POST['date'];
$listingdate = $_POST['lyear'] . - $_POST['lmonth'] . - $_POST['ldate'];
$nobedroom = $_POST['No_bedroom'];
$PropertyType = $_POST['PropertyType'];
} // HERE
Post again if this is not correct