ian2k01 Posted June 5, 2009 Share Posted June 5, 2009 I'm using crontab to run a page every hour. But the crontab-generated mail gives me this message about the ereg_replace(). "PHP Notice: Undefined offset: 6 in /var/www/html/report.php on line 56". Any ideas? 54 $dd = $cookie_file_path; 55 $expHd=explode("%09",urlencode($dd[4])); 56 $expHd[6]=urldecode(ereg_replace("%0A","\\0",$expHd[6])); 57 $val=$expHd[6]; 58 header("Set-Cookie: JSESSIONID=$val; path=/"); 59 echo $val; Quote Link to comment https://forums.phpfreaks.com/topic/161103-php-notice-undefined-offset/ Share on other sites More sharing options...
Maq Posted June 5, 2009 Share Posted June 5, 2009 Are you sure that '$dd[4]' explodes into 7 values? After the explode put: print_r($expHd); Quote Link to comment https://forums.phpfreaks.com/topic/161103-php-notice-undefined-offset/#findComment-850146 Share on other sites More sharing options...
ian2k01 Posted June 5, 2009 Author Share Posted June 5, 2009 Are you sure that '$dd[4]' explodes into 7 values? After the explode put: print_r($expHd); now it gaves me this, not really sure what it means Array ( [0] => %2F ) PHP Notice: Undefined offset: 6 in /var/www/html/eport.php on line 56 PHP Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/report.php:55) in /var/www/html/report.php on line 60 Quote Link to comment https://forums.phpfreaks.com/topic/161103-php-notice-undefined-offset/#findComment-850213 Share on other sites More sharing options...
Maq Posted June 5, 2009 Share Posted June 5, 2009 You're assigning '$val' to '$expHd[6]' and as you can see the index of 6 is undefined (doesn't exist). And I have no clue what your code is supposed to do so I can't really help you. Quote Link to comment https://forums.phpfreaks.com/topic/161103-php-notice-undefined-offset/#findComment-850222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.