0

What am I doing wrong here?

<?php

session_start();
$con = mysqli_connect("localhost", "root", "password", "db");

if (!isset($_SESSION['lodge'])) {
    header("Location: lodge.php");
}
$token = mysqli_real_escape_string($con, $_POST['token']);
$res = mysqli_query($con, "SELECT * FROM lodges WHERE lodge_id=" . $_SESSION['lodge']); 
$row = mysqli_fetch_array($res);
if ($row['token'] == ($token)) {
    $_SESSION['lodge'] = $row['lodge_id'];
    header('location:lodge.php');
}

?>

I keep getting the undefined variable token error, and can't seem find my way around this.

MC Emperor
  • 22,334
  • 15
  • 80
  • 130
RileyManda
  • 2,536
  • 25
  • 30

0 Answers0