The "undefined constant" notices are probably from array indexes using unquoted strings, which PHP interprets as meaning a constant whose value is the same as its name. E.g.: $array[index] should really be $array['index'] to be correct (and to avoid possible clashes with constants of the same name.
The "undefined variable" notices may be the result of using combined operators such as ".=" or "+=" for a variable which has not yet been defined. For example:
for($i=1; $i<10; $i++)
{
$result += $i;
}
// would be better written as:
$result = 0; // initialize variable first
for($i=1; $i<10; $i++)
{
$result += $i;
}
Note that these are "notices", and as such will not stop the code from running and may work as desired, but the parser is throwing the notices because they are not considered good programming technique and might be a symptom of incorrect code. It would seem the code was created in an environment where notices were suppressed, allowing this less-than-optimal code to make it out into the world without being properly written. Your options therefore are to either edit the code to remove these potential problems, or just assume they're OK as is and suppress the notifications by starting each script with:
error_reporting(E_ALL ^ E_NOTICE); // report all except notices