-1

I have problem when I logout in an admin panel with the logout page session. It shows the following error:

Fatal error: Uncaught Error: Call to undefined function redirect() in C:\xampp\htdocs\CMS\admin\logout.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\CMS\admin\logout.php on line 7

Instead, it should show the login page. My code:

<?php include("includes/header.php");?>

<?php
$session->logout();
redirect("login.php");
?>
The Codesee
  • 3,714
  • 5
  • 38
  • 78
Junaid
  • 13
  • 1
  • 2

1 Answers1

1

A redirect function doesn't exist in PHP. You want to use header:

header("Location: login.php");

https://www.php.net/manual/en/function.header.php

The Codesee
  • 3,714
  • 5
  • 38
  • 78