I am getting an error when loading the page without any GET parameters (eg.: /login.php), here is the error I get:
( ! ) Notice: Undefined index: err in C:\wamp\www\GestionImagesPublicitesAvis\login.php on line 57
Call Stack
# Time Memory Function Location
1 0.0005 144120 {main}( ) ..\login.php:0
And here is the code snippet from line 41 to line 58:
<input class=
<?php if(!empty($err))
{
if($err == "up")
{
echo "\"InputError\"";
}
else
{
echo "\" \"";
}
}
else
{
echo "\" \"";
} ?>
type="text" name="username" onclick="this.value='';" onblur="this.value=!this.value?'login...':this.value;" value=<?php if (($_GET['err'] == 'up')&& (isset($_GET['u']))){echo ("\"" . $_GET['u'] . "\"");}else{ echo "\"login...\"";} ?> id="username"/>
<input class=<?php if($err=="up"){echo "\"InputError\"";}else{echo "\"\"";}?> type="password" name="password" onclick="this.value='';" onblur="this.value=!this.value?'motdepasse':this.value;" value="motdepasse" id="password"/>
$err is defined earlier in the page (line 15):`
<?php
$err;
if (isset($_GET['err']))
{
switch ($_GET['err'])
{
case "up":
$err = "up";
echo "<p>Error #156</p>";
break;
}
}
else
{
$err=null;
echo "<p>Error #157</p>";
}
?>
On the top of the page (second code example) you only make sure
$erris set and not$_GET['err']. Later on in line 57 (first code example), however, you again just use$_GET['err'].Your error should be fixed, if you refer to
$errin the code, after initializing it.So your line 57 should similar to this: