cluce Posted September 10, 2007 Share Posted September 10, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/ Share on other sites More sharing options...
darkfreaks Posted September 10, 2007 Share Posted September 10, 2007 please paste the code for that page? Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345510 Share on other sites More sharing options...
cluce Posted September 10, 2007 Author Share Posted September 10, 2007 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();?> Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345513 Share on other sites More sharing options...
darkfreaks Posted September 10, 2007 Share Posted September 10, 2007 you have to define the session variable before echoing it or it will turn up blank Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345518 Share on other sites More sharing options...
darkfreaks Posted September 10, 2007 Share Posted September 10, 2007 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345525 Share on other sites More sharing options...
cluce Posted September 10, 2007 Author Share Posted September 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345531 Share on other sites More sharing options...
cluce Posted September 10, 2007 Author Share Posted September 10, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345535 Share on other sites More sharing options...
darkfreaks Posted September 10, 2007 Share Posted September 10, 2007 if your problems fixed feel free to hit topic solved Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345541 Share on other sites More sharing options...
dhimok Posted September 10, 2007 Share Posted September 10, 2007 Use @$_SESSION @$_POST @$_GET Instead of $_SESSION $_POST $_GET or error_reporting(0); this will eliminate the problem on testing server Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345542 Share on other sites More sharing options...
darkfreaks Posted September 10, 2007 Share Posted September 10, 2007 @ is an error supressor if i remember correct? Quote Link to comment https://forums.phpfreaks.com/topic/68734-solved-i-have-some-notice-undefined-index-errors/#findComment-345547 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.