File manager - Edit - /home/autoph/public_html/pms_v1/config/addNewRole.php
Back
<?php include_once("../../../cfg/conn.php"); include ("../functions/users.php"); if(isset($_POST['usr'])){ //topKPIID AddKPIName AddKPIWeight AddKPITarget AddKPIDescription $myUserID = $_POST['myUserID']; $accessRoleName = RemoveSpecialChar($_POST['accessRoleName']); $roleDescription = RemoveSpecialChar($_POST['roleDescription']); $sql = "INSERT INTO user_profile (`id`, `profile_name`,`profile_description`, `added_by`) VALUES ('', '$accessRoleName', '$roleDescription', '$myUserID')"; if ($conn->query($sql) === TRUE) { //echo "New record created successfully"; } else { //echo "Error: " . $sql . "<br>" . $conn->error; } //GET LAST PROFILE ID IN PREPARATION TO ENTRY $pro = "SELECT * FROM user_profile WHERE deleted = 0 ORDER BY id DESC LIMIT 1"; $qpro = mysqli_query($conn,$pro); while($pr = mysqli_fetch_array($qpro)){ $proID = $pr['id']; } //Scan All Modules and create Entry with default value or ZERO '0' or DENIED ACCESS $mod = "SELECT * FROM user_modules WHERE deleted = 0"; $qmod = mysqli_query($conn,$mod); while($md = mysqli_fetch_array($qmod)){ $moduleID = $md['id']; //insert to user_profile_data with 0 value $sqlMod = "INSERT INTO user_profile_data (`id`, `profile_id`,`module_id`, `can_view`, `can_add`, `can_edit`, `can_delete`) VALUES ('', '$proID', '$moduleID', '0', '0', '0', '0')"; if ($conn->query($sqlMod) === TRUE) { //echo "New record created successfully"; } else { //echo "Error: " . $sql . "<br>" . $conn->error; } } echo "<table id='RoleData' class='col-lg-12 col-md-12' style='width:150%'>"; echo "<thead>"; echo "<th>ID</th>"; echo "<th>PROFILE NAME</th>"; echo "<th>PROFILE DESCRIPTION</th>"; echo "<th></th>"; echo "<th></th>"; echo "</thead>"; $aRole = "SELECT * FROM `user_profile` WHERE `deleted`=0 ORDER BY `profile_name` ASC"; $qRole = mysqli_query($conn,$aRole); while($row = mysqli_fetch_array($qRole)){ ?><tr onclick="javascript:getInfo(this);" style="width:100%"><?php echo "<td>".$row['id']."</td>"; echo "<td>".$row['profile_name']."</td>"; echo "<td>".$row['profile_description']."</td>"; echo "<td><abbr title='Modify Access'><i class='fa fa-pencil-square-o text-dark' aria-hidden='true' data-toggle='modal' data-target='#viewProfileForm' style='cursor:pointer;font-size:16px'></i></abbr></td>"; echo "<td><abbr title='Delete record'><i class='fa fa-trash text-danger' aria-hidden='true' style='cursor:pointer;font-size:16px'></i></abbr></td>"; echo "</tr>"; } echo "</table>"; $conn->close(); } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings