HTTP Authentication header.HTTP defines two official authentication protocols: Basic authentication and Digest authentication.4 Steps to Certification:
Steps
Header
Description
Method/Status
Request
The first request has no authentication information
GET
Question
Www-authenticate
The server rejected the request with 401 status, stating that the user is requ
following example, we use both the $php_auth_user and $PHP_AUTH_PW variables to verify that the entry is legitimate and allowed to enter. In this case, the user name and password pair that are allowed to log on are TNC and nature:
;?
if (!isset ($PHP _auth_user))
{
Header ("Www-authenticate:basic realm=" "My Realm");
Header ("http/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel buttonn";
exit;
}
Else
{
if (!) ( $PHP
return an entity that interprets the current error condition, and whether this is a temporary or permanent condition. These status codes apply to any request method. The browser should display to the user any entity content contained in such an error response. If the client is transmitting data when an error occurs, the server implementation using TCP should carefully ensure that the client has received a packet containing the error message before shutting down the connection between the client
be returned in the location domain of the response. Unless this is a head request, the response entity should contain a hyperlink to the new URI and a short description. Because some browsers do not recognize the 307 response, you need to add the necessary information above so that users can understand and make access requests to the new URI. If this is not a GET or HEAD request, then the browser disables automatic redirection unless the user confirms it, because the requested condition may v
. The browser should display to the user any entity content contained in such an error response.If the client is transmitting data when an error occurs, the server implementation using TCP should carefully ensure that the client has received a packet containing the error message before shutting down the connection between the client and the server. If the client continues to send data to the server after receiving the error message, the server's TCP stack sends a reset packet to the client to cl
, if you need authentication, and return a 401 (permission prohibited) response, it is open Write permission, but anonymous users do not allow. If a directory has both "write" and "script and executable programs" open, then Web users can upload a program and execute it, scary oh%^#$!~
Pure Script Execution Permissions
There are too many of these directories. Many directories that do not need to execute permissions are also given script execution per
normal; The request is complete.201 Normal; Immediately following the POST command.202 normal; Accepted for processing, but processing has not yet completed.203 normal; Partial information-the information returned is only part of the message.204 normal; No response-received request, but no information to echo.
3XX redirect
301 Moved-The requested data has a new location and the change is permanent.302 found-The requested data has a different URI temporarily.303 See other-you can find a respon
return code:401 Authorization Required403 Forbidden404 Not Found405 Method Not allowed408 Request Timed out411 Content Length Required412 Precondition Failed413 Request Entity Too Long414 Request URI Too Long415 Unsupported Media TypeCommon Server error return code:Internal Server Error
Users can use. htaccess to specify their own prepared Error alert page. In general, people can set up a directory specifically, such as errors to place these pages. A
iPhone screen size and resolution of some small posture 20160303
IPhone devices now have multiple resolutions , as listed in the following table,
Equipment
Screen Size
Resolution (PT)
Reader
Resolution (PX)
after rendering
PPI (DPI)
IPhone 3GS
3.5 inch
480 x
@1x
480 x
Empty
163
IPhone 4/4s
3.5 inch
480 x
@2x
640 x 960
Empty
326
IPhone 5/5s/5c
4.0 inch
568 x
1. Basic Knowledge Point 1.1The meaning of several status codes in http: 503500401403404200301302... 200: the request is successful, and the requested data is returned accordingly. 301: Permanent redirection. 302: Temporary row redirection. 401: the current request requires user verification. 403: the server does not have the permission to execute the request. 404: please
I. Basic knowledge point 1.1 The meaning of several status codes in HTTP: 503 50
Borrowing materials: "The principle and implementation of HTTP using Basic Authentication"Look at the HTTP protocol original book, the third part of the 11th chapter identification, authentication and security, when the cookie is disabled can use 401 status code and response to the head www-authenticate. Cookies are disabled, one is the service is not available, remind the user to turn on the cookie function, such as NetEase 163 mailbox is so dry; the
that this protocol requires a lot of CPU and memory resources, so the communication is slow and the network load is large.
Confirm access user Identity Authentication
The HTTP Communication Process uses various authentication methods to determine its identity. The verification information usually involves the following:
Password: only the string information that the current user will know.
Dynamic token: Only one-time password displayed on the device.
Digital authentication: only personal i
pipeline, forms will determine if the response is 401, then the address of the location to the Loginurl setting in the configuration and change the status to 302.2. Several attributeWhy: What do you know about attribute? Because the results of the forms authentication are written into the identity attribute, we generally want to get the property, determine if the authentication is successful, if the failure returns
Upload 401 error codeLiangchao Posted: August 20, 2015 15:26 • Updated at: January 07, 2016 17:01First, Error: {"error": "Expired token"},{"error": "Token out of Date"} Processing method:1. Set the validity period of the token longer. For larger files, you can have an appropriate length of validity (default is 3,600 seconds)2, see if their server time is the network time. If the time is not allowed, the result of the signature may have expired.3, it i
How can a static page be defined as a restricted page? When I look at identity authentication, the book mentions the concept of HTTP authentication, that is, if a user wants to read a protected resource, the server will return a 401, in this way, the browser will pop up a login window based on 401. This process is well simulated in PHP, such as: nbsp; 3. how can a static page be defined as a restricted pag
identity based on the user account information stored in the data file or database.
Note that only when running the Apache module can the PHP script use the $ PHP_AUTH_USER, $ PHP_AUTH_PW, and $ PHP_AUTH_TYPE variables. If you are using cgi php, you cannot implement HTTP-based authentication.
6.2 Next, we will introduce in detail how to use PHP to authenticate user identities.
In the following example, the variables $ PHP_AUTH_USER and $ PHP_AUTH_PW are used to verify whether the entrant is val
server location, pop up the following input box:
If you click Cancel, the output:
Text to send if user hits Cancel Button
If you enter a user name and password, click Sign in:
Hello hello.
You are entered world as your password.
Example #2 Digest HTTP Authentication Example
This example shows how to implement a simple Digest HTTP authentication script.
Note: compatibility issues
Take extra care when writing HTTP header code. In order to guarantee compatibility for all clients, the first lette
normal; The request is complete.201 Normal; Immediately after the POST command.202 normal; Accepted for processing, but processing is not yet complete.203 normal; Part of the information-the returned information is only part of it.204 normal; No response-the request has been received, but there is no information to echo back.
3XX redirection
301 Moved-The requested data has a new location and the change is permanent.302 found-The requested data temporarily has a different URI.303 See other-the
.
401
The current request requires user authentication. The response must contain a Www-authenticate information header for the requested resource to ask for user information. The client can repeatedly submit a request that contains the appropriate Authorization header information. If the current request already contains the Authorization certificate, the 401 response indicates that the c
is cacheable only if specified in Cache-control or expires. The new temporary URI should be returned in the location domain of the response. Unless this is a head request, the response entity should contain a hyperlink to the new URI and a short description. Because some browsers do not recognize the 307 response, you need to add the necessary information above so that users can understand and make access requests to the new URI. If this is not a GET or HEAD request, then the browser disables
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.