Want some programming help? [close]

NanoDano's blog

Build Node.js from Source

Let's walk through the process of building Node.js from source. I'll be demonstrating this on Debian 10 Buster. The current version of Node.js in the Debian repository is v10.24. I'm going to download the newest version 15 and build it. When I'm done, I'll have the latest version node and npm executables installed on my system.

Process Form Inputs with PHP

An essential task for most web applications is the ability to take user input. We will look at several common tasks in PHP like:

  • How to access GET query parameters from the URL
  • How to use forms to submit GET and POST values
  • Understanding the security implications of accepting user data and how to protect yourself
  • Creating a form to submit GET or POST requests
  • Handling checkbox and multi-select fields
  • Handing file uploads

HTTP Basic Authentication with PHP

There many ways of performing authentication over the web. You can use a token and pass it as a special header. This is commonly done with API tokens. You can also use a cookie to store a session token. This is common for webservers that have a database session in the backend.

One simple method is to use HTTP Basic Access Authentication. This involves adding a header that contains your username and password. The proper format for the header is:

Authorization: Basic XXXXXX

Where XXXXXX is your credentials in the form of username:password with base64 encoding.

PHP automatically decodes and splits the username and password into special named constants:

  • PHP_AUTH_USER with the username as a plain-text string
  • PHP_AUTH_PW with the password as a plain-text string

We will look at how to restrict a page using HTTP basic authentication in PHP.

Advertisement