<?php
/*
ArabCart, Free E-Commerce Solutions
http://www.arabcart.info
Copyright (c) 2005 Mhd Zaher Ghaibeh
Released under the GNU General Public License
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
*/
session_start();
if((!isset($admin))&&(!isset($upass)))
{
echo('<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset='.charset.'">
<link rel="stylesheet" href="../style/style.css" type="text/css">
<meta http-equiv="Refresh" content="0; URL=../admincp/index.php">
<title>Waite....</title>
</head>
<body>
<br>
<br>
<br>
<div align="center">
<br><br>
<table width="50%" border="1" class="border">
<tr><td class="border">
<table border="0" width="100%" id="table1" cellpadding="5" cellspacing="0">
<tr>
<td align="center">
<b>Sorry you can\'t Assecc <br> Please waite While you Redirected to the Login Page<br>
waite .....</b>
</td>
</tr>
</table>
</td></tr>
</table>
</div>
</body>
</html>');
}
else
{
//uploading process
if($action1){
set_time_limit(60);
$path1 = dirname($PATH_TRANSLATED)."/images/";
$source = $file1;
$source_name = $file1_name;
if(($source <> "none")&&($source <> "")){
if($error1 <> 1){
$dest = $path1.$source_name;
if(copy($source,$dest)){
$imagesize = getimagesize($dest);
switch($imagesize[2]) {
case 0:
echo "<br> Image is a unknown <br>";
unlink($dest);
exit;
case 1:
$newname = $path1;
$newimg =time() . ".gif";
if(!copy($dest,$newname.$newimg)) {
echo "<br> There is an error we couldnt rename the Picture from $dest to $newname";
}
unlink ($dest);
break;
case 2:
$newname = $path1;
$newimg =time() . ".jpg";
if(!copy($dest,$newname.$newimg)) {
echo "<br> There is an error we couldnt rename the Picture from $dest to $newname";
}
unlink ($dest);
break;
case 3:
$newname = $path1;
$newimg =time() . ".png";
if(!copy($dest,$newname.$newimg)) {
echo "<br> There is an error we couldnt rename the Picture from $dest to $newname";
}
unlink ($dest);
break;
}
}
else {
echo "Upload directory not write-enabledn";
$error1 = 1;
die();
}
}
unlink($source);
}
}
//end of uploading
$nimagesize = getimagesize($newname.$newimg);
require_once("../connections/connection.php");
require_once("../includes/Thumbnail.php");
$pname=addslashes($pname);
$sdesc=addslashes(nl2br($sdec));
$fdesc=addslashes(nl2br($fdec));
$sql="INSERT INTO `products` ( `id` , `cat_id` , `name` , `short_desc` , `full_desc` , `img` , `avaliable` , `price` ) ";
$sql.="VALUES ('', '".$catid."', '".$pname."', '".$sdesc."', '".$fdesc."', '".$newimg."', '".$aval."', '".$price."')";
$query=mysql_query($sql) or die(mysql_error());
$img_out="small-".$newimg."";
$a = new Thumbnail($newname.$newimg,100,100,$newname.$img_out,85,'"bevel()"');
$sql2="select id from products where img = '".$newimg."' ";
$query2=mysql_query($sql2) or die(mysql_error());
$row=mysql_fetch_object($query2);
$sql_thumb="INSERT INTO `img_thumb` ( `id` , `product_id` , `thumb_img` ) VALUES ('', '".$row->id."', '".$img_out."')";
$query_thumb=mysql_query($sql_thumb) or die(mysql_error());
echo('
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset='.charset.'">
<link rel="stylesheet" href="../style/style.css" type="text/css">
<meta http-equiv="Refresh" content="0; URL=../admincp/pman.php?sid='.$PHPSESSID.'">
<title>Waite....</title>
</head>
<body>
<br>
<br>
<br>
<div align="center">
<br><br>
<table width="50%" border="1" class="border">
<tr><td class="border">
<table border="0" width="100%" id="table1" cellpadding="5" cellspacing="0">
<tr>
<td align="center">
<b> Please waite While We Process the Information ...<br>
waite .....</b>
</td>
</tr>
</table>
</td></tr>
</table>
</div>
</body>
</html>');
}
?>