<?php session_start();?>
<?php
include ('dbf.php');
if($_POST[ins])
{
   $valu=split(",",$_POST[ins]);
   $row=mysql_query("select * from `majale` where ip='{$valu[0]}'");
   $cd=mysql_num_rows($row);
   if($cd=='0')
      $suq=mysql_query("insert into  `majale` (ip,kind,name,date_nashr,number,p_number
	,page_number,topic,seryal,price1,price2,s_emtiaz,sardabir,place1,place2
	,mojodi,magh_number,tou,city,user)
	VALUES ('{$valu[0]}','{$valu[1]}','{$valu[2]}','{$valu[3]}'
	,'{$valu[4]}','{$valu[5]}','{$valu[6]}'
	,'{$valu[7]}','{$valu[8]}','{$valu[11]}'
	,'{$valu[12]}','{$valu[10]}','{$valu[9]}'
	,'{$valu[13]}','{$valu[14]}','{$valu[15]}'
	,'{$valu[17]}','{$valu[16]}','{$_SESSION[city]}','{$_SESSION[user]}')");
	 if($suq)
      echo 'success';
	 else
	  echo'<span class="blacktext">شماره ثبت تکراری است</span>';
  
   	

}
elseif (isset($_POST['edit']))
{
   $valu=split(",",$_POST['edit']);
   mysql_query("update `majale` set ip='{$valu[0]}',kind='{$valu[1]}'
	,name='{$valu[2]}',date_nashr='{$valu[3]}',number='{$valu[4]}'
	,p_number='{$valu[5]}',page_number='{$valu[6]}'
	,topic='{$valu[7]}',seryal='{$valu[8]}'
	,price1='{$valu[11]}',price2='{$valu[12]}',s_emtiaz='{$valu[10]}'
	,sardabir='{$valu[9]}',place1='{$valu[13]}',place2='{$valu[14]}'
	,mojodi='{$valu[15]}',tou='{$valu[16]}'
	 where id={$_POST['id']}");
   $_SESSION[selpage]="majale.php";
   include ('login.php');
}
elseif (isset($_POST['del']))
{
  mysql_query("delete from majale where id={$_POST['id']}");
}




?>