...

View Full Version : undefine index error 'ref'



shubho
05-06-2009, 11:55 AM
<?php
require_once ('database/database.inc.php');
$myDb = new Db;
include ('siteconfig.inc.php');
require_once ('controls.inc.php');
if(isset($_COOKIE["usReferrer"])){
}else
{
setcookie("usReferrer",limpiar($_GET["ref"]),time()+7776000);
}
?>

------------------------------------------------------

in the above the error message is following

undefined index 'ref'

please help me

Ahri
05-06-2009, 12:04 PM
You need to check that $_GET["ref"] exists, with isset();


<?php
require_once ('database/database.inc.php');
$myDb = new Db;
include ('siteconfig.inc.php');
require_once ('controls.inc.php');
if(isset($_COOKIE["usReferrer"])){
} elseif(isset($_GET["ref"]))
{
setcookie("usReferrer",limpiar($_GET["ref"]),time()+7776000);
}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum