include "bin/functions.php";
$func = new func; // class in functions.php
...
...
echo "-> ". $func->get_cookies ('sid');
functions.php: (root/bin/)
class func
{
...
function make_cookies ($name, $value, $time)
{
setcookie ($name, $value, $time, "/");
}
function get_cookies ($name)
{
return $_COOKIE [$name];
}
...
}
user.php: (root/src/)
class user
{
...
function login_save ($tpl)
{
global $func, $conf;
...
...
// cookies, here we come..
$func->make_cookies ("userid", $user->id, $conf ['cookie_time']);
$func->make_cookies ("password", $password, $conf ['cookie_time']);
$func->make_cookies ("sid", $info->input ['sid'], $conf ['cookie_time']);
...
...
}
...
}
* Above i pasted few lines from 3 file, index, functions and user .php
* in index file, the sid cookie should be shown, after we set it in user file with calling the make_cookies command.
* IT DOESN'T WORK!!!
* but, if i use the same command for setting cookie in index file, above calling it it works. so, can someone tell me, why i cannot set cookie in class?
* all linkage is seted up correctly and setcookie function is okay.
* i used setcookie command to check if my functions are wrong but it also doesn't work.
* anyone knows what's wrong, please tell me... i don't know anymore what is wrong with the scripts...
Question
gregor
index.php: (root/)
include "bin/functions.php"; $func = new func; // class in functions.php ... ... echo "-> ". $func->get_cookies ('sid');functions.php: (root/bin/)
class func { ... function make_cookies ($name, $value, $time) { setcookie ($name, $value, $time, "/"); } function get_cookies ($name) { return $_COOKIE [$name]; } ... }user.php: (root/src/)
class user { ... function login_save ($tpl) { global $func, $conf; ... ... // cookies, here we come.. $func->make_cookies ("userid", $user->id, $conf ['cookie_time']); $func->make_cookies ("password", $password, $conf ['cookie_time']); $func->make_cookies ("sid", $info->input ['sid'], $conf ['cookie_time']); ... ... } ... }* Above i pasted few lines from 3 file, index, functions and user .php
* in index file, the sid cookie should be shown, after we set it in user file with calling the make_cookies command.
* IT DOESN'T WORK!!!
* but, if i use the same command for setting cookie in index file, above calling it it works. so, can someone tell me, why i cannot set cookie in class?
* all linkage is seted up correctly and setcookie function is okay.
* i used setcookie command to check if my functions are wrong but it also doesn't work.
* anyone knows what's wrong, please tell me... i don't know anymore what is wrong with the scripts...
thanks all
Link to comment
Share on other sites
0 answers to this question
Recommended Posts