<?php
/***************************************************************************
* Product Name : Pointter PHP Content Management System
* Version : V 1.2
* Release Date : 01/02/11
* Copyright : (C) 2011 PangramSoft / Murat Cevik
* Program URL : http://www.pointter.com
* Company URL : http://www.pangramsoft.com
* Email Address : hide@address.com
***************************************************************************/
/****************************************************************************
Pointter PHP Content Management System is licensed under Creative Commons Attribution Non-commercial No Derivatives 3.0 Unported (by-nc-nd) License.
To view a copy of this license, (a) visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or (b) send a letter to Creative Commons, 171 2nd Street,
Suite 300, San Francisco, California, 94105, USA.
You must not remove/modify/alter the copyright informations both visible and invisible forms in the source code and you must not remove/modify/alter
the copyright informations in the footer part of the script including the Pointter image (png format file), hard link and title tag.
Please contact the copyright holder PangramSoft / Murat Cevik for a commercial license to remove the copyright information in the footer part of the script.
*****************************************************************************/
$category=$_POST[category];
$product=$_POST[product];
$html=$_POST[html];
$url=$_POST[producturl];
$d_url=$url.'.php';
if ($category!="" AND $product!="" AND $url!="")
{
if (is_uploaded_file($_FILES[imagefile][tmp_name]))
{
//Upload Image File
$image=basename($_FILES['imagefile']['name']);
$target_path="../../images/";
$target=$target_path.$image;
if (eregi('image/',$_FILES['imagefile']['type']))
move_uploaded_file($_FILES['imagefile']['tmp_name'],$target);
}
else
$image='noimage.png';
//Create PHP File For The Product
$code=file_get_contents('temp.php');
$file="../../".$url.'.php';
$temp=fopen($file,"w");
fwrite($temp,$code);
fclose($temp);
//Enter Product Information To Database
include '../../configset/conn.php';
$subcat=mysql_query("SELECT * FROM Category WHERE Name='$category'");
$sub_row=mysql_fetch_array($subcat);
if ($sub_row[Code]==1)
{
$sub_subcat=mysql_query("SELECT Name FROM Category WHERE CategoryID='$sub_row[Subcode]'");
$subcat_row=mysql_fetch_array($sub_subcat);
mysql_query("INSERT INTO Products (Url,Category,ProductName,Image,Html,Subcode) VALUES ('$d_url','$category','$product','$image','$html','$subcat_row[Name]')");
}
else
mysql_query("INSERT INTO Products (Url,Category,ProductName,Image,Html,Subcode) VALUES ('$d_url','$category','$product','$image','$html','$category')");
//Enter Category View Information To Database
mysql_query("INSERT INTO Views (Url,Name,Type) VALUES ('$d_url','$product','Product')");
//Enter Category Metatag Information To Database
mysql_query("INSERT INTO Metatags (Url) VALUES ('$d_url')");
mysql_close($connect);
//Upload Product Gallery Images
for ($i=0;$i<5;$i++)
{
if (is_uploaded_file($_FILES[userfile][tmp_name][$i]))
{
//Thumb Image
$image_g=basename($_FILES[userfile][name][$i]);
$target_path="../../thumb/";
$target=$target_path.$image_g;
//Original Image
$target_copy_path="../../original/";
$target_copy=$target_copy_path.$image_g;
if (eregi('image/',$_FILES[userfile][type][$i]))
{
move_uploaded_file($_FILES[userfile][tmp_name][$i],$target);
copy($target,$target_copy);
include 'imagesize.php';
// Update Product Gallery Image Info Into Database
include '../../configset/conn.php';
mysql_query("INSERT INTO Images (Url,Imagefile) VALUES ('$d_url','$image_g')");
mysql_close($connect);
}
}
}
header ("location:../product.php");
}
else
header ("location:../product.php");
?>