Jump to content

[SOLVED] I have some Notice: Undefined index: Errors???


Recommended Posts

I dont know what happened but my web pages were working and now I get these Undefined errors. Can someone please shed some light on this?  ???  LAst thing I remembered I was in the httpd.config. but I changed it back to where it was and it still doesn't work.

 

Notice: Undefined index: logout in C:\www\vhosts\reagan\employee_resource.php5 on line 95

 

Notice: Undefined index: error in C:\www\vhosts\reagan\employee_resource.php5 on line 97

 

Notice: Undefined index: disabled in C:\www\vhosts\reagan\employee_resource.php5 on line 121

 

Notice: Undefined index: authenticate in C:\www\vhosts\reagan\employee_resource.php5 on line 122

OK here it is.......it seems it doesnt like my sessions anymore???

 

<?php
//initialize the session
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Employee Resources</title>
<style type="text/css">
<!--
body {
background-image: url(images/bg_tile.gif);
}
#Layer1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 991px;
top: 22px;
}
#Layer2 {
position:absolute;
width:308px;
height:51px;
z-index:1;
left: 119px;
top: 43px;
}
#Layer3 {
position:absolute;
width:126px;
height:83px;
z-index:1;
left: 1054px;
top: 40px;
}
.style5 {font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
.style11 {font-size: 18px}
.style13 {font-size: 14px}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
</head>

<body>
<div align="center">
  <table width="1110" height="636" border="1" cellpadding="0" cellspacing="0">
    <tr>
      <td height="106" colspan="2" background="images/topbg1.png"> </td>
    </tr>
    <tr>
      <td height="21" colspan="2" background="images/bar1.png"><div align="left"></a></div></td>
    </tr>
    <tr>
      <td width="218" height="509" align="left" valign="top" bgcolor="#ADADAD"><ul>
        <li><a href="http://www.reaganpower.com/">Reagan Equipment Co., Inc. </a></li>
        <li><a href="http://www.americanwarrior.com/">American Warrior  <br />
          </a></li>
      </ul>
        <p>  </p>
        <p> </p></td>
      <td width="886" valign="top" bgcolor="#FFFFFF"><p align="right"> </p>
        <blockquote>
          <p align="center" class="style11"><?php echo ($_SESSION['logout']); ?>  </p>
        </blockquote>
        <p align="center" class="style13"><?php echo ($_SESSION['error']);	?>   </p>
        <table width="315" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#000000">
          <tr>
            <td width="309" height="186" bgcolor="#FE711F"><div align="center">
                <form method="post" action="userlogin_e.php5">
                  <p align="left"><strong>Login to Account </strong></p>
                  <p> Username:
                    <input name="username" type="text" size="30" maxlength="30"/>
                  </p>
                  <p> Password:
                    <input name="password" type="password" size="30" maxlength="30"/>
                  </p>
                  <blockquote>
                    <blockquote>
                      <p align="right">
                        <input name="submit" type="submit" onclick="MM_validateForm('username','','R','password','','R');return document.MM_returnValue" value=" Login "/>
                      <a href="forgot_username.php"></a> <a href="forgot_password_e.php"></a></p>
                    </blockquote>
                  </blockquote>
                </form>
            </div></td>
          </tr>
        </table>
        <blockquote>
          <p align="center" class="style5"><?php echo ($_SESSION['disabled']);	
	  echo ($_SESSION['authenticate']); ?> </p>
        </blockquote>
        <p align="center"> </p>
        <p align="center"> </p>
      <p align="center">Copyright © 2007</p></td>
    </tr>
  </table>
</div>
</body>
</html>
<?php session_destroy();?> 

using mysql_numrows row your mysql fields lile

 

<?php
$row= mysql_numrows($result);// rows the mysql fields from your SQL statement

$_SESSION['firstname'] = $row["firstname"];///define variable
$_SESSION['lastname'] = $row["lastname"];///define variable

?>

OK. I just confirmed that this does work on my production server but not on my testing server.  The only change I can remember that may have caused this is in the one config files. Maybe I turned sessions off, if u can ??? I will check.  Now it doesnt even recognize my login page(code) either. I get a web page display error. I used to be able to at least logon even with these errors. 

 

I dont think its my code. I think its something else because it works in production.  About the sessions being blank. That is fine. They will be checked or set once the user tries to log on.

OK I know what the problem was. I had to turn display_errors = off.    Even though I get these errors,  my web pages work like they should. 

Is this a critical error  I need to worry about or I can ignore it since everything works like ti should??  I use these sessions to display messages like:

 

-incorrect password-

-you have been logged out-

-account disabled-

 

UNless there is a better way of doing this?? This is the only way I know how to do it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.