The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form. $ _ SERVER [REQUEST_METHOD]: checks whether the request is GET or POST to verify whether the email address is
The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form. $ _ SERVER ['request _ method']: checks whether the REQUEST is GET or POST to verify whether the email address is
The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form.
$ _ SERVER ['request _ method']: checks whether the REQUEST is GET or POST.
Function used to verify whether the email address is valid:
function is_valid_email_address($email){ $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]'; $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]'; $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'. '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+'; $quoted_pair = '\\x5c[\\x00-\\x7f]'; $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d"; $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22"; $domain_ref = $atom; $sub_domain = "($domain_ref|$domain_literal)"; $word = "($atom|$quoted_string)"; $domain = "$sub_domain(\\x2e$sub_domain)*"; $local_part = "$word(\\x2e$word)*"; $addr_spec = "$local_part\\x40$domain"; return preg_match("!^$addr_spec$!", $email) ? 1 : 0; } if (is_valid_email_address('cal@example.com')) { print 'cal@example.com is a valid e-mail address'; } else { print 'cal@example.com is not a valid e-mail address'; }
Super variables in PHP
$ _ SERVER: SERVER and running environment information
$ _ GET: http get request variable
$ _ POST: POST variable, which is an array for multiple checkboxes
$ _ FILES: File Upload variable
$ _ REQUEST: An array containing GET, POST, and COOKIE
$ _ SESSION: Session variable
$ _ ENV: Environment Variable
$ _ COOKIE: cookie variable
The difference between htmlentities () and htmlspecialchars (): htmlspecialchars only converts (& '"<>) These 5 characters, while
Htmlentities converts all contents
PHP multi-choice processing code
The Bronx Brooklyn Manhattan Queens Staten Island