Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2009
    Posts
    156
    Thanks
    47
    Thanked 0 Times in 0 Posts

    A couple Undefined Index errors running php script on IIS...

    The lines that are producing the Undefined Index errors have the arrows pointing at them (<<==============) Any idea what's causing this??

    PHP Code:
    <?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 Code:
    <?php
    if ($_SESSION['lin']) {    <<==============
      
    // we are logged in.
      
    function writemenu($item) {
        
    $items = array(
    ...
    Last edited by Daniellez; 09-16-2009 at 11:05 PM.

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    You have to check for their existence with isset():
    PHP Code:
    elseif ( isset( $_GET['do'] ) && $_GET['do'] == 'logout' ) {

    // ...

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •