. Perl -
---------------------------------------------------------------
© Copyright
Email: web@hackzone.ru
WWW: http://www.hackzone.ru http://www.hackzone.ru
Date: 09 Sep 2001
---------------------------------------------------------------
internet/intranet-
(internet) -- , ,
,
TCP/IP. --
. ,
-, ,
. TCP/IP
"". .
-- , ,
.
,
.
,
.
,
, .
- ,
. tcp/ip ip- ,
32- ,
216.122.167.55 ( 0 255, ).
ip- 32- ,
- ,
, .
255.255.255.0, ip-
216.122.167 55.
. ,
,
-
.
,
Internet,
. , ,
, -
, .
. 1. Internet
" Internet",
. Internet
, ,
. - (proxy, ).
-
, ,
tcp/ip, NAT, Network Address Translator,
:
- .
,
.
. -, "" ip-,
( , 32 ,
ip- -- ,
ip-, ipv6). -,
,
. ,
,
.
Ip- ,
. , 216.122.167.55 .
ip
.
, ,
, -, , -,
.
(Domain Name Servers, DNS).
,
. ,
.
(root) ,
. ,
..
.com (
), .edu ( ), .net (
, ), .org (,
),
InterNIC, .gov (
,
, US
Federal Government civilian agency), .mil ( ,
US military agency), .int ( ).
. ,
(, .ru, .de),
.
Ip- ,
. ,
Internet - , ,
..
. - FTP
(File Transfer Protocol), web- -
HTTP(HyperText Transfer Protocol),
- SMTP, POP3, IMAP ..
,
0 65534.
. , FTP 21, HTTP - 80, SMTP - 25, POP3 - 110. ,
,
. - ,
, WWW.
,
,
: Windows-1251, KOI8, Mac, DOS.
,
-- .
. -,
,
Win1251. -,
- . .
,
-- ,
: , 8080 -- Win1251,
8083 -- Koi8 ..
URL
(Uniform Resource Locator, URL)
- , ..
URL :
[]://[][:]@[][:][//][][?
]
, URL
.
- ,
(, ftp, http);
- ;
-
, ;
- , ;
- , ,
;
- ,
;
- ;
-
.
web-
, (
, , ..).
,
, World Wide Web (WWW),
HTTP (Hyper Text Transfer Protocol --
). , WWW,
-- , , ,
, .
HTML (Hyper Text Markup Language --
),
,
,
. HTML-
-- .
Navigator Netscape (NN) Internet Explorer Microsoft
(MSIE). NN
, MSIE Windows ,
Macintosh Unix-.
HTML- ,
, ,
. html- :
<html>
<head>
<title></title>
</head>
<body>
<p>
</body>
</html>
:
. 2. html-
, ,
. , , , <p>,
, <body> </body>,
. -- ,
, ..: <body bgcolor="white"
text="black">.
<html>,
-- .
<head>, (
<title>) ,
. <body>
, .
, ,
,
, , .
:
<p> -- , ,
: <p align=right>;
<br> -- ;
-- ;
-- ;
<u></u> --
<a
href="URL">...</a>, URL -- .
, <a>,
, ,
href.
<img src="URL">.
WWW,
.
--
,
HTML, , ,
HTML.
. 3. ,
(1), (2)
(2) - .
(4),
(5,6)
..
HTML -
,
, .
WWW:
. WWW ,
,
,
, .
,
.
.
. --
-
,
, ..
Web --
, , ..
,
, .
:
(plug-ins) Netscape;
ActiveX;
Java-;
JavaScript, VBScript.;
Macromedia Flash.
.
Netscape Navigator,
. ,
.
ActiveX
OLE/COM-,
, Win32-.
-- Win32-
Internet Explorer, Netscape Navigator plug-in,
ActiveX. ActiveX
,
Internet Explorer,
.
--
,
(, VeriSign Inc.),
, . .
, .
--
.
Java-
. ,
, Java-
-, Java-.
- ,
-- ,
Java-.
Java-,
-. , Java-
-- - ,
Java-
. ,
(JIT -- just in time compilers),
""
. ,
( , ++)
-- native code.
.
Java- --
( ,
-- ,
.., -,
" " ..), (
,
..,
), ,
, . ,
.
--
Java-. Java-
,
. ,
-- Java
,
, ,
.
, ,
Java-, ,
.
,
.
Java .
Java
.
.
-- ,
, ,
, , ..
Java-
,
.
JavaScript, VBScript ..
, html-
. ,
,
.. ,
, , ""
html- (.. Dynamic HTML) ..
Macromedia Flash ,
,
web-, Java.
,
-- (
/ , , , ).
flash- ,
( ,
ActiveX- Java-).
, ,
.
, ..
.
,
, .
,
. ,
-- WWW.
HTML-.
HTML
-- , , , .
<form>, action
, . method
-- GET POST.
HTML-,
, :
<p align="center">
<form action="/cgi-bin/process.cgi" method="POST">
1<br>
<select name="answer" size="3">
<option value="answer1" selected> 1</option>
<option value="answer2"> 2</option>
<option value="answer3"> 3</option>
</select><br><br>
<input type="submit" value="">
</form>
:
. 4.
, -- <input>.
type :
submit/text/password/checkbox/radio/hidden, ,
, , ,
.
name , value
.
<select></select>,
, <option>,
.
Submit,
http-, ,
, action.
,
, CGI (Common Gateway Interface, ).
, CGI, Web-
(CGI-) ,
(, Web-). CGI-
, .
.
, .1.
. 1. , www- cgi-
, html-
<form>, "Submit".
CGI- --
Location , <img>
(SSI) . .
HTTP-
.
param1=value1¶m2=value2...¶mN=valueN, parami --
, valuei -- .
, , ,
, %XX,
XX -- .
"+". ,
GET, URL
(,
<u>http://www.somehost.com/cgi-bin/script.cgi?param1=value1¶m2=value2</u>).
POST
( , ,
application/x-www-form-urlencoded), .
(
).
: , ,
, . . HTTP-,
": ".
, .
CGI-,
QUERY_STRING (
GET) ( POST).
, HTTP_USER_AGENT, REMOTE_HOST .
'njuj HTTP-.
CGI-
(stdin) QUERY_STRING.
, , ,
http- Location,
,
(stdout). HTTP-,
, , cookies . .
.
CGI- ,
.
--
http- Location,
. , Content-type,
--
, text/html html-.
, HTTP,
CGI- .
CGI- ,
. ,
CGI-
DOS, Delphi, /++, Tcl, Visual Basic, AppleScript, FoxPro, Perl . .
CGI --
, -,
, -,
. HTTP-,
,
.
,
.
, Unix-,
mod_perl -- ,
web- Apache Perl.
CGI-, Perl.
-- mod_perl
Perl Apache,
.
PHP -- ,
html-. , html- ,
PHP <?
?>. , , PHP,
,
. C,
.
Windows- Unix-.
Microsoft Internet Information Server (IIS)
ISAPI Active Server Pages (ASP). ISAPI-
, .
,
.
, ISAPI-
web- (, IIS4
).
ASP PHP -- , ,
ASP (<% %>), ,
, , ISAPI-. ,
,
-- JavaScript VBScript,
HTML. HTML
--
. ASP, ,
ActiveX-.
.NET, , Active
Server Pages+, -
.
web-, CGI
-- Java Servlets, FastCGI,
ColdFusion ..
-- --
.
,
- <form>
, .
Perl
CGI-
Perl. ,
, ,
. . ,
Unix-,
,
. Perl,
CGI. , ,
, Comprehensive Perl
Archive Network (CPAN, <u>http://www.perl.com/CPAN/)</u>,
,
, ..
: , , ,
Perl- ,
Perl-, #!/usr/bin/perl ,
Perl. Unix-,
, , ,
windows- ,
(Apache/Win32, ,
CGI- ).
C,
. ,
, ""
, .
, use strict,
.
, ,
-- , :
print "Hello, World\n";
print ("Hello, World\n");
#,
. .
Perl -- .
--
(, ,
Perl, double).
,
- ,
.
--
:
print "2"*2; # 4
$:
$a = 1;
,
undef.
undef "",
defined.
0 "" "0".
.
:
print '12\n$a'; # 12\n$a
:
print "12\n$a"; # 12, ,
$a
,
: "\$a".
( **, not, and, or,
!, &&, ||, , ,
xor, ).
"." (),
"x", ne ( ), eq (), lt ( "
") gt ( " ").
cmp, --1, 0 1,
, <=>.
chop ,
chomp ,
( --
\n,
$\).
index($, $,
$), ,
$ ( ) rindex,
, .
substr ($, $, $).
.
,
.
Perl
. @: @a,
$a[10] (
0, --1,
--2 ..).
-- , chomp
,
@a .