<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[43]!=1)
  jump("jump.php?id=25&jump=main.php");
if(isset($_GET['action']) and $_GET['action'] == "carddo")
{
  if(eregi("^[0-9]+$",$_POST['stock']) and eregi("^[0-9]+$",$_POST['price']) and eregi("^[0-9]+$",$_POST['dprice']) and eregi("^[0-9]+$",$_POST['vprice']))
  {
    $phpcolor->table="shop_card";
    $phpcolor->field="stock='".$_POST['stock']."',price='".$_POST['price']."',dprice='".$_POST['dprice']."',vprice='".$_POST['vprice']."'";
    $phpcolor->where="id = '".$_GET['id']."'";
    $phpcolor->upgrade();
	jump("jump.php?id=24&jump=shop.php");
  }
  else
    jump("jump.php?id=2&jump=shop.php");
}
if(isset($_GET['action']) and $_GET['action'] == "csubmit")
{
  $str = "<?php\n";
  foreach($_POST AS $key=>$val)
  {
	$val=html_replacef($val);
    $str.= "$".$key."=\"".$val."\";\n";
  }
  $str.= "?>";
  $filename='../configs/shop.php';
  @chmod($filename,0777);
  if (is_writable($filename)) 
  {
    if (!$handle=fopen($filename,'w') or fwrite($handle, $str) === FALSE)
      Header("Location: jump.php?id=error&jump=shop.php");
	else
	  Header("Location: jump.php?id=24&jump=shop.php");
	fclose($handle);
	exit();
  }
  else
    jump("jump.php?id=13&jump=shop.php");
}
$phpcolor->table="shop_card";
$phpcolor->field="*";
$phpcolor->where="1=1 order by queue limit ".($_GET['page']*25).",25";
$card=$phpcolor->assignment();
$tpl -> assign("card", $card);
$tpl -> assign("shop_open", $shop_open);
$tpl -> assign("shop_dropen", $shop_dropen);
$tpl -> assign("shop_drmm", $shop_drmm);
$tpl -> assign("shop_drmy", $shop_drmy);
$tpl -> assign("shop_dri", $shop_dri);
$tpl -> assign("shop_vipopen", $shop_vipopen);
$tpl -> assign("shop_vipmm", $shop_vipmm);
$tpl -> assign("shop_vipmy", $shop_vipmy);
$tpl -> assign("shop_vipi", $shop_vipi);
$tpl -> display("shop.htm");
?>