Jump to content

PHP Config


jayerpelo

Recommended Posts

Well that screenshot has nothing to do with MySQL.

 

The errors in the screenshot is from PHP.

 

The undefined index errors are caused because the script is trying to access an associative array with an index that doesn't exist. This is due to the scripts poor coding.

 

There is probably code like

if($some_var['some_index']) {
    // do something
}

Which should be

if(isset($some_var['some_index'])) {
    // do something
}
Link to comment
https://forums.phpfreaks.com/topic/282884-php-config/#findComment-1453522
Share on other sites

this is the code example for Notice: Undefined index: submit in C:\wamp\www\payroll\index.php on line 39, can you help me sir via teamviewer?

if($_POST['submit']=='Login')
{
    // Checking whether the Login form has been submitted
    
    $err = array();
    // Will hold our errors
    
    
    if(!$_POST['username'] || !$_POST['password'])
        $err[] = 'All the fields must be filled in!';
    
    if(!count($err))
    {
        $_POST['username'] = mysql_real_escape_string($_POST['username']);
        $_POST['password'] = mysql_real_escape_string($_POST['password']);
        $_POST['rememberMe'] = (int)$_POST['rememberMe'];
        
        // Escaping all input data

        $row = mysql_fetch_assoc(mysql_query("SELECT * FROM user WHERE username='{$_POST['username']}' AND password='".md5($_POST['password']."NizarRahmat")."'"));

        if($row['username'])
        {
            // If everything is OK login
            
            $_SESSION['blocked'] = $row['blocked'];
            
            // Store some data in the session
            if($_SESSION['blocked'] == 0) {
                $_SESSION['userid']= $row['userid'];
                $_SESSION['username'] = $row['username'];
                $_SESSION['accessid'] = $row['accessid'];
                $_SESSION['rememberMe'] = $_POST['rememberMe'];
                setcookie('tzRemember',$_POST['rememberMe']);
            }
            else $err[]='User is blocked! please contact Administrator!!';
            
        }
        else $err[]='Wrong username and/or password!';
    }
    
    if($err)
    $_SESSION['msg']['login-err'] = implode('<br />',$err);
    // Save the error messages in the session

    header("Location: index.php");
    exit;
}

 

awt.jpg

Link to comment
https://forums.phpfreaks.com/topic/282884-php-config/#findComment-1453525
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.