Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
- ?>
- <?php
- session_start();
- if(!isset($_SESSION["userid"]))
- {
- header("Location: index.php");
- }
- ?>
- <?php
- require_once "phpgrid/config.php";
- $db_conf = array();
- $db_conf["type"] = "mysqli";
- $db_conf["server"] = PHPGRID_DBHOST;
- $db_conf["user"] = PHPGRID_DBUSER;
- $db_conf["password"] = PHPGRID_DBPASS;
- $db_conf["database"] = PHPGRID_DBNAME;
- require_once "phpgrid/lib/inc/jqgrid_dist.php";
- $g = new jqgrid($db_conf);
- require_once "constring.php";
- $myconnect = mysqli_connect($servername, $username, $password, $dbname) or die (mysqli_connect_error());
- //THE CUSTOM EVENT
- $e["on_insert"] = array("add_client", null, true);
- $g->set_events($e);
- function add_client($data)
- {
- $sqlhistory = "INSERT INTO history(subject,predicate) VALUES($data["params"]["userid"],'added');";
- mysqli_query($myconnect, $sqlhistory) or die (mysqli_error($myconnect));
- }
- $g->table = "user";
- $col = array();
- $col["title"] = "No";
- $col["name"] = "id";
- $col["sorttype"] = int;
- $col["width"] = "32";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "User ID";
- $col["name"] = "userid";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "textarea";
- $cols[] = $col;
- $col = array();
- $col["title"] = "User Password";
- $col["name"] = "userpw";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "password";
- $col["formatter"] = "password";
- $cols[] = $col;
- $col = array();
- $col["title"] = "User Full Name";
- $col["name"] = "username";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "textarea";
- $cols[] = $col;
- $col = array();
- $col["title"] = "[System1]-Allow Turn On/Off SMS Auto Reply";
- $col["name"] = "privsystem1";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "64";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[System2]-Allow Changing SMS Auto Reply Text";
- $col["name"] = "privsystem2";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "64";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[System3]-Allow Sending SMS Test";
- $col["name"] = "privsystem3";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "64";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[System4]-Allow Seeing History System";
- $col["name"] = "privsystem4";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "64";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[SMS1]-Allow Replying SMS Manually";
- $col["name"] = "privsms1";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "48";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[User1]-Allow Adding New User Account";
- $col["name"] = "privuser1";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "49";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[User2]-Allow Editing User Account";
- $col["name"] = "privuser2";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "49";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[User3]-Allow Deleting User Account";
- $col["name"] = "privuser3";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "49";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[Feature1]-Allow Forwarding Received SMS To Email";
- $col["name"] = "privfeature1";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "66";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[Feature2]-Allow Forwarding Sent SMS To Email";
- $col["name"] = "privfeature2";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "66";
- $col["fixed"] = true;
- $cols[] = $col;
- $col = array();
- $col["title"] = "[Feature3]-Allow Forwarding System History To Email";
- $col["name"] = "privfeature3";
- $col["editable"] = true;
- $col["editrules"] = array("required"=>true);
- $col["edittype"] = "checkbox";
- $col["editoptions"] = array("value"=>"1:0");
- $col["width"] = "66";
- $col["fixed"] = true;
- $cols[] = $col;
- $g->set_columns($cols);
- $grid["rowNum"] = 20;
- $grid["sortname"] = 'id';
- $grid["sortorder"] = "asc";
- $grid["caption"] = "User";
- $grid["autowidth"] = true;
- $grid["add_options"] = array('width'=>'600');
- $grid["edit_options"] = array('width'=>'600');
- $grid["view_options"] = array('width'=>'600');
- $g->set_options($grid);
- if($_SESSION["privuser1"]=="0" AND $_SESSION["privuser2"]=="0" AND $_SESSION["privuser3"]=="0")
- {
- $g->set_actions(array("add"=>false,"edit"=>false,"delete"=>false,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="0" AND $_SESSION["privuser2"]=="0" AND $_SESSION["privuser3"]=="1")
- {
- $g->set_actions(array("add"=>false,"edit"=>false,"delete"=>true,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="0" AND $_SESSION["privuser2"]=="1" AND $_SESSION["privuser3"]=="0")
- {
- $g->set_actions(array("add"=>false,"edit"=>true,"delete"=>false,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="1" AND $_SESSION["privuser2"]=="0" AND $_SESSION["privuser3"]=="0")
- {
- $g->set_actions(array("add"=>true,"edit"=>false,"delete"=>false,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="0" AND $_SESSION["privuser2"]=="1" AND $_SESSION["privuser3"]=="1")
- {
- $g->set_actions(array("add"=>false,"edit"=>true,"delete"=>true,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="1" AND $_SESSION["privuser2"]=="0" AND $_SESSION["privuser3"]=="1")
- {
- $g->set_actions(array("add"=>true,"edit"=>false,"delete"=>true,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="1" AND $_SESSION["privuser2"]=="1" AND $_SESSION["privuser3"]=="0")
- {
- $g->set_actions(array("add"=>true,"edit"=>true,"delete"=>false,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- } else if($_SESSION["privuser1"]=="1" AND $_SESSION["privuser2"]=="1" AND $_SESSION["privuser3"]=="1")
- {
- $g->set_actions(array("add"=>true,"edit"=>true,"delete"=>true,"clone"=>false,"bulkedit"=>false,"view"=>true,"rowactions"=>false,"export"=>true,"autofilter" => true,"search"=>"simple","inlineadd"=>false,"showhidecolumns"=>true));
- }
- // generate grid output, with unique grid name as 'list1'
- $out = $g->render("list1");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement