...

View Full Version : A couple Undefined Index errors running php script on IIS...



Daniellez
09-16-2009, 10:02 PM
The lines that are producing the Undefined Index errors have the arrows pointing at them (<<==============) Any idea what's causing this??


<?php
require('config.inc.php');
require('functions.inc.php');

define('inADMIN',true);
session_name('MailingList');

session_start();

if (isset($_POST['logsub_x'])) {
if ($_POST['uname'] == $cfg['uname'] && $_POST['pword'] == $cfg['pword']) {
$_SESSION['lin'] = true;
}
else {
$err = 'Invalid username or password';
}
}
elseif ($_GET['do'] == 'logout') { <<==============
$_SESSION = array();
session_destroy();
}
// write header
?>


<?php
if ($_SESSION['lin']) { <<==============
// we are logged in.
function writemenu($item) {
$items = array(
...

kbluhm
09-16-2009, 11:12 PM
You have to check for their existence with isset():


elseif ( isset( $_GET['do'] ) && $_GET['do'] == 'logout' ) {

// ...

if ( isset( $_SESSION['lin'] ) && $_SESSION['lin'] ) {



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum