Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-06-2009, 10:55 AM   PM User | #1
shubho
New Coder

 
Join Date: May 2009
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
shubho has a little shameless behaviour in the past
undefine index error 'ref'

<?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
shubho is offline   Reply With Quote
Old 05-06-2009, 11:04 AM   PM User | #2
Ahri
New Coder

 
Join Date: May 2007
Location: Manchester, UK
Posts: 72
Thanks: 0
Thanked 2 Times in 2 Posts
Ahri is on a distinguished road
You need to check that $_GET["ref"] exists, with isset();

PHP Code:
<?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);
}
?>
__________________
Every PHP programmer of any skill level should set error_reporting(E_ALL); at the top of their scripts or in their php.ini
Ahri is offline   Reply With Quote
Reply

Bookmarks

Tags
error, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:59 PM.


Advertisement
Log in to turn off these ads.