Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="home.php?logout"><button>Logout</button></a>
- <?php
- $conn = mysqli_connect("127.0.0.1", "root", "123123", "login");
- session_start();
- $user_info = mysqli_fetch_assoc(mysqli_query($conn, "SELECT username FROM users WHERE id = '$_SESSION[id]'"));
- echo "WELCOME $user_info[username]";
- if(isset($_GET["logout"])){
- session_unset();
- session_destroy();
- header("Location: index.php");
- }
- if(!isset($_SESSION["id"])){
- header("Location: index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement