Note that there are some explanatory texts on larger screens.

plurals
  1. POphp program download permission
    primarykey
    data
    text
    <p>This is a page where a boss can enable or disable the download of a file for its employee. The boss should only be able to enable files for its employee that he (the boss) can already use. The programs that the employee already has access to must be green. The problem is that all programs turn green because the SQL is listening to the ID of the boss, not the ID of the employee. Any suggestions? <pre><code>require_once('databankverbinding.php'); if(empty($_SESSION['myusername'])) header('location: /request/login.php'); ?&gt; &lt;html&gt; &lt;head&gt;&lt;title&gt;Programs&lt;/title&gt; &lt;link href="css/search.css" rel="stylesheet" type="text/css"/&gt; &lt;/head&gt; &lt;body&gt; &lt;?php if(!empty($_SESSION['myusername'])){ echo $_SESSION['myusername']; echo $_SESSION['userID'];} $user = $_SESSION['userID']; echo $_GET['UserID']; echo $user; $sqlq = "SELECT tblfile.FileID, tblfile.FileName, tblfile.FileDescription,tblfile.FileType,tblfile.FileSize,tblfile.FileDate,tblfile.FileActive, tbluser_file.User_FileID, tbluser_file.FileID, tbluser_file.UserID, tbluser_file.fldactief, tbluser.UserID, tbluser.Username, tbluser.Password, tbluser.BossID FROM tbluser INNER JOIN (tblfile INNER JOIN tbluser_file ON tblfile.FileID = tbluser_file.FileID) ON tbluser.UserID = tbluser_file.UserID WHERE tbluser_file.UserID = '".$user."' AND tblfile.FileActive = 1 AND tbluser_file.fldactief = 1 " ; // Alle mappen ophalen $sql = 'SELECT UserID, username FROM tbluser'; $sql .= ' WHERE UserID = '.$_GET['UserID']; $res = mysql_query($sql); $row = mysql_fetch_array($res); $sql3 = "SELECT tblfile.FileID, tblfile.FileName, tblfile.FileDescription,tblfile.FileType,tblfile.FileSize,tblfile.FileDate,tblfile.FileActive, tbluser_file.User_FileID, tbluser_file.FileID, tbluser_file.UserID, tbluser_file.fldactief, tbluser.UserID, tbluser.Username, tbluser.Password, tbluser.BossID FROM tbluser INNER JOIN (tblfile INNER JOIN tbluser_file ON tblfile.FileID = tbluser_file.FileID) ON tbluser.UserID = tbluser_file.UserID WHERE tbluser_file.UserID = '".$_GET['UserID']."' AND tblfile.FileActive = 1 AND tbluser_file.fldactief = 1 " ; // Alle mappen ophalen $res3 = mysql_query($sql3); $row3 = mysql_fetch_array($res3); $res = mysql_query($sqlq); echo ' &lt;form action="category.php"&gt; &lt;fieldset&gt; &lt;legend&gt;Catergory Edit/Delete:&lt;/legend&gt; &lt;table&gt;'; echo $row['UserID']; while($row = mysql_fetch_array($res)){ if(($row3['fldactief']) == 0){ echo ' &lt;tr&gt; &lt;td&gt;'. $row['FileName'] . '&lt;/td&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;a href="controluser.php?action=enable&amp;UserID='.$_GET['UserID'].'&amp;FileID='.$row['FileID'].'"&gt;&lt;img class="delete" src="images/enable.png" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;a href="controluser.php?action=disable&amp;UserID='.$_GET['UserID'].'&amp;FileID='.$row['FileID'].'" &gt;&lt;img class="delete" src="images/disable.png" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;';} else{ echo ' &lt;tr&gt; &lt;td&gt;&lt;h4 style="color:green;"&gt;'. $row['FileName'] . '&lt;/h4&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;a href="controluser.php?action=enable&amp;UserID='.$_GET['UserID'].'&amp;FileID='.$row['FileID'].'"&gt;&lt;img class="delete" src="images/enable.png" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&amp;nbsp;&lt;a href="controluser.php?action=disable&amp;UserID='.$_GET['UserID'].'&amp;FileID='.$row['FileID'].'" &gt;&lt;img class="delete" src="images/disable.png" /&gt;&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;';} } echo ' &lt;/table&gt; &lt;/fieldset&gt; &lt;/form&gt; '; ?&gt; &lt;a href="controluser.php"&gt;Go to Control Panel&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload