问题
我想制作一个$associate_name
全局$app_key
变量,这样我就可以在我想要的任何页面上访问它们。下面是我的头文件中的代码,get 变量将进入索引页面。它在索引页面上工作正常,因为 $_GET 数据可用,但是当用户移动到下一页但包含相同的头文件时,它会抛出一个错误,说Undefined index。请让我知道如何使此变量在所有页面上可用。谢谢!
代码
$associate_name = $_REQUEST['an'];
$app_key = $_REQUEST['key'];
define('associate_name',$associate_name);
define('app_key',$app_key);
//echo "Sorry but there seems to be a problem in your code. We can't find one of the following: App name or App key";
$select_associate = "SELECT * FROM associate_account WHERE associate_name='".associate_name."' and app_key='".app_key."'";
$assoc_result = mysql_query($select_associate) or die($select_associate.mysql_error());
if(mysql_num_rows($assoc_result)<=0){
echo "Oops there seems to be a problem in your iFrame code. Please login into your Associate panel and copy/paste the link again.";
}else{
$row_assoc = mysql_fetch_assoc($assoc_result);
$associate_name=ucwords($row_assoc['associate_name']);
$app_logo=$row_assoc['app_logo'];
$app_intro_content=$row_assoc['app_intro_content'];
$bg_color=$row_assoc['bg_color'];
}