Webmasters toolbox compiled by PHP

Source: Internet
Author: User
Tags sha1 encryption uppercase character
Cutting-edge: Seeing that the webmaster tool of webmaster's house is very powerful, I also want to try to implement some of the functions, because I only have the first-level php Technology, so some php functions are used to implement some functions. Main functions include: Regular Expression testing tool, MD5 and SHA1 encryption tool, URL encoding and decoding tool, and conversion tool between ASCII and character.

Cutting-edge: Seeing that the webmaster tool of webmaster's house is very powerful, I also want to try to implement some of the functions, because I only have the first-level php Technology, so some php functions are used to implement some functions. Main functions include: Regular Expression testing tool, MD5 and SHA1 encryption tool, URL encoding and decoding tool, and conversion tool between ASCII and character.

Cutting-edge: Seeing that the webmaster tool of webmaster's house is very powerful, I also want to try to implement some of the functions, because I only have the first-level php Technology, so some php functions are used to implement some functions.

Main functions include: Regular Expression testing tool, MD5 and SHA1 encryption tool, URL encoding and decoding tool, and conversion tool between ASCII and character.

Demo address: http://zhanzhanggongju.duapp.com/

Regular Expression Testing Tool

Demo address: http://zhanzhanggongju.duapp.com/fun/zengze.php

Principle:

Obtain the regular expression rules and matched strings through the form, and then use the preg_match_all () function to perform regular expressions. Then, use the implode function to convert the obtained array to a string and then output it.

Code:

Regular Expression Testing Tool

Matching Rule: $ mode

"; Echo"

The string you entered is: $ str

"; If (preg_match_all ($ mode, $ str, $ arr) {echo"

The match is successful. The match result is: "; echo" ". implode (" ", $ arr [0])."

";} Else {echo"

Matching failed. Check the regular expression or matching string.

";}}?>


MD5 encryption tool

Demo address: http://zhanzhanggongju.duapp.com/fun/md5.php

Principle: Get the content to be encrypted through the form, and then encrypt it directly using the md5 () function when the 32-bit lowercase character is selected. When the 32-bit uppercase character is selected, the md5 () after encryption, all lowercase letters are converted to uppercase using the strtoupper () function. When the 16-bit value is selected, the substr ("str", 8, 16) function is used, after the encrypted content is intercepted, the interception rule is that, starting from 8th characters, 16 consecutive characters are intercepted.

Code:

The md5 algorithm is an irreversible encryption algorithm.

The content you want to encrypt is: ". $ str ."

"; If (@ $ _ POST [encode] =" 32 xiao ") {echo"

The 32-bit small encryption algorithm you selected

"; $ Result = md5 ($ str);} else if (@ $ _ POST [encode] =" 32da ") {echo"

The 32-bit encryption algorithm you selected

"; $ Result = strtoupper (md5 ($ str, false);} else if (@ $ _ POST [encode] =" 16 xiao ") {echo"

Select a 16-bit small encryption algorithm

"; $ Result = substr (md5 (" $ str "), 8, 16);} else if (@ $ _ POST [encode] =" 16da ") {echo"

Select a 16-bit encryption algorithm

"; $ Result = strtoupper (substr (md5 (" $ str "), 8, 16);} echo"

The encrypted result is: "." ". $ result ."

";}?>


SHA1 encryption tool:

Demo address: http://zhanzhanggongju.duapp.com/fun/sha1.php

Principle: Obtain the encrypted content through the form, and then use the SHA1 () function to encrypt the 40-bit sha1 in lowercase, use the strtoupper () function to convert the encrypted content to uppercase or lowercase.

Code:

SHA1 is an irreversible encryption algorithm.

The content you want to encrypt is: ". $ str ."

"; If (@ $ _ POST [encode] =" xiao ") {echo"

You have selected a 40-bit SHA1 Encryption Algorithm

"; $ Result = sha1 ($ str);} else if (@ $ _ POST [encode] =" da ") {echo"

You have selected a 40-bit SHA1 encryption algorithm.

"; $ Result = strtoupper (sha1 ($ str, false);} echo"

The encrypted result is: "." ". $ result ."

";}?>


URL transcoding and decoding tools:

Demo address: http://zhanzhanggongju.duapp.com/fun/urlen.php

Principle:

Get the content that needs to be transcoded (or decoded) through the form, and then perform operations through the urlencode () function (or urldecode () function.

Url transcoding code:

How to convert non-numeric letters to url Encoding

The content you want to encode is: ". $ str ."

"; Echo"

Url encoding Result: "." ". urlencode ($ str )."

";}?>


Conversion Tool between ASCII and character:

Demo address: http://zhanzhanggongju.duapp.com/fun/asciito.php

Principle:

Get the content to be converted through the form, convert the ASCII code to the character through the function chr (), and convert the character to the ASCII code through the function ord.

Because only 3 ~ The ASCII code between 126 can be printed on the display, so the tool can only display this part of the ASCII code.

Code for converting ASCII to character:

This tool only supports 33 ~ ASCII code query between 126 characters

The character you want to transcode is: ". $ str ."

"; Echo"

ASCII Code: "." ". chr ($ str )."

";}?>

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.