Location: PHPKode > projects > Arab Cart > arabCart/add2cart.php
<?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();

$stime=date("Y-m-d",mktime());

require_once("connections/connection.php");

require_once("includes/lang-eng.php");

if ( ($id<0) || (!is_numeric($id)) || (!isset($sid)) || ($id==0) )

{

	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="3; URL=shoppingcart.php?sid='.$PHPSESSID.'">

						<title>'.titel.'</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> '.not_allowed_op.' </b>		

					</td>

						</tr>

					</table>

					</td></tr>

					</table>

					</div>

					</body>	

					</html>');

}

else 

{

$sql_check=mysql_query("select * from `cart_temp` where `product_id` =  '".$id."' AND `session`='".$sid."'  ") or die(mysql_error());

if(mysql_num_rows($sql_check)!=0)

	{

				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="3; URL=shoppingcart.php?sid='.$PHPSESSID.'">

						<title>'.titel.'</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> '.Sorryp2.' </b>		

					</td>

						</tr>

					</table>

					</td></tr>

					</table>

					</div>

					</body>	

					</html>');



	}

else

	{

		$sql_cart=mysql_query("INSERT INTO `cart_temp` ( `id` , `product_id` , `session` , `req_date` , `quantity` )VALUES ('', '".$id."', '".$sid."', '".$stime."', '1')") 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=shoppingcart.php?sid='.$PHPSESSID.'">

						<title>'.titel.'</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> '.info.' </b>		

					</td>

						</tr>

					</table>

					</td></tr>

					</table>

					</div>

					</body>	

					</html>');

	}

}

?>
Return current item: Arab Cart