Vue app: how to use public/index.html in .php format?

Viewed 429

I wanna add this php script above the html of my index.html file:

<?php
session_start();

if ($_SESSION['logged_in'] != 1 || !isset($_SESSION['userid'])) {
  $_SESSION['message'] = "Sie müssen Sich zuerst einloggen!";
  header("location: error");    
}else {
    // Leichter zum Lesen
    $userid = $_SESSION['userid'];
    $email = $_SESSION['email'];
}
if(isset($_GET['eventid']) && $_GET['eventid'] != null && $_GET['eventid'] != ""){
  $eventid = $_GET['eventid'];
}else{
  header("location: my_events");
}
?>

, but for that I would need to use .php extension. Npm run build doesn't like that. What could be a valid solution, so that I can use php sessions with Vue?

0 Answers
Related