/**
  * Pasa las variables de sesiĆ³n a una cadena con el formato
  * <nombrevariable> <valor> ...
  */
 private static function CreaVariablesSesion()
 {
     $vars = NULL;
     $i = 1;
     foreach ($_SESSION as $clave => $valor) {
         if ($i < count($_SESSION)) {
             $vars = $vars . $clave . " " . $valor . "&";
         } else {
             $vars = $vars . $clave . " " . $valor;
         }
         $i++;
     }
     self::$_varsget = $vars;
 }
<?php

require_once 'Librerias/GestionaPlantilla.php';
session_start();
GestionaPlantilla::Inicio_Plantilla("Plantilla/__PlantillaSESION.php");
if (isset($_POST['usuario'])) {
    if ($_POST['usuario'] == "antonio" && $_POST['pswd'] == "1234") {
        //session_start();
        $_SESSION["autenticacion"] = $_POST['usuario'];
        header("location:index2.php");
    }
} else {
    echo "<form action='' method='post'>";
    echo "<input type='text' name='usuario'/>";
    echo "<input type='password' name ='pswd'/>";
    echo "<input type='submit' value='Enviar'/>";
    echo "</form>";
}
GestionaPlantilla::Fin_Plantilla();
?>


 public static function Inicio_Plantilla($plantilla)
 {
     self::$_plantilla = $plantilla;
     exec("php -f {$plantilla} > ./datos.txt");
     ob_start("GestionaPlantilla::Render_Body");
 }