当前位置:Gxlcms > PHP教程 > PHP首部认证

PHP首部认证

时间:2021-07-01 10:21:17 帮助过:26人阅读

PHP首部认证

// User name and password for authentication$username = 'rock';
  $password = 'roll';

  if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
    ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) {
    // The user name/password are incorrect so send the authentication headers
    header('HTTP/1.1 401 Unauthorized');
    header('WWW-Authenticate: Basic realm="Guitar Wars"');
    exit('

Guitar Wars

Sorry, you must enter a valid user name and password to access this page.'
); } ?>

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('
  • ').text(i)); }; $numbering.fadeIn(1700); }); });

    以上就介绍了PHP首部认证,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

  • 人气教程排行