first commit
This commit is contained in:
		
							
								
								
									
										24
									
								
								cms_admin/security.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								cms_admin/security.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| <?php | ||||
|    session_start(); // Start the session | ||||
|     | ||||
|    // Redirect to login page if the user is not logged in | ||||
|    if (!isset($_SESSION['user_id'])) { | ||||
|        header("Location: sign-in"); | ||||
|        exit(); | ||||
|    } | ||||
|     | ||||
|    include 'db_connection.php'; | ||||
|     | ||||
|    // Fetch the user's data from the database | ||||
|    $user_id = $_SESSION['user_id']; | ||||
|    $sql = "SELECT * FROM users WHERE id = $user_id"; | ||||
|    $result = mysqli_query($conn, $sql); | ||||
|     | ||||
|    if (mysqli_num_rows($result) > 0) { | ||||
|        $user = mysqli_fetch_assoc($result); | ||||
|    } else { | ||||
|        echo "User not found."; | ||||
|        exit(); | ||||
|    } | ||||
|      | ||||
|    ?> | ||||
		Reference in New Issue
	
	Block a user
	 root
					root