session_start();
include "include/manager_config.php";
if(isset($_POST[submit]))
{
############### image upload start ###########
if ($PhotoT == "Change_Photo" || $PhotoT == "")
{
$Picc = $HTTP_POST_FILES['pic']['name'];
$size_limit = "20480000"; /* set size limit in bytes - 200kb*/
$allowed_types = array("image/gif","image/jpeg", "image/pjpeg", "image/jpg", "image/bmp", "image/png",
"image/x-png", "image/psd");
/*NB: DON'T change the types allowed coz these are the ones that GetImageSize() can handle*/
$maxPixelSize = 1000;
if(!empty($Picc))
{
$img_size=$HTTP_POST_FILES['pic']['size'];
$img_type=$HTTP_POST_FILES['pic']['type'];
$temp = $HTTP_POST_FILES['pic']['tmp_name'];
$size_limit = "204800000"; /* set size limit in bytes - 200kb*/
$allowed_types = array("image/gif","image/jpeg", "image/pjpeg", "image/jpg");
/*NB: DON'T change the types allowed coz these are the ones that GetImageSize() can handle*/
$maxPixelSize = 1500;
if($img_size!="0")
{
if ($img_size < $size_limit)
{
if (in_array($img_type,$allowed_types))
{
$pixelsize = getimagesize($temp);
if(($pixelsize[0]>$maxPixelSize) || ($pixelsize[1]>$maxPixelSize))
{
$err_msgs .= "The file $Picc you selected is $pixelsize[0] X
$pixelsize[1] pixels and is too large to be uploaded!
";
}
}
else
{
$err_msgs .= "The file $Picc is not an image. Files of type
$img_type are not allowed to be uploaded!
";
}
}
else
{
$err_msgs .= "The file $Picc you selected to upload is too large to be
uploaded!
";
}
}
else if($img_size=="0")
{
$err_msgs .= "The file $Picc was not found!
";
}
}
/* if ($PhotoT == "Change_Photo" && empty($Picc))
{
$err_msgs .= "No image uploaded!
";
} */
// else
// $err_msgs .= "The file for Logo is left empty.
";
}
if(!empty($err_msgs)) field_error($err_msgs, $sendtourl, $frm);
$today_date = date("d/m/Y");
if ($PhotoT == "Keep_Photo")
{
$Picc=$imghidden;
}
if ($PhotoT == "Remove_Photo")
{
$Picc="";
if(!empty($imghidden))
{
$filep=$imghidden;
unlink("uploaded/".$filep);
}
}
if ($PhotoT == "Change_Photo" || $PhotoT == "")
{
//imguploadstart
$Picc = $HTTP_POST_FILES['pic']['name'];
if(!empty($Picc))
{
$temp = $HTTP_POST_FILES['pic']['tmp_name'];
$uniq = uniqid("");
$Picc = $uniq."_".$Picc;
$upload = "uploaded/".$Picc;
copy($temp, $upload);
if(!empty($imghidden))
{
$filep=$imghidden;
unlink("uploaded/".$filep);
}
}
}
########### image upload end ########
$today=date("Y-m-d");
mysql_query("INSERT INTO `meltlist`.`meltlist_story` (
`story_id` ,
`name` ,
`email` ,
`story_title` ,
`desc` ,
`pic` ,
`date_add` ,
`active`
)
VALUES (
'', '$_POST[name]', '$_POST[email]', '$_POST[story_title]', '$_POST[desc]','$Picc', '$today','N' )");
$id=mysql_insert_id();
$sql_sel = mysql_query("select * from ".TABLEPREFIX."_story WHERE story_id='$id'");
$no=mysql_num_rows($sql_sel);
$val=mysql_fetch_array($sql_sel);
$pic=$val[pic];
}
?>
Merkas Health
You don't know untill you know...!
"Its all about the list"
|
|
|
if($_SESSION[user_id]=='')
{
?>
}
?>
|
Recent Blog Post
Blokes (men) don't shop!
I'm not afraid to say that my closet contains more than 4 of the same
white colour t-shirts.. Life is practical and easy!
So choosing a "shop me" melt was stepping
out of my confort circle, but let me tell you...
Blokes (men) don't shop!
Seven Ha Ha Ha
|
|
|
|
|