Created
January 24, 2026 01:20
-
-
Save maxixo/9f3cec32f4667c630b9d418ffb2d00c3 to your computer and use it in GitHub Desktop.
logout in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| session_start(); | |
| if(!isset($_SESSION['user_id'])) { | |
| header("location: logn.html"); | |
| exit; | |
| } | |
| echo "Welcome to your dashboard"; | |
| ?> | |
| <form action="logout.php"> | |
| <button>Logout</button> | |
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| session_start(); | |
| session_destroy(); | |
| header("Location: login.html"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment