Trying To Set A Variable From Included File
Posted: Mon Mar 03, 2008 1:59 pm
Hi,
I'm trying (with no luck) to get a variable from an included file to set a variable in another file.
The code:
In the code above you'll see...
$key="$secret_key";
$secret_key is a variable found in the included "config_vars.php" file. The problem is that even though
I can echo "$secret_key" and see it on that page, I cannot set the variable $key with the $secret_key.
In other words, $key is empty.
Any help would be greatly appreciated.
Thanks.
Anthony
I'm trying (with no luck) to get a variable from an included file to set a variable in another file.
The code:
Code: Select all
include "config_vars.php";
function cbValid($rcpt, $time, $item, $cbpop){
$key="$secret_key";
$xxpop=sha1("$key|$rcpt|$time|$item");
$xxpop=strtoupper(substr($xxpop,0,8));
if ($cbpop==$xxpop){
return 1;
} else {
return 0;
}
}
$rcpt = trim(addslashes($_GET['cbreceipt']));
$time = trim(addslashes($_GET['time']));
$item = trim(addslashes($_GET['item']));
$cbpop = trim(addslashes($_GET['cbpop']));
$key="$secret_key";
$secret_key is a variable found in the included "config_vars.php" file. The problem is that even though
I can echo "$secret_key" and see it on that page, I cannot set the variable $key with the $secret_key.
In other words, $key is empty.
Any help would be greatly appreciated.
Thanks.
Anthony