β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ upload / home / ftpd / incoming yes real guest anonymous 0644 dirs:
1) Allow all users to upload files with permissions 0644 in the subdirectory / home / ftpd / incoming, and in this directory can create a new subdirectory.
2) Format: alias [directory alias] [directory name]
Function: set an alias for the specified directory, you can use a shorter directory alias when switching directories.
Example: alias inc: / incoming: set an alias inc: for the subdirectory incoming.
3) Format: email [guest's E-Mail address]
Function: As long as certain E-Mail addresses are set in this place, then when these users log in to the FTP server, his identity will be guest, and the general authority is lower than real, than anonymous high.
Example: email guest@xxx.net email guest@yyy.net: This is just an example, in fact, it can contain multiple E-Mail addresses that meet the specifications.
4) Format: deny [IP address / domain name] [description file]
Function: This setting can restrict users whose IP addresses or domain names cannot log in to the FTP server.
Example: deny * .com.tw /etc/ftpd/deny.msg: Set any domain name whose domain name ends with ".com.tw" to prohibit its access. The content of /etc/ftpd/deny.msg is displayed to the user.
5) Set / etc / ftpuser to prohibit certain users from logging in
Sometimes we need to prohibit some users from using FTP services. In fact, this setting is very simple, only need to write the user account to be banned to the file / etc / ftpuser. Due to the security of the system, we generally do not want users with too much authority and some users with the same command name to enter the FTP server. So in the default configuration, generally the following users have been added to the "blacklist".
root
uucp
news
bin
adm
nobody
lp
sync
shutdown
halt
mail
6) Set / etc / ftphosts to prohibit certain logins from specified machines. If you need to refuse logins from certain hosts, one way is to set them in / etc / ftpaccess The deny command, another simpler method is to write the IP address or domain name of the host you want to ban in / etc / ftphosts.
7) Make the new configuration take effect
So far, we have been able to make necessary modifications and adjustments to the FTP server configuration according to our needs. And after we reconfigure, we must make it effective. In general, the configuration of / etc / ftpaccess is directly applied to the next FTP service process after setting. For others, restart the inetd process.
> Use of some other commands related to wu-ftp
>Connection count command ftpcount
We can use the ftpcount command to clearly count the number of users currently connected to the FTP server, and also list the upper limit. The command output is as follows:
8) Service class local 0 Users (20maximum)
Service class remote 5 Users (100maximum)
> Online user view command ftpwho
We can use the ftpwho command to clearly list the details of the currently connected users.
5.4.2 FTP shutdown file generation command ftpshut
We can use the ftpshut command to generate a shutdown.msg file set in / etc / ftpaccess for shutdown settings. The format of the ftpshut command is:
9) Ftpshut <-l min> <-d min> time <Description>
-l This parameter sets how many minutes before closing the FTP server function to stop the user's connection;
-d This parameter is set to close FTP How many minutes before the server function to disconnect the user connection;
time specifies the time to close the FTP server. For example, 6:20 points are written as 0620;
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ upload / home / ftpd / incoming yes real guest anonymous 0644 dirs:
1) Allow all users to upload files with permissions 0644 in the subdirectory / home / ftpd / incoming, and in this directory can create a new subdirectory.
2) Format: alias [directory alias] [directory name]
Function: set an alias for the specified directory, you can use a shorter directory alias when switching directories.
Example: alias inc: / incoming: set an alias inc: for the subdirectory incoming.
3) Format: email [guest's E-Mail address]
Function: As long as certain E-Mail addresses are set in this place, then when these users log in to the FTP server, his identity will be guest, and the general authority is lower than real, than anonymous high.
Example: email guest@xxx.net email guest@yyy.net: This is just an example, in fact, it can contain multiple E-Mail addresses that meet the specifications.
4) Format: deny [IP address / domain name] [description file]
Function: This setting can restrict users whose IP addresses or domain names cannot log in to the FTP server.
Example: deny * .com.tw /etc/ftpd/deny.msg: Set any domain name whose domain name ends with ".com.tw" to prohibit its access. The content of /etc/ftpd/deny.msg is displayed to the user.
5) Set / etc / ftpuser to prohibit certain users from logging in
Sometimes we need to prohibit some users from using FTP services. In fact, this setting is very simple, only need to write the user account to be banned to the file / etc / ftpuser. Due to the security of the system, we generally do not want users with too much authority and some users with the same command name to enter the FTP server. So in the default configuration, generally the following users have been added to the "blacklist".
root
uucp
news
bin
adm
nobody
lp
sync
shutdown
halt
6) Set / etc / ftphosts to prohibit certain logins from specified machines. If you need to refuse logins from certain hosts, one way is to set them in / etc / ftpaccess The deny command, another simpler method is to write the IP address or domain name of the host you want to ban in / etc / ftphosts.
7) Make the new configuration take effect
So far, we have been able to make necessary modifications and adjustments to the FTP server configuration according to our needs. And after we reconfigure, we must make it effective. In general, the configuration of / etc / ftpaccess is directly applied to the next FTP service process after setting. For others, restart the inetd process.
> Use of some other commands related to wu-ftp
>Connection count command ftpcount
We can use the ftpcount command to clearly count the number of users currently connected to the FTP server, and also list the upper limit. The command output is as follows:
8) Service class local 0 Users (20maximum)
Service class remote 5 Users (100maximum)
> Online user view command ftpwho
We can use the ftpwho command to clearly list the details of the currently connected users.
5.4.2 FTP shutdown file generation command ftpshut
We can use the ftpshut command to generate a shutdown.msg file set in / etc / ftpaccess for shutdown settings. The format of the ftpshut command is:
9) Ftpshut <-l min> <-d min> time <Description>
-l This parameter sets how many minutes before closing the FTP server function to stop the user's connection;
-d This parameter is set to close FTP How many minutes before the server function to disconnect the user connection;
time specifies the time to close the FTP server. For example, 6:20 points are written as 0620;
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦Download files from ftp server via script any distro <? php by undercode :
/ **
* function name php_ftp_download
* function download file from ftp server
* entry parameter
* filename the name of the file to be downloaded, including the path
* /
function php_ftp_download ($ filename) {
$ phpftp_host = "ftplocalhost"; // server Address
$ phpftp_port = 21; // server port
$ phpftp_user = "name"; // username
$ phpftp_passwd = "passwrd"; // password
$ ftp_path = dirname ($ filename). "/"; // get path
$ select_file = basename ($ filename); // Get the file name
$ ftp = ftp_connect ($ phpftp_host, $ phpftp_port); // Connect to the ftp server
if ($ ftp) {
if (ftp_login ($ ftp, $ phpftp_user, $ phpftp_passwd)) { // Login
if (@ftp_chdir ($ ftp,$ ftp_path)) {// Enter the specified path
$ tmpfile = tempnam (getcwd (). "/", "temp"); // Create unique temporary file
if (ftp_get ($ ftp, $ tmpfile, $ select_file, FTP_BINARY)) {// Download the specified file to File
ftp_quit ($ ftp); // Close the connection
header ("Content-Type: application / octet-stream");
header ("Content-Disposition: attachment; filename =". $ Select_file);
readfile ($ tmpfile);
unlink ($ tmpfile); // delete temporary file
exit;
}
unlink ($ tmpfile);
}
}
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦Download files from ftp server via script any distro <? php by undercode :
/ **
* function name php_ftp_download
* function download file from ftp server
* entry parameter
* filename the name of the file to be downloaded, including the path
* /
function php_ftp_download ($ filename) {
$ phpftp_host = "ftplocalhost"; // server Address
$ phpftp_port = 21; // server port
$ phpftp_user = "name"; // username
$ phpftp_passwd = "passwrd"; // password
$ ftp_path = dirname ($ filename). "/"; // get path
$ select_file = basename ($ filename); // Get the file name
$ ftp = ftp_connect ($ phpftp_host, $ phpftp_port); // Connect to the ftp server
if ($ ftp) {
if (ftp_login ($ ftp, $ phpftp_user, $ phpftp_passwd)) { // Login
if (@ftp_chdir ($ ftp,$ ftp_path)) {// Enter the specified path
$ tmpfile = tempnam (getcwd (). "/", "temp"); // Create unique temporary file
if (ftp_get ($ ftp, $ tmpfile, $ select_file, FTP_BINARY)) {// Download the specified file to File
ftp_quit ($ ftp); // Close the connection
header ("Content-Type: application / octet-stream");
header ("Content-Disposition: attachment; filename =". $ Select_file);
readfile ($ tmpfile);
unlink ($ tmpfile); // delete temporary file
exit;
}
unlink ($ tmpfile);
}
}
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦Kernel technology-Error compiling kernel module tip :
t.me/undercodeTesting
> a simple LINUX KERNEL MODULE program and the following error occurred during compilation: / usr / include / linux /modversions.h:1:2: #error Modules should never use kernel-hea ders system headers, /usr/include/linux/modversions.h:2:2: #error but rather headers from an appropri ate kernel-source package
> . /usr/include/linux/modversions.h:3:2: #error Change -I / usr / src / linux / include (or similar) to /usr/include/linux/modversions.h:4:2: # error -I / lib / modules / $ (uname -r) / build / in clude /usr/include/linux/modversions.h:5:2: #error to build against the currently-runn ing kernel. 1. cp / boot / vmlinuz.version.h /usr/src/linux/include/linux/version.h 2. cp /boot/vmlinux.autoconf.h /usr/src/linux/include/linux/autoconf.h
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦Kernel technology-Error compiling kernel module tip :
t.me/undercodeTesting
> a simple LINUX KERNEL MODULE program and the following error occurred during compilation: / usr / include / linux /modversions.h:1:2: #error Modules should never use kernel-hea ders system headers, /usr/include/linux/modversions.h:2:2: #error but rather headers from an appropri ate kernel-source package
> . /usr/include/linux/modversions.h:3:2: #error Change -I / usr / src / linux / include (or similar) to /usr/include/linux/modversions.h:4:2: # error -I / lib / modules / $ (uname -r) / build / in clude /usr/include/linux/modversions.h:5:2: #error to build against the currently-runn ing kernel. 1. cp / boot / vmlinuz.version.h /usr/src/linux/include/linux/version.h 2. cp /boot/vmlinux.autoconf.h /usr/src/linux/include/linux/autoconf.h
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ a Summary of escape charactersIn writing bbs recently, I encountered a problem with transcoding. It took a long time to find a more complete solution, which can completely restore the original text php
fb.com/undercodeTesting
System: linux + php4 + oracle8i
<?
// --- title, name and other fields into the library processing (remove the leading and trailing spaces)
function trans_string_trim ($ str) {
$ str = trim ($ str);
$ str = eregi_replace ("'" , "" ", $ str);
$ str = stripslashes ($ str);
return $ str;
}
// --- article storage, namely textarea field;
function trans_string ($ str) {
$ str = eregi_replace (" '","' '",$ str);
$ str = stripslashes ($ str);
return $ str;
}
// --- displayed from the library in the form; in text to trans conversion, in textarea, no Conversion, display directly
//-display on WEB page, filter HTML code; including link address
function trans ($ string) {
$ string = htmlspecialchars ($ string);
$ string = ereg_replace (chr (10), "
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed on the WEB page without filtering HTML code;
function trans_web ($ string) {
$ string = ereg_replace (chr ( 10), "
", $ string);
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed on the WEB page, filter HTML code and head and tail spaces, mainly Used to display user nickname
function trans_trim ($ string) {
$ string = trim ($ string);
$ string = htmlspecialchars ($ string);
$ string = ereg_replace (chr (10), "
", $ string);
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed in span;
function trans_span ($ string) {
$ string = ereg_replace (chr (10), "\ n", $ string);
$ string = ereg_replace (chr (32), "", $ string);
$ string = ereg_replace ('"'," "", $ string);
return $ string;
}
// --- display cookies on WEB, filter HTML
function trans_cookie ($ STR) {
$ STR = Trans ($ STR);
$ STR = stripslashes ($ STR);
$ STR = eregi_replace ( " ''", " '", $ STR);
return $ STR;
}
? >
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ a Summary of escape charactersIn writing bbs recently, I encountered a problem with transcoding. It took a long time to find a more complete solution, which can completely restore the original text php
fb.com/undercodeTesting
System: linux + php4 + oracle8i
<?
// --- title, name and other fields into the library processing (remove the leading and trailing spaces)
function trans_string_trim ($ str) {
$ str = trim ($ str);
$ str = eregi_replace ("'" , "" ", $ str);
$ str = stripslashes ($ str);
return $ str;
}
// --- article storage, namely textarea field;
function trans_string ($ str) {
$ str = eregi_replace (" '","' '",$ str);
$ str = stripslashes ($ str);
return $ str;
}
// --- displayed from the library in the form; in text to trans conversion, in textarea, no Conversion, display directly
//-display on WEB page, filter HTML code; including link address
function trans ($ string) {
$ string = htmlspecialchars ($ string);
$ string = ereg_replace (chr (10), "
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed on the WEB page without filtering HTML code;
function trans_web ($ string) {
$ string = ereg_replace (chr ( 10), "
", $ string);
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed on the WEB page, filter HTML code and head and tail spaces, mainly Used to display user nickname
function trans_trim ($ string) {
$ string = trim ($ string);
$ string = htmlspecialchars ($ string);
$ string = ereg_replace (chr (10), "
", $ string);
$ string = ereg_replace (chr (32), "", $ string);
return $ string;
}
// --- displayed in span;
function trans_span ($ string) {
$ string = ereg_replace (chr (10), "\ n", $ string);
$ string = ereg_replace (chr (32), "", $ string);
$ string = ereg_replace ('"'," "", $ string);
return $ string;
}
// --- display cookies on WEB, filter HTML
function trans_cookie ($ STR) {
$ STR = Trans ($ STR);
$ STR = stripslashes ($ STR);
$ STR = eregi_replace ( " ''", " '", $ STR);
return $ STR;
}
? >
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
Facebook
Log in or sign up to view
See posts, photos and more on Facebook.
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ PHP can also be used as Shell ScriptPHP :
1) popular. Recently, PHP (Personal Hypertext Preprocessor) seems to have become the most widely used web processing language on Linux / Unix in the past two years. Its convenience, powerful functions and OpenSource features make it gradually eroded to Traditional CGI and even the market of MicroSoft ASP (Active Server Page), almost all major websites recruit talents with PHP as a basic condition.
2) PHP does have this qualification and can be so
popular for the following reasons: PHP is OpenSource software, which is completely free and can be distributed freely, so it attracts a lot of people to use, and because of this, it attracts commercial companies to develop better. Engine and optimization software
3) PHP itself is very simple and easy to understand, simple command syntax, plus some basic object-oriented processing capabilities, so that novices are enough to learn in the shortest time.
4) PHP provides a lot of functions, including mathematical processing, string processing, network-related functions, various database support, image processing functions, and a large number of developers are developing various new functions for PHP. Sex is excellent.
5) PHP is very easy to combine with Apache. It is used as an Apache module. The installation is quite simple. Because Apache currently occupies 60% of the Web Server market worldwide, PHP naturally becomes the best match for Apache.
6) However, this time the topic to be addressed is not the application of PHP in web design, but the application of PHP in Shell Script. The commonly known Shell Script is about tcsh, bash, perl or python. I want Talking about using PHP as Shell Script.
π¦ PHP can also be used as Shell ScriptPHP :
1) popular. Recently, PHP (Personal Hypertext Preprocessor) seems to have become the most widely used web processing language on Linux / Unix in the past two years. Its convenience, powerful functions and OpenSource features make it gradually eroded to Traditional CGI and even the market of MicroSoft ASP (Active Server Page), almost all major websites recruit talents with PHP as a basic condition.
2) PHP does have this qualification and can be so
popular for the following reasons: PHP is OpenSource software, which is completely free and can be distributed freely, so it attracts a lot of people to use, and because of this, it attracts commercial companies to develop better. Engine and optimization software
3) PHP itself is very simple and easy to understand, simple command syntax, plus some basic object-oriented processing capabilities, so that novices are enough to learn in the shortest time.
4) PHP provides a lot of functions, including mathematical processing, string processing, network-related functions, various database support, image processing functions, and a large number of developers are developing various new functions for PHP. Sex is excellent.
5) PHP is very easy to combine with Apache. It is used as an Apache module. The installation is quite simple. Because Apache currently occupies 60% of the Web Server market worldwide, PHP naturally becomes the best match for Apache.
6) However, this time the topic to be addressed is not the application of PHP in web design, but the application of PHP in Shell Script. The commonly known Shell Script is about tcsh, bash, perl or python. I want Talking about using PHP as Shell Script.
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ Installation of PHP executable files :
1) Generally, PHP as a webpage processing language is compiled into Apache modules. Of course, it is not done here, so it is very simple to compile. Just perform the following actions as root:
> unlock php-3.0.xx. After tar.gz
> cd php
> configure
> make is
2) compiled, there is an executable file in the php directory, the file name is php, copy it to / usr / local / bin. Note that if the file is too large, you can use the strip command to remove unnecessary information in php mode, so that the file will be much smaller.
π¦ The first program
begins to write our first PHP Shell Script program. This example prints "Hello world!":
#! / Usr / local / bin / php -q
<?
Echo "Hello, world!";
?>
1) Note that PHP was originally used in web applications, so it will send HTML HEADER by default, but here we are going to use PHP as Shell Script, "-q"
2) In this example, / usr / local / bin / php means to execute PHP under / usr / local / bin / because we just installed it there. The echo command prints out "Hello, world!", where the "" character is a newline character.
3) Note that after saving this program as a file, chmod must be made executable (chmod + x file name) before it can be executed.
Advanced use of I
4) Sometimes we need to send some parameters when the program is executed, such as the ls command, which can be added with the -l parameter. PHP Shell Script also supports this usage, with two special variables: $ argc records the number of parameters sent later, and the parameters stored in the $ argv [] array parameters are the contents of the parameters. For example, I now want to design a program that calculates the sum of two numbers:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
$ sum = $ sum + $ argv [1] + $ argv [2] ;
echo $ sum;
?>
Assuming this program is named sum.php3, execute sum.php3 1 2 Press enter and 3 will be printed.
If you want to calculate the sum of an unspecified number of parameters, then you have to use the special variable $ argc:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
for ($ t = 1; $ t <= $ argc; $ t ++)
$ sum = $ sum + $ argv [$ t];
echo $ sum;
?>
π¦ Installation of PHP executable files :
1) Generally, PHP as a webpage processing language is compiled into Apache modules. Of course, it is not done here, so it is very simple to compile. Just perform the following actions as root:
> unlock php-3.0.xx. After tar.gz
> cd php
> configure
> make is
2) compiled, there is an executable file in the php directory, the file name is php, copy it to / usr / local / bin. Note that if the file is too large, you can use the strip command to remove unnecessary information in php mode, so that the file will be much smaller.
π¦ The first program
begins to write our first PHP Shell Script program. This example prints "Hello world!":
#! / Usr / local / bin / php -q
<?
Echo "Hello, world!";
?>
1) Note that PHP was originally used in web applications, so it will send HTML HEADER by default, but here we are going to use PHP as Shell Script, "-q"
2) In this example, / usr / local / bin / php means to execute PHP under / usr / local / bin / because we just installed it there. The echo command prints out "Hello, world!", where the "" character is a newline character.
3) Note that after saving this program as a file, chmod must be made executable (chmod + x file name) before it can be executed.
Advanced use of I
4) Sometimes we need to send some parameters when the program is executed, such as the ls command, which can be added with the -l parameter. PHP Shell Script also supports this usage, with two special variables: $ argc records the number of parameters sent later, and the parameters stored in the $ argv [] array parameters are the contents of the parameters. For example, I now want to design a program that calculates the sum of two numbers:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
$ sum = $ sum + $ argv [1] + $ argv [2] ;
echo $ sum;
?>
Assuming this program is named sum.php3, execute sum.php3 1 2 Press enter and 3 will be printed.
If you want to calculate the sum of an unspecified number of parameters, then you have to use the special variable $ argc:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
for ($ t = 1; $ t <= $ argc; $ t ++)
$ sum = $ sum + $ argv [$ t];
echo $ sum;
?>
π¦ Assuming this program is named bigsum.php3, execute bigsum.php3 1 2 3 4 5 Press enter to print out 15, execute bigsum.php3 1 2 3 4 5 6 Press enter Print out 21.
> Sometimes we need to input data during program execution, but PHP is originally used for web design, and the data input on the web page is naturally input by FORM, so this problem comes when PHP is used as Shell Script. In PHP, there is a function to open files, and under Linux / Uinx, input (input) can be done by opening a file. We want to open the device file / dev / stdin (stdin is Means standard input), the procedure is as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");
$ inputstr = fgets ($ fp, 100 );
fclose ($ fp);
echo "\ n ---------------------- \ n";
echo $ inputstr;
?>
where fgets ($ fp , 100) refers to the file from $ fp (that is, "/ dev / stdin" ) To read 100 bytes of data, the program will stop at this line and wait for our input. After we press enter, the program will print out the data we just entered.
Advanced Use II
Although it can already handle input, such a function is obviously too simple to cope with larger applications. For example, I need a function to remove HTML from a stream of data (data stream). To deal with the ability of input and output steering, we can first design the program as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");
while (! Feof ( $ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};
fclose ($ fp);
echo $ inputstr;
?>
Assuming this program is named filt.php3, if you directly When this program is executed, it will wait for you to enter it until you press Ctrl + D to print your input data. We can execute it like this :
more filt.php3 | filt.php3
This method is to filt The .php3 program is shown with more and turned to the filt.php3 program. The filt.php3 will continue to receive data (in fact, the filt.php3 program code itself), and finally print it out.
We can add HTML filtering to it:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "
while (! feof ($ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};
fclose ($ fp);
$ inputstr = ereg_replace ("<([^ <>] * )> "," ", $ inputstr);
echo $ inputstr;
?>
π¦ Assuming that this program is named filt2.php3, so that the filtering function is completed, do nβt believe it, please take an HTML file to try:
more xxx.html | filt2.php3
You will see the deleted HTML TAG file.
π¦ SO PHP CAN USED AS SHELL HACKING SCRIPTING ?
> PHP used as Shell Script is actually quite easy to use, because PHP itself is very easy to learn, and it supports a variety of databases, after you have often used PHP to design your website, absolutely do not like to use other Shell Script language to deal with other parts that must be non-web pages. At this time, the benefits of using PHP as Shell Script will be revealed. You can develop the entire system in a consistent manner without having to use PHP and then use it. Perl / Python or C.
> The domestic PHP atmosphere is already very prosperous. LinuxFab on this site has been developed entirely with PHP and MySQL. In fact, there are many magical uses of PHP. There are opportunities to introduce it in the future. If readers need information about PHP, welcome to this site Participate in more discussions on the PHP forum.
& nbs
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
> Sometimes we need to input data during program execution, but PHP is originally used for web design, and the data input on the web page is naturally input by FORM, so this problem comes when PHP is used as Shell Script. In PHP, there is a function to open files, and under Linux / Uinx, input (input) can be done by opening a file. We want to open the device file / dev / stdin (stdin is Means standard input), the procedure is as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");
$ inputstr = fgets ($ fp, 100 );
fclose ($ fp);
echo "\ n ---------------------- \ n";
echo $ inputstr;
?>
where fgets ($ fp , 100) refers to the file from $ fp (that is, "/ dev / stdin" ) To read 100 bytes of data, the program will stop at this line and wait for our input. After we press enter, the program will print out the data we just entered.
Advanced Use II
Although it can already handle input, such a function is obviously too simple to cope with larger applications. For example, I need a function to remove HTML from a stream of data (data stream). To deal with the ability of input and output steering, we can first design the program as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");
while (! Feof ( $ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};
fclose ($ fp);
echo $ inputstr;
?>
Assuming this program is named filt.php3, if you directly When this program is executed, it will wait for you to enter it until you press Ctrl + D to print your input data. We can execute it like this :
more filt.php3 | filt.php3
This method is to filt The .php3 program is shown with more and turned to the filt.php3 program. The filt.php3 will continue to receive data (in fact, the filt.php3 program code itself), and finally print it out.
We can add HTML filtering to it:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "
while (! feof ($ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};
fclose ($ fp);
$ inputstr = ereg_replace ("<([^ <>] * )> "," ", $ inputstr);
echo $ inputstr;
?>
π¦ Assuming that this program is named filt2.php3, so that the filtering function is completed, do nβt believe it, please take an HTML file to try:
more xxx.html | filt2.php3
You will see the deleted HTML TAG file.
π¦ SO PHP CAN USED AS SHELL HACKING SCRIPTING ?
> PHP used as Shell Script is actually quite easy to use, because PHP itself is very easy to learn, and it supports a variety of databases, after you have often used PHP to design your website, absolutely do not like to use other Shell Script language to deal with other parts that must be non-web pages. At this time, the benefits of using PHP as Shell Script will be revealed. You can develop the entire system in a consistent manner without having to use PHP and then use it. Perl / Python or C.
> The domestic PHP atmosphere is already very prosperous. LinuxFab on this site has been developed entirely with PHP and MySQL. In fact, there are many magical uses of PHP. There are opportunities to introduce it in the future. If readers need information about PHP, welcome to this site Participate in more discussions on the PHP forum.
& nbs
written by undercode
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ BEST cheep DOMAINE NAME SERVICES recommended by undercode :
1) https://ae.godaddy.com/?isc=cjc1off30&AID=10523876&SID=bgtRcrYe01&utm_source=cj&utm_medium=affiliate&utm_campaign=xx-xx_corp_affiliate_10523876_001&utm_content=Natural+Intelligence+Ltd._2828146&tgt=9109189
2) https://www.bluehost.com/special/homeaff?utm_source=www.top10bestwebsitehosting.com&utm_medium=affiliate&utm_campaign=affiliate-link_naturalcpa_Directories
3) https://www.hostinger.com/?utm_medium=affiliate&utm_source=aff1015&utm_campaign=Natural+Intelligence+-media&session=102c94c5197763e038f9fac462f9ec
4) https://www.hostinger.com/?utm_medium=affiliate&utm_source=aff1015&utm_campaign=Natural+Intelligence+-media&session=102c94c5197763e038f9fac462f9ec
5) https://www.networksolutions.com/domain-name-registration/index.jsp?clickid=U-9RLrUSmxyORpEwUx0Mo3EWUki2j6Ru513Qz80&iradid=596013&irpid=34020&sharedid=&source=IR&siteid=662&channelid=P13C662S645N0B9A1D0E0000V103&promo=DOMSAVE40
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ BEST cheep DOMAINE NAME SERVICES recommended by undercode :
1) https://ae.godaddy.com/?isc=cjc1off30&AID=10523876&SID=bgtRcrYe01&utm_source=cj&utm_medium=affiliate&utm_campaign=xx-xx_corp_affiliate_10523876_001&utm_content=Natural+Intelligence+Ltd._2828146&tgt=9109189
2) https://www.bluehost.com/special/homeaff?utm_source=www.top10bestwebsitehosting.com&utm_medium=affiliate&utm_campaign=affiliate-link_naturalcpa_Directories
3) https://www.hostinger.com/?utm_medium=affiliate&utm_source=aff1015&utm_campaign=Natural+Intelligence+-media&session=102c94c5197763e038f9fac462f9ec
4) https://www.hostinger.com/?utm_medium=affiliate&utm_source=aff1015&utm_campaign=Natural+Intelligence+-media&session=102c94c5197763e038f9fac462f9ec
5) https://www.networksolutions.com/domain-name-registration/index.jsp?clickid=U-9RLrUSmxyORpEwUx0Mo3EWUki2j6Ru513Qz80&iradid=596013&irpid=34020&sharedid=&source=IR&siteid=662&channelid=P13C662S645N0B9A1D0E0000V103&promo=DOMSAVE40
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
GoDaddy
Domain Names, Websites, Hosting & Online Marketing Tools - GoDaddy AE
GoDaddy makes registering Domain Names fast, simple, and affordable. Find out why so many business owners chose GoDaddy to be their Domain Name Registrar.
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ best spy apps for Android 2020 top rated :
1) https://www.bestphonespy.com/go/mspy/
2) https://www.prospybubble.com/
3) https://www.highstermobi.com/
4) http://www.flexispyapp.com/
5) https://www.hoverspyapp.com/
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ best spy apps for Android 2020 top rated :
1) https://www.bestphonespy.com/go/mspy/
2) https://www.prospybubble.com/
3) https://www.highstermobi.com/
4) http://www.flexispyapp.com/
5) https://www.hoverspyapp.com/
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
Mspy
mSpyβ’ Cell Phone Tracker App β’ Best Monitoring Software for any Smartphone
Cell Phone Tracking App for monitoring all internet activity on target Mobile Phone. How to track a cell phone? mSpy Software β Easiest Way to track: Text Messages, Emails, Location, Calls, Whatsapp, Viber and 25+ more!
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ Best apps to earn bitcoin 2020 top rated :
t.me/undercodeTesting
1) coinbase
> https://itunes.apple.com/us/app/coinbase-buy-bitcoin-more/id886427730?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.coinbase.android&hl=en
2) Blockfolio
> https://itunes.apple.com/us/app/blockfolio-bitcoin-altcoin-app/id1095564685?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.blockfolio.blockfolio&hl=en
3) CoinATMRadar
> https://itunes.apple.com/us/app/coinatmradar/id944855781?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.coinatmradar.android&hl=en
4) Bitmap
> https://itunes.apple.com/us/app/bitmap/id777198586?mt=8&at=1001lHiS
> https://play.google.com/store/apps/developer?id=BitMap
5) Xapo
> https://itunes.apple.com/us/app/xapo-bitcoin-wallet-vault/id917692892?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.xapo&hl=en
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦ Best apps to earn bitcoin 2020 top rated :
t.me/undercodeTesting
1) coinbase
> https://itunes.apple.com/us/app/coinbase-buy-bitcoin-more/id886427730?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.coinbase.android&hl=en
2) Blockfolio
> https://itunes.apple.com/us/app/blockfolio-bitcoin-altcoin-app/id1095564685?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.blockfolio.blockfolio&hl=en
3) CoinATMRadar
> https://itunes.apple.com/us/app/coinatmradar/id944855781?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.coinatmradar.android&hl=en
4) Bitmap
> https://itunes.apple.com/us/app/bitmap/id777198586?mt=8&at=1001lHiS
> https://play.google.com/store/apps/developer?id=BitMap
5) Xapo
> https://itunes.apple.com/us/app/xapo-bitcoin-wallet-vault/id917692892?mt=8&at=1001lHiS
> https://play.google.com/store/apps/details?id=com.xapo&hl=en
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
π¦FOR BEGINERS Instructions for using the ORACLE function in PHP3 full by Undercode :
1) let SELECT command can use PHP variables.
Syntax: boolean OCIDefineByName (int stmt, string ColumnName, mixed & variable, int [type]);
Return value: boolean
function Category: database features
π¦ Description
> This function is used to define the designated PHP variables, so that it can Used by the SELECT instruction in the SQL instruction.
> Pay attention to the case, because the field names in the Oracle database are actually capitalized names. The parameter stmt is the string index after Oracle parsing (OCIParse). The parameter ColumnName is the column name on the Oracle data table.
> The variable must be preceded by an ampersand, which indicates the address of the PHP variable. The parameter type is usually omitted. It is worth noting that when you want to use the new data types LOB / ROWID / BFILE unique to Oracle 8, you need to execute the OCINewDescriptor () function first. The successful execution of this function returns a true value.
π¦ OCIBindByName
makes PHP variables available for dynamic SQL.
Syntax: boolean OCIBindByName (int stmt, string ph_name, mixed & variable, int length, int [type]);
return value: Boolean value
π¦ Function type: database function
Description
> This function is used to define the specified PHP variable so that it can be used by dynamic SQL commands (Oracle Placeholder). Pay attention to the case, because the field names in the Oracle database are actually capitalized names. The parameter stmt is the string index after Oracle parsing (OCIParse). The parameter ph_name is the variable to be used by the dynamic SQL instruction. The variable must be preceded by an ampersand, which indicates the address of the PHP variable. The parameter length is the length of the data. If it is set to -1, the maximum value of the specified variable data is used. The parameter type can be omitted. The values are OCI_B_FILE (binary file), OCI_B_CFILE (text file), OCI_B_CLOB (text LOB), OCI_B_BLOB (bit LOB), and OCI_B_ROWID (ROWID). It is worth noting that when you want to use the new data type LOB / ROWID / BFILE unique to Oracle 8, you need to first execute the OCINewDescriptor () function, and you must set the length parameter to -1. The successful execution of this function returns a true value.
π¦ OCILogon
opens the link with Oracle.
Syntax: int OCILogon (string username, string password, string [OCACLE_SID]);
Return value: integer
π¦ function Category: Database function
Description
This function makes PHP with Oracle to link. The parameters username and password are the connected account and password respectively. The parameter OCACLE_SID is the database name and can be omitted. The return value is the code of the connection.
OCILogOff
Close the link with Oracle.
Syntax: boolean OCILogOff (int connection);
Return value: boolean
π¦ function Category: Database function
Description
This function makes PHP with Oracle link end. The parameter connection is the connection code to connect to Oracle. The return value true means success, false means an error occurred.
OCIExecute
executes Oracle's instruction section.
Syntax: boolean OCIExecute (int statement, int [mode]);
Return value: boolean
π¦ function Category: database feature
Description
This function is used to execute the specified command Oracle section, before executing must first be OCIParse ( ) Analyzed the SQL syntax of this section. The parameter statement is the analyzed code. The parameter mode can be omitted and its default value is OCI_COMMIT_ON_SUCCESS. The return value true means success, false means an error occurred.
OCICommit
puts Oracle transaction processing into practice
Syntax: boolean OCICommit (int connection);
Return value: Boolean value
π¦ Function type: Database function
π¦FOR BEGINERS Instructions for using the ORACLE function in PHP3 full by Undercode :
1) let SELECT command can use PHP variables.
Syntax: boolean OCIDefineByName (int stmt, string ColumnName, mixed & variable, int [type]);
Return value: boolean
function Category: database features
π¦ Description
> This function is used to define the designated PHP variables, so that it can Used by the SELECT instruction in the SQL instruction.
> Pay attention to the case, because the field names in the Oracle database are actually capitalized names. The parameter stmt is the string index after Oracle parsing (OCIParse). The parameter ColumnName is the column name on the Oracle data table.
> The variable must be preceded by an ampersand, which indicates the address of the PHP variable. The parameter type is usually omitted. It is worth noting that when you want to use the new data types LOB / ROWID / BFILE unique to Oracle 8, you need to execute the OCINewDescriptor () function first. The successful execution of this function returns a true value.
π¦ OCIBindByName
makes PHP variables available for dynamic SQL.
Syntax: boolean OCIBindByName (int stmt, string ph_name, mixed & variable, int length, int [type]);
return value: Boolean value
π¦ Function type: database function
Description
> This function is used to define the specified PHP variable so that it can be used by dynamic SQL commands (Oracle Placeholder). Pay attention to the case, because the field names in the Oracle database are actually capitalized names. The parameter stmt is the string index after Oracle parsing (OCIParse). The parameter ph_name is the variable to be used by the dynamic SQL instruction. The variable must be preceded by an ampersand, which indicates the address of the PHP variable. The parameter length is the length of the data. If it is set to -1, the maximum value of the specified variable data is used. The parameter type can be omitted. The values are OCI_B_FILE (binary file), OCI_B_CFILE (text file), OCI_B_CLOB (text LOB), OCI_B_BLOB (bit LOB), and OCI_B_ROWID (ROWID). It is worth noting that when you want to use the new data type LOB / ROWID / BFILE unique to Oracle 8, you need to first execute the OCINewDescriptor () function, and you must set the length parameter to -1. The successful execution of this function returns a true value.
π¦ OCILogon
opens the link with Oracle.
Syntax: int OCILogon (string username, string password, string [OCACLE_SID]);
Return value: integer
π¦ function Category: Database function
Description
This function makes PHP with Oracle to link. The parameters username and password are the connected account and password respectively. The parameter OCACLE_SID is the database name and can be omitted. The return value is the code of the connection.
OCILogOff
Close the link with Oracle.
Syntax: boolean OCILogOff (int connection);
Return value: boolean
π¦ function Category: Database function
Description
This function makes PHP with Oracle link end. The parameter connection is the connection code to connect to Oracle. The return value true means success, false means an error occurred.
OCIExecute
executes Oracle's instruction section.
Syntax: boolean OCIExecute (int statement, int [mode]);
Return value: boolean
π¦ function Category: database feature
Description
This function is used to execute the specified command Oracle section, before executing must first be OCIParse ( ) Analyzed the SQL syntax of this section. The parameter statement is the analyzed code. The parameter mode can be omitted and its default value is OCI_COMMIT_ON_SUCCESS. The return value true means success, false means an error occurred.
OCICommit
puts Oracle transaction processing into practice
Syntax: boolean OCICommit (int connection);
Return value: Boolean value
π¦ Function type: Database function
This function will permanently modify the transaction after the last commit / rollback. The parameter connection is the connection code to connect to Oracle. The return value true means success, false means an error occurred.
OCIRollback
cancels the current transaction.
Syntax: boolean OCIRollback (int connection);
Return value: boolean
π¦ function Category: database features
Description
This function canceled Oracle transaction processing (transaction) made changes to the database. The parameter connection is the connection code to connect to Oracle. If successful, it returns true, otherwise it returns false.
OCINumRows gets
the number of affected fields.
Syntax: int OCINumRows (int statement);
Return value: integer
π¦ function Category: database features
Description
This function returns the field (column) number of affected by the UPDATE command, etc., etc. If you use SQL SELECT command will not influential. The parameter statement is the analyzed code.
OCIResult gets a
column from the data in the current row.
Syntax: string OCIResult (int statement, mixed column);
Return value: string
π¦ Function type: database function
Description
This function returns a column of data. The parameter statement is the analyzed code. The parameter column is the field name. If new data forms (ROWIDs, LOBs, and FILEs) are used, the returned data are all strings.
OCIFetch gets
a row of the returned data.
Syntax: int OCIFetch (int statement);
Return value: integer
π¦ function Category: database features
Description
This function is used to obtain a non-null data. The parameter statement is the analyzed code. The return value true means successfully retrieved a column, false means that the column is empty or other errors occur.
OCIFetchInto
retrieves Oracle data and puts it into the array.
Syntax: int OCIFetchInto (array & result, int [mode]);
Return value: integer
π¦ function types: Database Function
Description
This function will retrieve the data into Oracle result in an array. Returns the number of fields in each row, or false if it fails. The parameter mode can be omitted, the default value is OCI_NUM, and others include OCI_ASSOC, OCI_RETURN_NULLS, and OCI_RETURN_LOBS.
OCIColumnIsNULL
tests whether the returned line is empty.
Syntax: boolean OCIColumnIsNULL (int stmt, mixed column);
return value: Boolean value
π¦ Function type: database function
Description
This function is used to test the returned row (column) is null value (NULL). Return true to indicate a null value.
OCIColumnSize gets
the size of the column type.
Syntax: int OCIColumnSize (int stmt, mixed column);
Return value: integer
database features: the type of function
Description
Size of this function can get the field (column) type (type) of.
OCINewDescriptor
initial new LOB / FILE description.
Syntax: string OCINewDescriptor (int connection, int [type]);
Return value: String
π¦function Category: database features
Description
This function is used to initialize new LOB / FILE value description.
OCIParse
analyzes SQL syntax.
Syntax: int OCIParse (int connection, string query);
Return value: integer
π¦ function Category: database features
Description
This function can be used to analyze SQL syntax or the PL / SQL section for errors. Parameter connect
β β β ο½ππ»βΊπ«Δπ¬πβ β β β
OCIRollback
cancels the current transaction.
Syntax: boolean OCIRollback (int connection);
Return value: boolean
π¦ function Category: database features
Description
This function canceled Oracle transaction processing (transaction) made changes to the database. The parameter connection is the connection code to connect to Oracle. If successful, it returns true, otherwise it returns false.
OCINumRows gets
the number of affected fields.
Syntax: int OCINumRows (int statement);
Return value: integer
π¦ function Category: database features
Description
This function returns the field (column) number of affected by the UPDATE command, etc., etc. If you use SQL SELECT command will not influential. The parameter statement is the analyzed code.
OCIResult gets a
column from the data in the current row.
Syntax: string OCIResult (int statement, mixed column);
Return value: string
π¦ Function type: database function
Description
This function returns a column of data. The parameter statement is the analyzed code. The parameter column is the field name. If new data forms (ROWIDs, LOBs, and FILEs) are used, the returned data are all strings.
OCIFetch gets
a row of the returned data.
Syntax: int OCIFetch (int statement);
Return value: integer
π¦ function Category: database features
Description
This function is used to obtain a non-null data. The parameter statement is the analyzed code. The return value true means successfully retrieved a column, false means that the column is empty or other errors occur.
OCIFetchInto
retrieves Oracle data and puts it into the array.
Syntax: int OCIFetchInto (array & result, int [mode]);
Return value: integer
π¦ function types: Database Function
Description
This function will retrieve the data into Oracle result in an array. Returns the number of fields in each row, or false if it fails. The parameter mode can be omitted, the default value is OCI_NUM, and others include OCI_ASSOC, OCI_RETURN_NULLS, and OCI_RETURN_LOBS.
OCIColumnIsNULL
tests whether the returned line is empty.
Syntax: boolean OCIColumnIsNULL (int stmt, mixed column);
return value: Boolean value
π¦ Function type: database function
Description
This function is used to test the returned row (column) is null value (NULL). Return true to indicate a null value.
OCIColumnSize gets
the size of the column type.
Syntax: int OCIColumnSize (int stmt, mixed column);
Return value: integer
database features: the type of function
Description
Size of this function can get the field (column) type (type) of.
OCINewDescriptor
initial new LOB / FILE description.
Syntax: string OCINewDescriptor (int connection, int [type]);
Return value: String
π¦function Category: database features
Description
This function is used to initialize new LOB / FILE value description.
OCIParse
analyzes SQL syntax.
Syntax: int OCIParse (int connection, string query);
Return value: integer
π¦ function Category: database features
Description
This function can be used to analyze SQL syntax or the PL / SQL section for errors. Parameter connect
β β β ο½ππ»βΊπ«Δπ¬πβ β β β