Guten Tag liebe Community!
Derzeit arbeite ich an meiner Content Management System und muss eine Weiterleitung machen.
Als ich nun header(); nutze, werde ich nicht weitergeleitet....
Liegt es ev. an meinem MVC-Anwendung?
Controller.php:
Routing.php
Und nochmal mein IndexControler.php
Hatte auch ein var_dump(); auf header(); gemacht, und bekam nur folgendes als Ergebnis:
string(26) "Location: http://google.de"
MfG.
Derzeit arbeite ich an meiner Content Management System und muss eine Weiterleitung machen.
Als ich nun header(); nutze, werde ich nicht weitergeleitet....
Liegt es ev. an meinem MVC-Anwendung?
Controller.php:
PHP-Code:
<?php
namespace Daily\System;
use \Daily\System\View as View;
class Controller {
public function getModel($model) {
if(file_exists($path = 'application/models/'.$model.'Model.php')) {
$models = sprintf('\\Daily\\Application\\Models\\%sModel', $model);
if(!class_exists($models)) {
echo sprintf('Class %s not found!', $model.'Model');
}
return new $models();
}
}
public function getView() {
return new View;
}
}
PHP-Code:
<?php
namespace Daily\System;
class Routing {
public function __construct() {
self::process();
}
public static function process() {
$get = (empty($_GET['site'])) ? '' : $_GET['site'];
$get = trim($get, '/');
$get = explode('/', $get);
if(empty($get[0])) {
if(file_exists('application/controllers/IndexController.php')) {
$Index = new \Daily\Application\Controllers\IndexController;
$Index->Main();
return FALSE;
}
}
if(isset($get[0])) {
if(file_exists('application/controllers/'.ucfirst($get[0]).'Controller.php')) {
$controller = sprintf("\\Daily\\Application\\Controllers\\%sController", ucfirst($get[0]));
if(!class_exists($controller)) {
echo sprintf("Class %s not Found", $get[0].'Controller');
}
$controller = new $controller;
if(!method_exists($controller, 'Main')) {
echo 'Methode "Main" wurde nicht gefunden!';
}
$controller->Main();
} else {
echo 'File not found!';
}
}
if(isset($get[1])) {
if(!method_exists($controller, $get[1])) {
echo sprintf('<br />Method %s not found!', $get[1]);
}
$controller->{$get[1]}($get[1]);
}
if(isset($get[2])) {
if(!method_exists($controller, $get[2])) {
echo sprintf('<br />Method %s not found!', $get[2]);
}
$controller->{$get[2]}($get[2]);
}
if(isset($get[3])) {
if(!method_exists($controller, $get[3])) {
echo sprintf('<br />Method %s not found!', $get[3]);
}
$controller->{$get[3]}($get[3]);
}
if(isset($get[4])) {
if(!method_exists($controller, $get[4])) {
echo sprintf('<br />Method %s not found!', $get[4]);
}
$controller->{$get[4]}($get[4]);
}
}
}
PHP-Code:
<?php
namespace Daily\Application\Controllers;
use \Daily\System\Controller as Controller;
class IndexController extends Controller {
public function Main() {
$this->getView()->display('Index/Index');
}
public function Login() {
require_once 'application/openID.php';
$openID = new \LightOpenID("localhost");
$api = "5044B0379C31408758006FFEF44F0CAD";
if(!$openID->mode) {
$openID->identify = "http:://steamcommunity.com/openid";
$this->getView()->redirect($openID->authURL());
} elseif($openID->mode == "cancel") {
echo "User has canceled Authentification";
} else {
if(!isset($_SESSION['T2SteamAuth'])) {
$_SESSION['T2SteamAuth'] = $openID->validate() ? $openID->identify : null;
$_SESSION['T2SteamID64'] = str_replace("http://steamcommunity.com/openid/id", $_SESSION['T2SteamAuth']);
if($_SESSION['T2SteamAuth'] != null) {
$Steam64 = str_replace("http://steamcommunity.com/openid/id", $_SESSION['T2SteamAuth']);
$profile = file_get_contents("http://api.steampowered.com/ISteamUser/GetPlayersSummeries/v0002/?key={$api}%steamids={$Steam64}");
$buffer = fopen("cache/{$steam64}.json", "w+");
fwrite($buffer, $profile);
fclose($buffer);
}
header("Location: /index");
}
}
}
}
string(26) "Location: http://google.de"
MfG.
Kommentar