Fix Bug352
							parent
							
								
									8d30ecc584
								
							
						
					
					
						commit
						ef87c1248f
					
				
							
								
								
									
										37
									
								
								Admin.php
								
								
								
								
							
							
						
						
									
										37
									
								
								Admin.php
								
								
								
								
							|  | @ -9,7 +9,7 @@ include 'Header.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") { | ||||
|     die("Sorry.  Nothing to see here."); | ||||
| } | ||||
|  | @ -65,24 +65,30 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | |||
| 		    } | ||||
| 
 | ||||
| 		    ?>
 | ||||
| 		    <form method="post" action="Script.php" id="create_account_form"> | ||||
| 		    <form method="post" action="Script.php"  id="create_account_form"> | ||||
| 			<input type="hidden" name="form_createlecturrer" value="true" required="" /> | ||||
| 			Full name | ||||
| 			<input type="text" name="fullname" placeholder="Full Name" class="form-control" required=""> <br> | ||||
| 			Email | ||||
| 			<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required=""> <br> | ||||
| 			Passport No. (used as the initial password) | ||||
| 			<input type="text" class="form-control" name="passport" placeholder="Passport No" required=""> <br> | ||||
| 			<input type="text" name="email" placeholder="Email / Student Number" class="form-control" > <br> | ||||
|                 Initial password | ||||
| 
 | ||||
|             <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: | ||||
| 			<?php | ||||
| 			if ($_SESSION['user_type'] == "Lecturer") { | ||||
| 			    echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; | ||||
| 			} else if ($_SESSION['user_type'] == "Admin"){ | ||||
| 			    echo " <input type='radio' name='type' value='Lecturer' required='' id='role_lecturer'> Lecturer "; | ||||
| 			} | ||||
| 			?>
 | ||||
| 
 | ||||
|                 <?php | ||||
| 
 | ||||
|                 if ($_SESSION['user_type'] == "Lecturer") { | ||||
|                     echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) '; | ||||
|                 } else if ($_SESSION['user_type'] == "Admin"){ | ||||
|                     echo " <input type='radio' name='type' value='Lecturer' required='' id='role_lecturer'> Lecturer "; | ||||
|                 } | ||||
| 
 | ||||
|                 ?>
 | ||||
| 
 | ||||
| 			<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 | ||||
| 			error_reporting(E_ALL); | ||||
|  | @ -108,7 +114,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | |||
| 			    <th>ID</th> | ||||
| 			    <th>Name</th> | ||||
| 			    <th>Email</th> | ||||
| 			    <th>Passport / ID </th> | ||||
| 			    <th>Reset password </th> | ||||
| 			    <th>Block/Activate </th> | ||||
| 			</tr> | ||||
|  | @ -130,7 +135,7 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") { | |||
| 			} | ||||
| 
 | ||||
| 			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>"; | ||||
| 			    if ($row['Status'] == "Active") { | ||||
| 				$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>"; | ||||
| 			    } | ||||
| 
 | ||||
| 			    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> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue