$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
if ($username == 'admin' && $password == 'secret') {
echo 'Authentication successful.';
} else {
header('WWW-Authenticate: Basic realm="Restricted Area"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authentication failed.';
exit;
}Basic Authentication
Continue Reading
Discover more amazing content handpicked just for you
Tutorial
bash
How to Create SSL for a Website on Ubuntu
Save the file and restart Nginx:
sudo systemctl restart nginxOct 21, 2024
Cheatsheet
VPN Services Cheat Sheet: Top Providers and Apps
A Virtual Private Network (VPN) enhances your online privacy by encrypting your internet connection and masking your IP address. This cheatsheet provides a quick overview of some of the top VPN providers, their key features, pricing, and platforms they support.
- Key Features:
- Over 3,000 servers in 94 countries.
- AES-256 encryption.
- No-log policy.
- Split tunneling.
- Supports streaming (Netflix, Hulu, etc.).
- 24/7 customer support.
- Pricing:
- $12.95/month (monthly plan).
- $9.99/month (6-month plan).
- $6.67/month (12-month plan, plus 3 months free).
- Supported Platforms:
- Windows, macOS, iOS, Android, Linux, routers, Smart TVs, gaming consoles.
Aug 21, 2024
Code
javascript
Validate Password Strength
No preview available for this content.
Jan 26, 2024
Code
javascript
Basic Authentication using 'express-basic-auth' middleware
No preview available for this content.
Jan 26, 2024
Code
javascript python +1
Generate Random Password
$length = 12;
$password = bin2hex(random_bytes($length));
echo 'Random Password: ' . $password;Jan 26, 2024
Code
python
Bybit Futures API Integration Using ccxt Library with Error Handling
No preview available for this content.
Jan 26, 2024
Discussion 0
Please sign in to join the discussion.
No comments yet. Start the discussion!