?
Path : /home/admin/public_html/modules-bak/users/ |
Current File : /home/admin/public_html/modules-bak/users/add_group_do.php |
<? session_start(); require_once('../../../config.php'); require_once('../../../libs/MySql.php'); $db=new MySql; function add_category($parent,$name,$detail){ global $db; $numRow=$db->check_data('usertype','usertype_name',$name); if($numRow==""){ if($name!=""&&$detail!=""){ $result=$db->Query("insert into usertype (usertype_parent,usertype_name,usertype_level) values ('$parent','$name','$detail')"); if($result){ $u=$db->getDataOneRow('usertype',$name,'usertype_name'); $id=$u['usertype_id']; if($_POST['checkbox']!=''){ foreach($_POST['checkbox'] as $k=>$v){ $db->Query("INSERT INTO modules (module_name,usertype_access_id) value ('$v','$id')"); }//end foreach } echo"<center><br>บันทึกข้อมูลสำเร็จ</center> <script language=\"JavaScript\"> window.parent.frames[0].location = \"list_group.php\"; </script> <meta http-equiv=\"refresh\" content=\"1;url=add_new_group.php?parent=$parent\"> "; }else{ $error="ไม่สามารถบันทึกข้อมูลได้ในขณะนี้ค่ะ"; echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n"; exit(0); } }else{ $error="กรอกข้อมูลไม่ครบค่ะ"; echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n"; exit(0); }//จบ ตรวจสอบว่าข้อมูลครบหรือไม }else{ //ข้อมูลมีในฐานข้อมูลหรือป่าว $error="ชื่อหมวดหมู่ซ้ำกับของเดิม"; echo "<SCRIPT>alert(\"$error\"); window.history.back(); </SCRIPT>\n"; exit(0); } //จบข้อมูลมีในฐานข้อมูลหรือป่าว }//end ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <TITLE><?echo $cfg['site_name'];?></TITLE> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <META content="" name=Keywords> <META content="<?echo $cfg['site_name'];?>" name="Description"> <META content="<?echo $cfg['site_name'];?>" name="Author"> <META content="<?echo $cfg['site_name'];?>" name="Copyright"> <LINK href="../../css/backend_style2.css" type="text/css" rel="stylesheet"> <? add_category($_POST['parent'],$_POST['name'],$_POST['detail']); ?>