Jump to content

undefined index


yoshida
 Share

Recommended Posts

I just upgraded my old lamp to easyphp (the lazy solution) and found out that $_GET['pageid'] triggers a warning:

Notice: Undefined index: pageid in c:\program files\easyphp1-8\www\apb\php\index.php on line 73
How do I get rid of this? Or am I just stupid? :) I know the pageid should be defined before reading it, but I don't know how to do that and still make it trigger scripts (if $pageid=blabla {run this script;})
Link to comment
Share on other sites

WinXP. Thought php was cross platform?Anyway, I use a texteditor to write php (have created a 450 line index.php with multiple scripts, which are triggered by page id).EDIT: would it help if I use the switch function?

Link to comment
Share on other sites

I was just thinking that could EasyPHP be changed with first- installing IIS from Settings \ Add and remove programs \ Add and remove Windows Components \ IIS- installing PHP binary and configuring it with IIS (included in installer)- installing MySQL from www.mysql.com but I don't know about configuring it, quess download just the binaryif it wouldn't be a problemThese links might come in handy: http://en.php.net/get/php-5.1.4-installer.exe/from/a/mirrorhttp://dev.mysql.com/get/Downloads/MySQL-4...2.zip/from/pickI needed the OS because if you were running for example Win98 like me, this trick would need PWS.It is important that you install the server first and select the same server from the list when PHP servers come.This trick worked on my Win98 when I downloaded PWS and PHP binary.

Link to comment
Share on other sites

My pc is just a test site, the final result will be uploaded to our domain. So I have no control over which php will be used. Besides, I'm trying to solve the problem not avoid it.What's HTTP_GET_VARS[var]? Sounds like something I want to learn.

Link to comment
Share on other sites

I use Crimson Editor, it uses code highlighting as showed in my crap-ified avvi. The parser itself is some kind of validator, but I don't know if version 4 is different from 5 in that way.

Link to comment
Share on other sites

Version 5 has some more functions:

DATE:date_default_timezone_get()date_default_timezone_set()date_sunrise()date_sunset()idate()FILE / DIR:scandir()file_put_contents()fputcsv()FTP:ftp_alloc()ftp_chmod()ftp_raw()ARRAY:array_combine()array_diff_key()array_diff_ukey()array_intersect_key()array_intersect_uassoc()	array_intersect_ukey()array_product()array_udiff_assoc()array_udiff_uassoc()array_uintersect()array_uintersect_assoc()	array_uintersect_uassoc()array_walk_recursive()HTTP:headers_list()setrawcookie()STRING:convert_uudecode()convert_uuencode()fprintf()htmlspecialchars_decode()str_ireplace()stripos()strpbrk()strripos()substr_compare()vfprintf()MISC:time_sleep_until()

I caught these old release articles with my RSS reader from PHP.net

The PHP development team is proud to announce the release of PHP 5.1.3. This release combines small number of feature enhancements with a significant amount of bug fixes and resolves a number of security issues. Some of the key changes of PHP 5.1.3 include: Disallow certain characters in session names. Fixed a buffer overflow inside the wordwrap() function. Prevent jumps to parent directory via the 2nd parameter of the tempnam() function. Enforce safe_mode for the source parameter of the copy() function. Fixed cross-site scripting inside the phpinfo() function. Fixed offset/length parameter validation inside the substr_compare() function. Fixed a heap corruption inside the session extension. Fixed a bug that would allow variable to survive unset(). Fixed a number of crashes in the DOM, SOAP and PDO extensions. Upgraded bundled PCRE library to version 6.6 The use of the var keyword to declare properties no longer raises a deprecation E_STRICT. FastCGI interface was completely reimplemented. Multitude of improvements to the SPL, SimpleXML, GD, CURL and Reflection extensions. Over 120 various bug fixes. Further details about this release can be found in the release announcement and the full list of changes is available in the PHP 5 ChangeLog.
A critical bug with $_POST array handling as well as the FastCGI sapi have been discovered in PHP 5.1.3. A new PHP release 5.1.4 is now available to address these issues. All PHP users are encouraged to upgrade to this release as soon as possible. Further details about this release can be found in the release announcement and the full list of changes is available in the PHP 5 ChangeLog. The tarballs were updated to include the PEAR's phar file, previously missing from the release.
Link to comment
Share on other sites

The newest Easyphp sure knows how to do that... instead of the oldfashioned 'let's just ignore that $pageid isn't defined yet' it now thinks 'let's inform the writer of this script that he is stupid'. There's nothing wrong with a parser not ignoring 'fishy scripts'. But then there should be a way to fix that, so that a milion people who adopted a certain method of working don't have to re-design their scripts.

Link to comment
Share on other sites

You should be able to set the level of error and warning reporting. You can set PHP to stop on all warnings or errors, or to log them and go on, or to ignore them up to a certain level.Most servers online ignore all warnings, and even ignore some errors, but sometimes it's better to have your development server report everything.

Link to comment
Share on other sites

You should be able to set the level of error and warning reporting.  You can set PHP to stop on all warnings or errors, or to log them and go on, or to ignore them up to a certain level.Most servers online ignore all warnings, and even ignore some errors, but sometimes it's better to have your development server report everything.

True. I guess I should convert the $_GET['pageid'] method to classes then?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...