Fix Bug352
							parent
							
								
									8d30ecc584
								
							
						
					
					
						commit
						ef87c1248f
					
				
							
								
								
									
										21
									
								
								Admin.php
								
								
								
								
							
							
						
						
									
										21
									
								
								Admin.php
								
								
								
								
							|  | @ -9,7 +9,7 @@ include 'Header.php'; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| <?php | <?php | ||||||
| // Only Lecturer or Admin could access this page
 |  //Only Lecturer or Admin could access this page
 | ||||||
| if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | ||||||
|     die("Sorry.  Nothing to see here."); |     die("Sorry.  Nothing to see here."); | ||||||
| } | } | ||||||
|  | @ -70,19 +70,25 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | ||||||
| 			Full name | 			Full name | ||||||
| 			<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <br> | 			<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <br> | ||||||
| 			Email | 			Email | ||||||
| 			<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <br> | 			<input type="text" name="email" placeholder="Email / Student Number" class="form-control" > <br> | ||||||
| 			Passport No. (used as the initial password) |                 Initial password | ||||||
| 			<input type="text" class="form-control" name="passport" placeholder="Passport No" required=""> <br> | 
 | ||||||
|  |             <input type="text" class="form-control" name="passport" minlength="8" placeholder="Initial password" > | ||||||
|  |             Leave it empty to let LRR generate a strong password for you.<br><br> | ||||||
| 			User type: | 			User type: | ||||||
|  | 
 | ||||||
|                 <?php |                 <?php | ||||||
|  | 
 | ||||||
|                 if ($_SESSION['user_type'] == "Lecturer") { |                 if ($_SESSION['user_type'] == "Lecturer") { | ||||||
|                     echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; |                     echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; | ||||||
|                 } else if ($_SESSION['user_type'] == "Admin"){ |                 } else if ($_SESSION['user_type'] == "Admin"){ | ||||||
|                     echo " <input type='radio' name='type' value='Lecturer' required='' id='role_lecturer'> Lecturer "; |                     echo " <input type='radio' name='type' value='Lecturer' required='' id='role_lecturer'> Lecturer "; | ||||||
|                 } |                 } | ||||||
|  | 
 | ||||||
|                 ?>
 |                 ?>
 | ||||||
|  | 
 | ||||||
| 			<br><br> | 			<br><br> | ||||||
| 			<button type="submit" class="btn btn-primary" id="create_btn">Create</button> |                 <button type="submit" class="btn btn-primary" name="create_btn">Create</button> | ||||||
| 
 | 
 | ||||||
| 			<?php | 			<?php | ||||||
| 			error_reporting(E_ALL); | 			error_reporting(E_ALL); | ||||||
|  | @ -108,7 +114,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | ||||||
| 			    <th>ID</th> | 			    <th>ID</th> | ||||||
| 			    <th>Name</th> | 			    <th>Name</th> | ||||||
| 			    <th>Email</th> | 			    <th>Email</th> | ||||||
| 			    <th>Passport / ID </th> |  | ||||||
| 			    <th>Reset password </th> | 			    <th>Reset password </th> | ||||||
| 			    <th>Block/Activate </th> | 			    <th>Block/Activate </th> | ||||||
| 			</tr> | 			</tr> | ||||||
|  | @ -130,7 +135,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | ||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			while ($row = mysqli_fetch_assoc($result)) { | 			while ($row = mysqli_fetch_assoc($result)) { | ||||||
| 			    $pass = $row['Passport_Number']; | 			    $pass =  $row['Password']; | ||||||
| 			    $btn = "<button class='btn btn-warning' onclick=\"updatePassword(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; | 			    $btn = "<button class='btn btn-warning' onclick=\"updatePassword(" . $row['User_ID'] . ",'$pass')\">Reset</button>"; | ||||||
| 			    if ($row['Status'] == "Active") { | 			    if ($row['Status'] == "Active") { | ||||||
| 				$newstatus = "Blocked"; | 				$newstatus = "Blocked"; | ||||||
|  | @ -140,7 +145,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | ||||||
| 				$btnBlock = "<button class='btn btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>"; | 				$btnBlock = "<button class='btn btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>"; | ||||||
| 			    } | 			    } | ||||||
| 
 | 
 | ||||||
| 			    echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; | 			    echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td><td>$btn</td><td>$btnBlock</td></tr>"; | ||||||
| 			} | 			} | ||||||
| 			?>
 | 			?>
 | ||||||
| 		    </table> | 		    </table> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue