We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27659
    • 5 Posts
    Помогите разобраться с warning. Просто в файле код отрабатывает и при правильном пароле и при неправильном. Warning отключается @ или в php.ini "error_reporting = E_ERROR"

    <?php
    function ad_auth( $server, $username, $password ){
            $ldap = @ldap_connect( $server );
            if ( @ldap_bind( $ldap, $username, $password ) ){
                    ldap_unbind( $ldap );
     return 1;
                    }
            else{
     return 0;
                    }
            }
    ad_auth("192.168.1.4",'user','passs');
    ?>

    если вставить код в сниппет, то пишет :
     
    PHP error debug
      Error: 	ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/http/virt5/manager/includes/document.parser.class.inc.php(769) : eval()'d code	 
      Line: 	5
    

    как отключить этот warning в спиппете ?
      • 27659
      • 5 Posts
      Отключил так
      error_reporting(E_ERROR);
      ini_set("display_errors", 1)