我收到此通知,说:
Use of undefined constant console - assumed 'console'
Run Code Online (Sandbox Code Playgroud)
当我尝试在控制台中打印出变量的值时。
if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])){
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="asr-web-dev1"');
exit('<h3>Sorry!</h3><p>You must enter your username and password to log in and access this site.');
}
$db = new ezSQL_mysql(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
$username = trim($_SERVER['PHP_AUTH_USER']);
$password = trim($_SERVER['PHP_AUTH_PW']);
$count = $db->get_var("select count(*) as count from users WHERE user_name='" . $username . "' AND password='" . $password . "'");
if($count == 1){
$data = $db->query("SELECT * FROM users WHERE user_name='" . $username . "' AND password='" . $password . "'");
console.log($data);
$user_id = $data['user_id'];
$name = $data['name'];
} else {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="asr-web-dev1"');
exit('<h3>Sorry!</h3><p>You must enter your username and password to log in and access this site.');
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3616 次 |
| 最近记录: |