[Cookies] header et include... une variable ne passe pas...
Bonjour a tous...
Je suis en train de faire mon développement tardif sur serveur linux/apache/mod_php5... mais bon, visiblement, je dois commencer à fatiguer...
j'ai un fichier de config.php qui charge quelque variables utiles... situé dans /$urlpath/config.php
config.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<?php
// Monarch Config file Release 1.0 'Dirty'
// Database Related
$dbhost = 'localhost';
$dbuser = 'monarch';
$dbpass = 'monarch';
$dbname = 'monarch';
// Other Options, necessary
// Local archive repository
$archive = "/var/www/monarch/archive/";
// Temporary folder for processing files
$temp = "/var/www/monarch/temp/";
// Local application path
$localpath = "/var/www/monarch/";
// Url Path, for example, if Monarch is installed in a virtual host folder (http://www.intranet.local/monarch)
$urlpath = "/monarch/";
// Internet availability
$internet = 0; // or 1
// Smarty related, don't touch
$full_path = dirname(__FILE__)."/";
define ("SMARTY_DIR",$full_path."");
define ("TEMPLATES_PATH",$full_path . "templates");
define ("TEMPLATES_C_PATH",$full_path . "templates_c");
define ("CONFIGS_PATH",$full_path . "configs");
define ("CACHE_PATH",$full_path . "cache");
if ($_GET['lang'] != "") {
$LANGUAGE = $_GET['lang'].".conf";
}
if ($LANGUAGE == "")
$LANGUAGE = "fr.conf";
require_once SMARTY_DIR."Config_File.class.php";
require_once SMARTY_DIR."Smarty.class.php";
?> |
et une petite fonction de rien du tout qui me sert a poser un malheureux cookie... le code est situé dans /$urlpath/func/func.set_cookie.php
func.set_cookie.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
<?php
$usercookie = $_POST['id_user'];
include ('../config.php');
function set_cookie($usercookie) {
if (isset($usercookie)) {
setcookie("monarch_user", $usercookie, time()+3600);
$host = $_SERVER['HTTP_HOST'];
$page = "sommaire.php";
header("Location: http://$host/$urlpath$page");
} else {
echo "There is an authentification error";
echo "$usercookie "." bla";
}
}
$func_set_cookie_call = set_cookie($usercookie);
?> |
et bien... étrangement... la variable $urlpath est nulle... et mon header... qui est censé me renvoyer dans sommaire.php... me renvoi sur "http://monip/sommaire.php
elle est passé ou ma valeur $urlpath... ???
merci et bonne soirée ;)[/b]