Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Help with "Notice: Undefined index: title in" Error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Help with "Notice: Undefined index: title in" Error

Postby mcclints » Wed Mar 26, 2014 6:46 am

Newbie here, why does:

<?php
if(file_exists('content_'.$_GET['title'].'.php')) include 'content_'.$_GET['title'].'.php';
else include 'content_home.php';
?>

Result in:
Notice: Undefined index: title in

Any help is much appreciated :)
mcclints
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Mar 26, 2014 6:40 am

Re: Help with "Notice: Undefined index: title in" Error

Postby seandisanti » Sat Mar 29, 2014 12:59 am

You're assuming there's a 'title' element present in the $_GET array. Also you don't want to do what you're trying to do if that page is going to be visible to anyone but yourself. all someone would have to do is pass a filename through the address bar and they could force your script to process or display files you really don't want them to be able to see.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Baidu [Spider], Exabot [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron