Hi All,
I am trying to improve my coding and I am reading about saving out the erorrs to a log file, from the 'Essential PHP Security' book. They give this example:
ini_set('error_reporting', E_ALL | E_STRICT);
ini_set('display_errors', 'Off');
ini_set('log_errors', 'On');
ini_set('error_log', 'usr/local/apache/logs/error_log');
But I am running on a Windows Server 2003 machine and I tried to change out the path to 'cHP/logs/error_log' and I get a permision error, and when I check that directory, Read Only is marked and even logged in as Admin, it reverts back to Read Only after I change it.
Also, when I do a
error_reporting(E_ALL & ~E_STRICT);
On a page that I use to display a list of countries I get from the db and use this function to make the drop-down:
//--------------- start makeDropListSession -----------------//
function makeDropListSESSION($name,$list,$selected="")
{
// $name select name
// $list array of value, label pair
// $selected selected value
// $x tabindex value
global $x;
global $label;
foreach($list as $value=>$label)
{
if(($_SESSION[$label] != '') || ($selected == $value))
{
$options .= '<option selected value="'.$value.'">'.$label.'</option>';
}
else
{
$options .= '<option value="'.$value.'">'.$label.'</option>';
}
}
$dropList = '<select name="'.$name.'" id="' . $name . '" tabindex="'.$x.'">'.$options.'
</select>'."\n";
return $dropList;
}
//--------------- end makeDropListSession -----------------//
I get a list of undefined index and variable errors for:
//Undefined index: Choose your Country - for this line of code
if(($_SESSION[$label] != '') || ($selected == $value)) //
//and
//Undefined variable: options - for this line of code
$options .= '<option selected value="'.$value.'">'.$label.'</option>';
I know that is has been suggested to test for the variable first:
if(isset($_SESSION['Country']))
but how would I incorporate that into that function is what I do not understand.
I appreciate the help, as always,
Don