WinFuture-Forum.de: Php Cookieproblem - WinFuture-Forum.de

Zum Inhalt wechseln

Nachrichten zum Thema: Entwicklung
  • 3 Seiten +
  • 1
  • 2
  • 3

Php Cookieproblem


#1 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:07

hi, ich will machen wenn der cookie nicht vorhanden ist leitet er weiter setzt ein cookie und wandert zurück, alles schön und gut, aber leider bleibt die seite weiß..

Code:
<?php
/*
								  ____   _____
								 / __ \ / ____|
				  ___ _   _  ___| |  | | (___
				 / _ \ | | |/ _ \ |  | |\___ \
				|  __/ |_| |  __/ |__| |____) |
				 \___|\__, |\___|\____/|_____/
					   __/ |
					  |___/			  1.9

					 Web Operating System
						   eyeOS.org

			 eyeOS Engineering Team - [URL]www.eyeos.org/team[/URL]

	 eyeOS is released under the GNU Affero General Public License Version 3 (AGPL3)
			provided with this release in license.txt
			 or via web at gnu.org/licenses/agpl-3.0.txt

		Copyright 2005-2009 eyeOS Team ([email protected])
*/

/*
 * [START] PHP.INI
 * Copyright © 2009 Lars Knickrehm
 */
[B]error_reporting(E_ALL);
ini_set( 'display_errors', 'On' ); // Optional 
print_r($_COOKIE);

if (!$_COOKIE["webyouros"]) {
	if(stristr($_SERVER['HTTP_USER_AGENT'], 'Opera')) 
	header ("Location: [URL]http://www.webyouros.info/unsupported.php[/URL]");

} else {[/B]

	




// Support register_globals
if (ini_get('register_globals')) {
	foreach (array_keys($_REQUEST) as $key) {
		if ($_REQUEST[$key] === $$key) {
			unset($$key);
		}
	}
}

 [U]Support get_magic_quotes_gpc and magic_quotes_sybase
if ((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) || ini_get('magic_quotes_sybase')) {
	$_COOKIE = array_map_recursive('stripslashes', $_COOKIE, true);
	$_GET = array_map_recursive('stripslashes', $_GET, true);
	$_POST = array_map_recursive('stripslashes', $_POST, true);
	$_REQUEST = array_map_recursive('stripslashes', $_REQUEST, true);[/U]
}

// Support magic_quotes_runtime
if (ini_get('magic_quotes_runtime') && function_exists('set_magic_quotes_runtime')) {
	@set_magic_quotes_runtime(0);
}

/**
 * Applies the callback to the elements of the given arrays recursive
 *
 * @author Lars Knickrehm <[email protected]>
 * @category Kernel
 * @copyright Copyright © 2009 Lars Knickrehm
 * @license [URL]http://www.fsf.org/licensing/licenses/agpl-3.0.html[/URL] GNU Affero General Public License
 * @package Compatibility
 * @param callback $callback Callback function to run for each element in the array.
 * @param array $array An array to run through the callback function.
 * @param bool $mapkeys Defines if keys should be mapped, too. (default: false)
 * @return array Array containing all the elements of array after applying the callback function to each one
 * @since Version 0.5.0
 * @version 0.5.0
 */
function array_map_recursive($callback, $array, $mapkeys = false) {
	if ($callback !== null && is_callable($callback)) {
		foreach ($array as $key => $value) {
			if ($mapkeys) {
				unset($array[$key]);
				$key = call_user_func($callback, $key);
			}
			if (is_array($value)) {
				$array[$key] = array_map_recursive($callback, $value);
			} else {
				$array[$key] = call_user_func($callback, $value);
			}
		}
	}
	return $array;
}

/*
 * PHP.INI [END]
 */

/*
*This define is so useful to check if the client has accesed
*eyeOS from the right way (this file).
*/


/*
*Includes needed before do anything, in theory only settings.php
*should be here
*/
define('EYE_INDEX',1); 

require_once('settings.php');

/*
*Chaning the current work directory to EYE_ROOT
*/
changeCWD();

/*
*Loading utf8 support for php, this library must be
*Loaded manually because kernel also needs utf8
*/
loadStringLibrary();

//Including kernel file, this file also "execs" some initialitation stuff
include_once(EYE_ROOT.'/'.SYSTEM_DIR.'/'.KERNEL_DIR.'/kernel'.EYE_CODE_EXTENSION);

/*
*Setting the php debug (error_reporting) depending the eyeOS config
*stored in system/conf/system.xml
*/
setPhpInitDebug();

/*
*Changing some php init parameters, the chagnes are not always
*the same, may change depending of eyeOS configuration.
*/
setPhpInitValues();

//Calling to some libraries functiosn needed by index.php
libraryLoading();

//Calling some service functions needed by index.php
serviceLoading();

/*
*Checking what kind of client is accesing to choose
*the right kernel
*/
$index = indexRequested();
if($index !== false){
	loadIndex($index);
}elseif(clientMobile()){
	if (mobileWithWebkit()) {
		loadIndex('iphone');
	} else {
		loadIndex('mobile');
	}
}else{
	loadIndex('browser');
}


function loadIndex($index){
	//If some index has been loaded, return false because indexes can't be mixed
	if(defined('INDEX_TYPE')){
		define('INDEX_BASE','./../');
		return false;
	}
	define('INDEX_BASE','./');
	//Include the file with the __FILE__ secure
	$myPath = dirname(realpath(__FILE__)).'/';
	$rPath = realpath($myPath.'/'.$index.'/index.php');
 	if(is_readable($rPath)){
 		require_once($rPath);
		return true;
 	}
	return false;
}
function indexRequested(){
	if(isset($_REQUEST['index']) && !empty($_REQUEST['index'])){
		return utf8_basename($_REQUEST['index']);
	}
	return false;
}

/*
*Check if the client is a cell phone without special support (like iphone).
*/
function clientMobile(){
	if(CHECK_MOBILE == 1) {
		$mobileClients = array(
			"midp",
			"240x320",
			"blackberry",
			"netfront",
			"nokia",
			"panasonic",
			"portalmmm",
			"sharp",
			"sie-",
			"sonyericsson",
			"symbian",
			"windows ce",
			"benq",
			"mda",
			"mot-",
			"opera mini",
			"philips",
			"pocket pc",
			"sagem",
			"samsung",
			"sda",
			"sgh-",
			"vodafone",
			"xda",
			"iphone"
		);
		$userAgent = utf8_strtolower($_SERVER['HTTP_USER_AGENT']);
		foreach($mobileClients as $mobileClient) {
			if (strstr($userAgent, $mobileClient)) {
				return $mobileClient;
			}
		}
		return false;
	}
}

function mobileWithWebkit() {
	$userAgent = utf8_strtolower($_SERVER['HTTP_USER_AGENT']);
	if (strstr($userAgent, 'webkit') || strstr($userAgent, 'android')) {
		return true;
	} else {
		return false;
	}
}

/*
*Load the utf8 support loading eyeString and making a fake
*load because kernel needs it (utf8 support).
*/
function loadStringLibrary(){
	include_once(EYE_ROOT.'/'.SYSTEM_DIR.'/'.LIB_DIR.'/eyeString/main'.EYE_CODE_EXTENSION);
	call_user_func('lib_eyeString_start');
	//setting library loaded
	define('LIB_EYESTRING_LOADED',1);
}

/*
*Set the eyeOS debuggin, at the moment only changes
*the error_reporting, but may change more things in the future.
*/
function setPhpInitDebug(){
	ini_set('html_errors', false);
	if(EYEOS_DEBUG_MODE == 0) {
		error_reporting(0);
		ini_set('display_errors', false);
	} elseif(EYEOS_DEBUG_MODE == 2) {
		error_reporting(E_ALL);
		ini_set('display_errors', true);
	} elseif(EYEOS_DEBUG_MODE == 3) {
		if (!defined('E_DEPRECATED')) {
			define('E_DEPRECATED', 0);
		}
		error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE);
		ini_set('display_errors', true);
	} else {
		error_reporting(E_ERROR);
		ini_set('display_errors', true);
	}
}

/*
*Load the basics libraries needed by the kernel/core
*/
function libraryLoading(){
	//Loading the Error Codes
	reqLib('errorCodes','loadCodes');
	//load pear library class
	reqLib('eyePear','loadPear');
}

/*
*Load the basic services needed by the kernel/core
*/
function serviceLoading(){
	//Loading the Security Service (sec) if eyeOS Security is turned on (by default is On)
	if(EYEOS_SECURITY == 1) {
		service('sec','start');
	}
	//Setting the Running Log check var to 0
	global $LOG_RUNNING;
	$LOG_RUNNING = 0;
}

/*
*Set some php init values depending of eyeOS configs
*/
function setPhpInitValues(){
	//if allow_big_streams php will not have max_execution_time
	if(ALLOW_BIG_STREAMS == 1) {
		@set_time_limit(0);
	}
	//set the default charset
	ini_set('default_charset', DEFAULT_CHARSET);
}

/*
*Changes the current work directory to EYE_ROOT
*/
function changeCWD(){
	//since index.php is always below eyeROOT, we can do this instead to be inclusable from third party code
	$basedir = dirname(__FILE__).'/';
	//change directory to EYE_ROOT
	chdir($basedir.REAL_EYE_ROOT);
	//Loaded before kernel for kernel utf8 compatibility
}
}
?>

zeile 32-36 das ist mein code und zeile 52-57 ist die fehlerquelle anscheinend. (achja, das ist sowas wie ne cms , habe ich nicht selbstgeamcht, nur das mit dem cookie)

Dieser Beitrag wurde von maduuto bearbeitet: 22. Februar 2010 - 16:09

0

Anzeige



#2 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:15

probiers mal damit:
<?php
/*
								  ____   _____
								 / __ \ / ____|
				  ___ _   _  ___| |  | | (___
				 / _ \ | | |/ _ \ |  | |\___ \
				|  __/ |_| |  __/ |__| |____) |
				 \___|\__, |\___|\____/|_____/
					   __/ |
					  |___/			  1.9

					 Web Operating System
						   eyeOS.org

			 eyeOS Engineering Team - [URL]www.eyeos.org/team[/URL]

	 eyeOS is released under the GNU Affero General Public License Version 3 (AGPL3)
			provided with this release in license.txt
			 or via web at gnu.org/licenses/agpl-3.0.txt

		Copyright 2005-2009 eyeOS Team ([email protected])
*/

/*
* [START] PHP.INI
* Copyright © 2009 Lars Knickrehm
*/
[B]error_reporting(E_ALL);
ini_set( 'display_errors', 'On' ); // Optional 
print_r($_COOKIE);

if (!$_COOKIE["webyouros"]) {
	if(stristr($_SERVER['HTTP_USER_AGENT'], 'Opera')) 
	{
 	   header ("Location: [URL]http://www.webyouros.info/unsupported.php[/URL]");
 	   die();
	}
}

	




// Support register_globals
if (ini_get('register_globals')) {
	foreach (array_keys($_REQUEST) as $key) {
		if ($_REQUEST[$key] === $$key) {
			unset($$key);
		}
	}
}

[U]Support get_magic_quotes_gpc and magic_quotes_sybase
if ((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) || ini_get('magic_quotes_sybase')) {
	$_COOKIE = array_map_recursive('stripslashes', $_COOKIE, true);
	$_GET = array_map_recursive('stripslashes', $_GET, true);
	$_POST = array_map_recursive('stripslashes', $_POST, true);
	$_REQUEST = array_map_recursive('stripslashes', $_REQUEST, true);[/U]
}

// Support magic_quotes_runtime
if (ini_get('magic_quotes_runtime') && function_exists('set_magic_quotes_runtime')) {
	@set_magic_quotes_runtime(0);
}

/**
* Applies the callback to the elements of the given arrays recursive
*
* @author Lars Knickrehm <[email protected]>
* @category Kernel
* @copyright Copyright © 2009 Lars Knickrehm
* @license [URL]http://www.fsf.org/licensing/licenses/agpl-3.0.html[/URL] GNU Affero General Public License
* @package Compatibility
* @param callback $callback Callback function to run for each element in the array.
* @param array $array An array to run through the callback function.
* @param bool $mapkeys Defines if keys should be mapped, too. (default: false)
* @return array Array containing all the elements of array after applying the callback function to each one
* @since Version 0.5.0
* @version 0.5.0
*/
function array_map_recursive($callback, $array, $mapkeys = false) {
	if ($callback !== null && is_callable($callback)) {
		foreach ($array as $key => $value) {
			if ($mapkeys) {
				unset($array[$key]);
				$key = call_user_func($callback, $key);
			}
			if (is_array($value)) {
				$array[$key] = array_map_recursive($callback, $value);
			} else {
				$array[$key] = call_user_func($callback, $value);
			}
		}
	}
	return $array;
}

/*
* PHP.INI [END]
*/

/*
*This define is so useful to check if the client has accesed
*eyeOS from the right way (this file).
*/


/*
*Includes needed before do anything, in theory only settings.php
*should be here
*/
define('EYE_INDEX',1); 

require_once('settings.php');

/*
*Chaning the current work directory to EYE_ROOT
*/
changeCWD();

/*
*Loading utf8 support for php, this library must be
*Loaded manually because kernel also needs utf8
*/
loadStringLibrary();

//Including kernel file, this file also "execs" some initialitation stuff
include_once(EYE_ROOT.'/'.SYSTEM_DIR.'/'.KERNEL_DIR.'/kernel'.EYE_CODE_EXTENSION);

/*
*Setting the php debug (error_reporting) depending the eyeOS config
*stored in system/conf/system.xml
*/
setPhpInitDebug();

/*
*Changing some php init parameters, the chagnes are not always
*the same, may change depending of eyeOS configuration.
*/
setPhpInitValues();

//Calling to some libraries functiosn needed by index.php
libraryLoading();

//Calling some service functions needed by index.php
serviceLoading();

/*
*Checking what kind of client is accesing to choose
*the right kernel
*/
$index = indexRequested();
if($index !== false){
	loadIndex($index);
}elseif(clientMobile()){
	if (mobileWithWebkit()) {
		loadIndex('iphone');
	} else {
		loadIndex('mobile');
	}
}else{
	loadIndex('browser');
}


function loadIndex($index){
	//If some index has been loaded, return false because indexes can't be mixed
	if(defined('INDEX_TYPE')){
		define('INDEX_BASE','./../');
		return false;
	}
	define('INDEX_BASE','./');
	//Include the file with the __FILE__ secure
	$myPath = dirname(realpath(__FILE__)).'/';
	$rPath = realpath($myPath.'/'.$index.'/index.php');
	if(is_readable($rPath)){
		require_once($rPath);
		return true;
	}
	return false;
}
function indexRequested(){
	if(isset($_REQUEST['index']) && !empty($_REQUEST['index'])){
		return utf8_basename($_REQUEST['index']);
	}
	return false;
}

/*
*Check if the client is a cell phone without special support (like iphone).
*/
function clientMobile(){
	if(CHECK_MOBILE == 1) {
		$mobileClients = array(
			"midp",
			"240x320",
			"blackberry",
			"netfront",
			"nokia",
			"panasonic",
			"portalmmm",
			"sharp",
			"sie-",
			"sonyericsson",
			"symbian",
			"windows ce",
			"benq",
			"mda",
			"mot-",
			"opera mini",
			"philips",
			"pocket pc",
			"sagem",
			"samsung",
			"sda",
			"sgh-",
			"vodafone",
			"xda",
			"iphone"
		);
		$userAgent = utf8_strtolower($_SERVER['HTTP_USER_AGENT']);
		foreach($mobileClients as $mobileClient) {
			if (strstr($userAgent, $mobileClient)) {
				return $mobileClient;
			}
		}
		return false;
	}
}

function mobileWithWebkit() {
	$userAgent = utf8_strtolower($_SERVER['HTTP_USER_AGENT']);
	if (strstr($userAgent, 'webkit') || strstr($userAgent, 'android')) {
		return true;
	} else {
		return false;
	}
}

/*
*Load the utf8 support loading eyeString and making a fake
*load because kernel needs it (utf8 support).
*/
function loadStringLibrary(){
	include_once(EYE_ROOT.'/'.SYSTEM_DIR.'/'.LIB_DIR.'/eyeString/main'.EYE_CODE_EXTENSION);
	call_user_func('lib_eyeString_start');
	//setting library loaded
	define('LIB_EYESTRING_LOADED',1);
}

/*
*Set the eyeOS debuggin, at the moment only changes
*the error_reporting, but may change more things in the future.
*/
function setPhpInitDebug(){
	ini_set('html_errors', false);
	if(EYEOS_DEBUG_MODE == 0) {
		error_reporting(0);
		ini_set('display_errors', false);
	} elseif(EYEOS_DEBUG_MODE == 2) {
		error_reporting(E_ALL);
		ini_set('display_errors', true);
	} elseif(EYEOS_DEBUG_MODE == 3) {
		if (!defined('E_DEPRECATED')) {
			define('E_DEPRECATED', 0);
		}
		error_reporting(E_ALL ^ E_DEPRECATED ^ E_NOTICE);
		ini_set('display_errors', true);
	} else {
		error_reporting(E_ERROR);
		ini_set('display_errors', true);
	}
}

/*
*Load the basics libraries needed by the kernel/core
*/
function libraryLoading(){
	//Loading the Error Codes
	reqLib('errorCodes','loadCodes');
	//load pear library class
	reqLib('eyePear','loadPear');
}

/*
*Load the basic services needed by the kernel/core
*/
function serviceLoading(){
	//Loading the Security Service (sec) if eyeOS Security is turned on (by default is On)
	if(EYEOS_SECURITY == 1) {
		service('sec','start');
	}
	//Setting the Running Log check var to 0
	global $LOG_RUNNING;
	$LOG_RUNNING = 0;
}

/*
*Set some php init values depending of eyeOS configs
*/
function setPhpInitValues(){
	//if allow_big_streams php will not have max_execution_time
	if(ALLOW_BIG_STREAMS == 1) {
		@set_time_limit(0);
	}
	//set the default charset
	ini_set('default_charset', DEFAULT_CHARSET);
}

/*
*Changes the current work directory to EYE_ROOT
*/
function changeCWD(){
	//since index.php is always below eyeROOT, we can do this instead to be inclusable from third party code
	$basedir = dirname(__FILE__).'/';
	//change directory to EYE_ROOT
	chdir($basedir.REAL_EYE_ROOT);
	//Loaded before kernel for kernel utf8 compatibility
}
?>

0

#3 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:25

danke, jetzt zeigt er nurnoch nne weiße seite an und leitet auch nicht weiter, code:

http://purecodes.org...=1266852233_php

bitte oben auf paste new code weiterin eingeben, da ich es da besser erkennen kann
0

#4 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:29

gib mir mal bitte die original datei
0

#5 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:33

die habe ich jetzt leider nichtmehr dann müsste ich das neuinstallieren, aber bei der originaldatei fehlt nur error_reporting(E_ALL);
ini_set( 'display_errors', 'On' ); // Optional
print_r($_COOKIE);

if (!$_COOKIE["webyouros"]) {
if(stristr($_SERVER['HTTP_USER_AGENT'], 'Opera'))
header ("Location: http://www.webyouros...unsupported.php");

} else {
und am ende eine }

außerdem kommt im internetexplorer error500
0

#6 Mitglied ist offline   Ludacris 

  • Gruppe: Moderation
  • Beiträge: 4.666
  • Beigetreten: 28. Mai 06
  • Reputation: 218
  • Geschlecht:Männlich

geschrieben 22. Februar 2010 - 16:35

mal kurz abgesehen von deinem problem - du solltest windows phone bei den mobile browsers hinzufügen der aktuelle ie user agent hat windows phone 6.5 drinnen :imao:
0

#7 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:36

Ok, und wo liegt jetzt genau der Fehler? Leitet der auf deine unsupported.php um, und bleibt da weiß, oder leitet er garnicht um?

Dieser Beitrag wurde von USA bearbeitet: 22. Februar 2010 - 16:37

0

#8 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:42

nein, opera wird nicht komplett unterstützt, wenn opera auf die seite zugreift, leitet er zur unsupported weiter, dort ist ein link falls man doch opera benutzen möchte, dabei leitet er auf cookie.php weiter, dort wird ein cookie gesetzt und dann leitet er mit header location weiter zur index.. eigentlich soll er jetzt prüfen ob der cookie vorhanden ist, wenn ja darcvf die seite aufgerufen werden wenn nein leitet er ja zu unsupported weiter, nur bleibt die seite index.php leider weiß
0

#9 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:46

ok, ich hab mal einen code auf diese webseite gepostet, führ den ma so aus. wenn er dann umleiten soll, dann gibt er nur ne kleine meldung aus "jetzt müsste er umleiten" ...
um erstmal zu gucken, dass die if bedinungen stimmen
0

#10 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:50

ich brauche den link
0

#11 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:52

aso, sry. ich dachte, der updatet deinen..

http://purecodes.org...=1266853524_php

edit:
wenn die seite wieder weiß bleibt, weiß ich mit 99%iger wahrscheinlichkeit, an was es liegt.^^ aber probier es erstmal aus

Dieser Beitrag wurde von USA bearbeitet: 22. Februar 2010 - 16:54

0

#12 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 16:57

ne funzt net opera weiß, im ie internal error 500, ichinstalliere das nochmal und kopiere die index um
0

#13 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 16:59

brauchst du net. damit sollte es gehen:

http://purecodes.org...=1266854333_php
0

#14 Mitglied ist offline   maduuto 

  • Gruppe: aktive Mitglieder
  • Beiträge: 47
  • Beigetreten: 10. Januar 09
  • Reputation: 0

geschrieben 22. Februar 2010 - 17:04

funzt immer noch nicht, ich ersetz die index mal
0

#15 _USA_

  • Gruppe: Gäste

geschrieben 22. Februar 2010 - 17:06

Ehm. Mit der Version MUSS es gehen. Sicher, dass du die richtig uploadest?
Gib ma den Link zu der Datei, bitte.
0

Thema verteilen:


  • 3 Seiten +
  • 1
  • 2
  • 3

1 Besucher lesen dieses Thema
Mitglieder: 0, Gäste: 1, unsichtbare Mitglieder: 0