<?php session_start();?>
<?php
include ('dbf.php');
if($_POST[ins])
{
   $valu=split(",",$_POST[ins]);
   $row=mysql_query("select * from `dio` where code='{$valu[1]}'");
   $cd=mysql_num_rows($row);
   if($cd=='0')
     $suq=mysql_query("insert into  dio (sarfasl,code,name,user,city)
	VALUES ('{$valu[0]}','{$valu[1]}','{$valu[2]}','{$_SESSION['user']}','{$_SESSION['city']}')");
   if($suq)
      echo 'success';
    else
	 echo'<span class="blacktext">كد كنگره تكراري است</span>';
}
if (isset($_POST['del']))
{
	mysql_query("delete from dio where ip={$_POST['id']}");
}
elseif (isset($_POST['edit']))
{
   $valu=split(",",$_POST['edit']);
   mysql_query("update dio set sarfasl='{$valu[0]}',code='{$valu[1]}'
	,name='{$valu[2]}' where ip={$_POST['id']}");
   $_SESSION[selpage]="dio.php";
   include ('login.php');
}


?>