SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Undefined index

  1. #1
    SitePoint Addict caddyfixr's Avatar
    Join Date
    Aug 2004
    Location
    Albuquerque, NM
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Undefined index

    This works on two of my domains. On the third domain it produces the error
    Notice: Undefined index: uid in /home/socalsf/public_html/database/access/admincontrol.php on line 9

    Notice: Undefined index: pwd in /home/socalsf/public_html/database/access/admincontrol.php on line 10

    PHP Code:
    <?php session_start();
    header("Cache-control: private"); // IE 6 Fix?>
    <?php 
    // admincontrol.php
    include_once 'common.php';
    include_once 
    'db.php';



    $uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
    $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd'];

    if(!isset(
    $uid)) {
    ?>
    Any thought?
    Cad

  2. #2
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The php configuration for the third domain probably has a different error_reporting level.

  3. #3
    SitePoint Addict caddyfixr's Avatar
    Join Date
    Aug 2004
    Location
    Albuquerque, NM
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Wardrop View Post
    The php configuration for the third domain probably has a different error_reporting level.
    Not sure if that is it because whatever is causing the error is stopping the code dead in it tracks

  4. #4
    SitePoint Guru
    Join Date
    Oct 2006
    Location
    Queensland, Australia
    Posts
    852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it's only a notice that is being generated (not an error). Notices and warnings can not stop execution of a script.

  5. #5
    SitePoint Addict caddyfixr's Avatar
    Join Date
    Aug 2004
    Location
    Albuquerque, NM
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since I can not get to the ini I add this file to the folder that is having the problem and still the problem is there

    Code:
    register_globals = On
    
    register_argc_argv = On
    
    safe_mode = On
    
    magic_quotes_gpc = Off

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:
    <?php
    $pwd = (isset($_POST['pwd']) ? $_POST['pwd'] : (isset($_SESSION['pwd']) ? $_SESSION['pwd'] : 'nopwd'));
    ?>

    this will check if the session is set also, if not the pwd should hold the string "nopwd".

  7. #7
    SitePoint Addict caddyfixr's Avatar
    Join Date
    Aug 2004
    Location
    Albuquerque, NM
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by oxodesign View Post
    try this:
    <?php
    $pwd = (isset($_POST['pwd']) ? $_POST['pwd'] : (isset($_SESSION['pwd']) ? $_SESSION['pwd'] : 'nopwd'));
    ?>

    this will check if the session is set also, if not the pwd should hold the string "nopwd".
    That worked and I also changed if(!isset($uid)) { to if(empty($uid)) { You can see updated code below. Still need to fix Notice: Undefined index: uid. I post it here when I fix it.


    PHP Code:
    <?php error_reporting(E_ALL);
    session_start();
    header("Cache-control: private"); // IE 6 Fix?>
    <?php 
    // admincontrol.php
    include_once 'common.php';
    include_once 
    'db.php';

    $uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
    $pwd = (isset($_POST['pwd']) ? $_POST['pwd'] : (isset($_SESSION['pwd']) ? $_SESSION['pwd'] : 'nopwd'));

    if(empty(
    $uid)) {
    ?>

  8. #8
    SitePoint Addict caddyfixr's Avatar
    Join Date
    Aug 2004
    Location
    Albuquerque, NM
    Posts
    249
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, no more notices
    PHP Code:
    <?php error_reporting(E_ALL);
    session_start();
    header("Cache-control: private"); // IE 6 Fix?>
    <?php 
    // admincontrol.php
    include_once 'common.php';
    include_once 
    'db.php';

    if (isset(
    $_POST['uid'])) { $uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];}

    $pwd = (isset($_POST['pwd']) ? $_POST['pwd'] : (isset($_SESSION['pwd']) ? $_SESSION['pwd'] : 'nopwd'));

    if(empty(
    $uid)) {
    ?>


Bookmarks

Posting Permissions

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