Академический Документы
Профессиональный Документы
Культура Документы
6
1 L
................................................................................1
1.1 XML ..............................................................................2
1.2 ......................................................................3
1.3 XML .........................................................................................5
- XML ........................................................................................5
- XML ............................................................................6
- XML ...............................................................................................8
1.4 XML ...............................................................12
1.5 XSLT ...........................................................17
1.6 ........................................................20
2
..............................................................................21
2.1 .............22
2.2 Javascript ....................................................23
- ...................................................................................................................23
- Javascript HTML................................................23
- Javascript................................................................25
- (Event Handlers) Javascript.....................................30
- Javascript ...........................................32
2.3 DHTML ...............................................................................40
- DHTML ...........................................................................................40
- (Cascading Style Sheets css).............................................40
2.4 HTML, Javascript ...............48
2.5 ........................................................56
3 : PHP
..............................................................................57
3.1 .............59
3.2 MySQL.......................61
- ...................................................................................................................61
- MySQL ........................................................................61
- MySQL.............................................................................62
- SQL ..........................................................................................................62
- MySQL..........................63
- PHPMyAdmin ..............................71
3.3 PHP.............................................................76
- PHP ......................................................................................76
- PHP...........................................................76
- PHP...................................................................79
- PHP..............................82
3.4 ........................................................86
..............................................................................87
4.1 Active Server Pages (ASP) ..................................................................89
- ...................................................................................................................89
- ASP ..............................................................89
- ASP .........................................................91
- ASP .................................................................................94
- .............................................................................97
4.2 JSP.........................................................................................................98
- ...................................................................................................................98
- JSP ..................................................................................99
- (tags), (directive) (Objects)..............................100
- : Javabean...............102
- ..........................................................................106
..............................................................................................................107
.............................................................................................................109
.......................................................................................................111
ii
1
H
XML
XML.
, :
XML
XML
L
,
XML
XSL
, XML .
-
Extensible Markup Language, XML, ,
, Extensible Stylesheet Language,
(Extensible Markup Language - XML)
, ,
.
1.1 XML
XML
(Extensible Markup Language - XML)
. - (Hypertext Markup Language HTML) , . , XML
, . , L HTML (browser).
XML
( ), , , , , ,
. , XML
.
L
L
. , , , ,
. HTML
. , <1> ,
<2> <P>
. HTML
HTML, .
HTML:
, , .
, .
.
XML HTML, .
1.2
XML,
. XML, .
(child-nodes), (branches) .
.
1.1
:
:
240
:
15
:
:
:
:
146
21
:
:
:
:
98
5,5
240
15
146
21
.
98
1.1 1.1
5,5
1.3 XML
1.3.1 XML
XML . , XML . XML:
<>
<>
<></>
<> </>
<>240</>
<>15</>
</>
<>
<></>
<> </>
<>146</>
<>21</>
</>
<>
<> </>
<> </>
<>98</>
<>5,5</>
</>
</>
XML
1.2 XML
:
<?xml version="1.0" encoding="Windows-1253" standalone="yes" ?>
<!-- 1.1 -->
L, XML . , encoding
,
UTF-8. , standalone
L,
. , XML
.
.
L , .
<!-- - ->.
XML (document element) (Root element), .
XML
( , ,
, o ).
, , .
, () , .
, .
<>, </>, . <>,
<>, <> <>. .
( )
<>
<></>
<> </>
<>240</>
<>15</>
</>
<> </>
( )
1.3 1.1
1.3.2 L
XML . XML (well-formed XML documents). M
XML :
( ).
.
. ,
, .
.
L, L
.
, XML .
. 1.3.1, () .
1.2
<?xml version="1.0" encoding="Windows-1253" standalone="yes" ?>
<!-- 1.2 -->
<>
<>
<></>
<> </>
<>240</>
<>15</>
</>
<>
<></>
<> </>
<>146</>
<>21</>
</>
<>
<> </>
<> </>
<>98</>
<>5,5</>
</>
</>
.xml
Internet Explorer, :
XML ,
XML .
1.3.3 XML
XML ,
XML . , , L ,
.
XML (Document Type Definition DTD). To DTD
XML
, XML .
XML DTD,
DTD, XML (valid XML document)
DTD
H DTD XML
. ,
DTD ,
,
.
DTD, .
DTD XML .
<!DOCTYPE
[
<!ELEMENT (, , , )>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
]
>
DOCTYPE DTD
XML. , ELEMENT XML . #PCDATA .
DTD XML ,
:
DTD
<!DOCTYPE
[
<!ELEMENT (, , ,
)>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
<!ELEMENT (#PCDATA)>
]
>
<>
<>
<></>
<> </>
<>240</>
<>15</>
</>
<>
<></>
<> </>
<>146</>
<>21</>
</>
<>
<> </>
<> </>
<>98</>
<>5,5</>
</>
</>
DTDs
, DTDs XML . , :
10
book.dtd,
DTD XML
<!DOCTYPE SYSTEM "book.dtd">.
DTDs ,
DTD , .
11
1.4 XML
XML, .
XML
XML Notepad. , Notepad
o :
<?xml version="1.0" encoding="Windows-1253" standalone="yes" ?>
<!-- 1 -->
<LIBRARY>
<BOOK>
<TITLE></TITLE>
<AUTHOR> </AUTHOR>
<PAGES>240</PAGES>
<PRICE>15</PRICE>
</BOOK>
<BOOK>
<TITLE></TITLE>
<AUTHOR> </AUTHOR>
<PAGES>146</PAGES>
<PRICE>21</PRICE>
</BOOK>
<BOOK>
<TITLE> </TITLE>
<AUTHOR> </AUTHOR>
<PAGES>98</PAGES>
<PRICE>5,5</PRICE>
</BOOK>
</LIBRARY>
1.xml.
XML
o XML Internet Explorer,
HTML. XML ( 1.5), Internet Explorer
, ( , )
12
. Internet Explorer
/ ,
. Internet
Explorer 1.xml .
1.6 XML .
, XML .
13
1.7 .
1.5 .
XML CSS
XML , Internet Explorer
.
.
Notepad o :
14
XML 2.css
. , XML 2.xml.
15
1.9 .
A 2.xml Internet Explorer, ,
1.10, ,
2.css.
16
1.5 XSLT
,
.
HTML (Cascading Style Sheet
CSS). T CSS
(Web Site), CSS . HTML, CSS XML .
XML, ,
(Extensible Stylesheet Language XSL).
XSL ,
XML .
XSL
CSS, XSL XML XML.
XML , XSL CSS. CSS XML, XSL
. , XSL XML
, , .
XSL
XSL XML, , CSS, (templates),
XML. XML,
XSL ,
. , :
17
, ,
:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
) XSL XML. XML
XSL , .xml) .xsl
. XSL. XML, xml-stylesheet, :
<?xml-stylesheet type=text/xsl href=FilePath?>
, FilePath .xsl , URL, , ,
XML.
18
1.11 XML.
19
1.6
A) HTML .
) :
XSL .. XML , ,
.
XML .
DTD <!..
) .
H XML
)
)
)
XML .
) DTD
b) XSL
c) CSS
) XML Notepad. ,
.
) XML ,
CSS Notepad.
XML .
.
20
, .
, :
,
HTML
Javascript
DHTML,
Javascript, HTML CSS
, HTML,
Javascript
-
, Javascript, , DOM, , , DHTML.
HTML
.
JavaScript , Javascript
. Javascript , (objects), (events)
(methods), Javascript HTML
21
2.1
HTML ,
. ,
HTML,
. HTML
, , , ( 2.1).
2.1 HTML
HTML, . , HTML , / ,
, .
, (scripting languages)
,
, , ,
, .
, ,
Javascript. Javascript,
(cascading style sheets), . , DHTML (Dynamic HTML)
,
HTML, Javascript .
22
2.2 Javascript
2.2.1
23
<html>
<head>
<TITLE> Javascript HTML </TITLE>
</head>
<body>
<script language="javascript">
document.write(" !");
</script>
</body>
</html>
Notepad test.htm,
,
.
2.2 Javascript.
Javascript , , , . , document ,
write ,
document.write(""), .
24
Javascript HTML. ,
.js,
HTML . ,
SCRIPT SRC,
HTML, ,
global.js Javascript :
<script language="JavaScript" src="global.js">
</script>
2.2.3 Javascript
2.2.2, ,
, write
document. , Javascript . ,
. document ( ),
, , ,
. Javascript
.
T
"Document Object Model" DOM 2.3.
25
2.3 DOM
Javascript :
< >.< >
, document.bgcolour (document). , . . .(). document.write(" !"),
.
DOM,
, .
window - .
(top-level object) document, location
history. ,
26
,
firstform
document.firstform
document.forms[0]. secondform document.secondform document.forms[1] .
form action, elements, encoding, forms, method, name target.
submit onSubmit.
button - (action).
27
28
reset -
.
form. name value,
click onClick.
select - (selection list) (scrolling list)
HTML . , . form. length, name, options selectedIndex, blur
focus onBlur, onChange onFocus.
submit -
action
. form. name
value, click onClick.
submit , .
text - HTML
. form.
defaultValue, name value, focus, blur
select onBlur, onChange, onFocus,
onSelect.
textarea - ,
. form.
defaultValue, name value, focus, blur select
onBlur, onChange, onFocus onSelect.
window document
. :
<html><body>
<script type="text/javascript">
document.write(" : ")
document.write(screen.width + "*")
document.write(screen.height + "<br>")
document.write(" : ")
document.write(window.screen.availWidth + "*")
document.write(window.screen.availHeight+ "<br>")
document.write(" : ")
document.write(window.screen.colorDepth + "<br>")
</script></body></html>
29
HTML,
:
2.4 Javascript.
(event handlers)
Javascript . , JavaScript
/ , .
, ()
. Javascript :
30
onBlur
, Onclick button
.
bookmark() button , onclick="bookmark()" . :
<html>
<head>
<script type="text/javascript">
function bookmark()
{
window.external.AddFavorite("http://www.livanis.gr"," ")
}
</script>
</head>
31
<body>
<form>
<input type="button" onclick="bookmark()"
value="
(bookmark favorites) ">
</form>
</body>
</html>
, :
2.5 Javascript.
2.2.5 H Javascript
, Javascript
, C, Basic, Pascal .
.
,
Javascript.
32
, (variables) , . Javascript:
.
.
.
Y=5;
=Y+10;
X=X+Y;
document.write();
.
.
.
, 5. , + 10 ,
15. , X=X+Y ,
20. , document.write();
, 20, .
, JavaScript
.
.
. , ="5"+"10";
"510", .
. .
. , .
,
. ,
33
.
Javascript :
+
*
/
%
++
-==
!=
>
>=
<
<=
&&
||
+=, -=,
*=, /=
///
.
.
JavaScript. .
34
: .
Javascript , , ,
, ,
HTML , Javascript. Javascript <D> </HEAD>
function _( )
. ,
example(), button
HTML.
<html>
<head>
<script type="javascript">
function example()
{
alert("")
}
</script>
</head>
<body>
<form>
<input type="button" onclick="example()" value=" ">
</form>
<p> button, example "".</p>
</body>
</html>
L , button , example Javascript ,
:
35
2.6 Javascript.
, :
<html>
<head>
<title> </title>
</head>
<body>
<script language=javascript>
function calculate()
{
D=document.myform.T1.value;
E=D/340.75;
document.myform.T2.value=E;
}
</script>
<form name="myform" >
<p> . :<p>
<input type="text" name="T1" size="5"><p>
<p> :<p>
<input type="text" name="T2" size="4">
<input type="button" value=" " onClick="calculate();" name="Execute" >
</form>
</body>
</html>
36
, 1 2.
1, ,
. ,
onClick calculate(), 2.
:
2.7
Javascript , :
2.8
37
. Javascript
:
if ()
{ 1}
else
{ 2}
, A . ,
, 1. , 2.
:
if (1)
{ 1}
else if (2)
{ 2}
.
.
.
else if ( n)
{ n}
,
. ,
,
.
38
<html>
<head>
<title> </title>
</head>
<body>
<script language=javascript>
function changebackground(arg)
{
if (arg==1)
{
document.body.style.background='red';
}
else if (arg==2)
{
document.body.style.background='green';
}
else if (arg==3)
{
document.body.style.background='blue';
}
}
</script>
<form name="testform">
<input type="text" name="T1" size="20" onChange="changebg (this.value)"></p>
</form>
</body>
39
2.3 H DHTML
2.3.1 DHTML
40
Athens.htm
<html>
<head>
<link rel="stylesheet" type="text/css" href="ex1.css">
</head>
<body>
<h1> </h1>
<h2> </h2>
<h2> </h2>
<h2> </h2>
</body>
</html>
Thessaloniki.htm
<html>
<head>
<link rel="stylesheet" type="text/css" href="ex1.css">
</head>
<body>
<h1> </h1>
<h2> </h2>
<h2> </h2>
<h2> </h2>
</body>
</html>
ex1.css. , Notepad, ex1.css :
Ex1.css
body {background-color: yellow}
h1 {font-size: 36pt}
h2 {color: blue}
Athens.htm Thessaloniki.htm
:
41
2.9()
2.9()
ex1.css
h1 24pt .
Ex1.css
body {background-color: white}
h1 {font-size: 24pt}
h2 {color: blue}
Athens.htm Thessaloniki.htm , .
2.10()
2.10()
,
, L
.css.
CSS
(background properties)
, , .
42
background
backgroundattachment
(fixed) (scroll)
backgroundcolor
backgroundimage
backgroundposition
backgroundrepeat
background-color
background-image
background-repeat
background-attachment
background-position
scroll, fixed
Color-rgb, color-hex,colorname,transparent
url, none
top left, top center, top right,
center left, center center,
center right, bottom left
bottom center, bottom right
x-%, y-%, x-pos y-pos
repeat, repeat-x, no-repeat
CSS
(text properties)
. , ,
, ,
..
color
direction
letter-spacing
text-align
textdecoration
text-indent
43
color
ltr, rtl
normal, length
Left, right, center, justify
none, underline, overline
line-through, blink
length
text-transform
white-space
word-spacing
(white space)
normal, length
CSS
(font family), (boldness), (size) (style) .
Font
font-family
font-size
font-sizeadjust
font-stretch
font-style
font-style, font-variant
font-weight,font-size/line-height, fontfamily, caption,
icon, menu, message-box, small-caption,
status-bar
- family-name, generic-family
/
generic
- xx-small, x-small,
small, medium, large,x-large
semi-expanded, expanded,
extra-expanded, ultra-expanded
normal, italic, oblique
44
font-variant
font-weight
(small-caps) (normal)
(weight)
normal, small-caps
CSS
,
. HTML
,
.
border
border-bottom
border-bottom-color
border-bottom-style
border-bottom-width
border-color
border-left
border-left-color
border-left-style
border-left-width
45
border-width, border-style
border-color
border-bottom-width,
border-style, border-color
border-color
border-style
thin, medium, thick, length
color
border-left-width,
border-style,
border-color
border-color,
border-style
thin, medium, thick,
length
border-right
border-right-color
border-right-style
border-right-width
border-style
border-top
border-top-color
border-top-style
border-top-width
border-width
border-right-width
border-style, border-color
border-color
border-style
thin, medium, thick,
length
none, hidden, dotted,
dashed, solid, double,
groove, ridge, inset,
outset
border-top-width
border-style, border-color
border-color
border-style
thin, medium, thick,
length
thin, medium, thick,
length
CSS
. (overlap) .
, , . margin
.
margin
46
margin-top, margin-right
margin-bottom,
margin-left
margin-bottom
margin-left
margin-right
margin-top
47
auto, length, %
auto, length, %
auto, length, %
auto, length, %
<style>
body
{
background-attachment: fixed;
background-image: url('img0.jpg');
background-repeat: no-repeat
}
</style>
) , .
,
-
48
Onclick Javascript .
, myimage
img1.jpg, :
<p align="center"><img id="myimage" onclick="changeimage()" border="0"
src="img1.jpg" width="230" height="150" /></p>
onclick changeimage Javascript, .
,
0. ,
myimage, ,
0, 1, 2. if else
O .
<script language="JavaScript">
=0
function changeimage()
{
if (==0)
{
cc=1
myimage.src="img2.jpg"
}
else {
if (==1)
{
=2
myimage.src="img3.jpg"
}
else {
=0
myimage.src="img1.jpg"
}
}
}
</script>
49
) ,
, , . ,
onmouseover Javascript bgChange,
. L
:
<table border="1" width="100%" height="34">
<tr>
<td onmouseover="bgChange('red')" onmouseout="bgChange('transparent')"
bgcolor="red" width="33%" align="center" height="28"></td>
<td onmouseover="bgChange('blue')" onmouseout="bgChange('transparent')"
bgcolor="blue" width="33%" align="center" height="28"></td>
<td onmouseover="bgChange('green')" onmouseout="bgChange('transparent')"
bgcolor="green" width="34%" align="center" height="28"></td>
</tr>
</table>
Javascript bgChange , .
function bgChange(bg)
{
document.body.style.background=bg
}
)
Mytext, onmouseover Javascrip
moveright . L
:
<h3 id="Mytext" onmousemove="moveright()">
' </h3>
Javascript position left Mytext , left,
1 .
var i=1
function moveright()
{
Mytext.style.position="relative"
Mytext.style.left=i
50
i++
}
, :
<html>
<head>
<title> HTML, CSS Javascript</title>
<style>
body
{
background-attachment: fixed;
background-image: url('img0.jpg');
background-repeat: no-repeat
}
</style>
<script language="JavaScript">
aa=0
cc=0
function changeimage()
{
if (cc==0)
{
cc=1
myimage.src="img2.jpg"
}
else {
if (cc==1)
{
cc=2
myimage.src="img3.jpg"
}
else {
51
cc=0
myimage.src="img1.jpg"
}
}
}
function bgChange(bg)
{
document.body.style.background=bg
}
var i=1
function moveright()
{
Mytext.style.position="relative"
Mytext.style.left=i
i++
}
</script>
<p align="center"> </p>
<p align="center">H<br>
( ) <br>
</p>
<p align="center"> </p>
<p align="center"> <br>
<br>
</p>
<p align="center"> </p>
<p align="center"><img id="myimage" onclick="changeimage()" border="0"
src="img1.jpg" width="230" height="150" /></p>
<p> </p>
<p align="center"> <br>
<br>
</p>
<table border="1" width="100%" height="34">
<tr>
<td onmouseover="bgChange('red')" onmouseout="bgChange('transparent')"
bgcolor="red"
width="33%" align="center" height="28"></td>
52
</body>
</html>
.htm img0.jpg,
img1.jpg, img2.jpg img3.jpg, Internet Explorer.
.
2.11()
53
2.11()
2.11()
2.11()
54
2.11()
55
2.5
)
B)
Javascript
=5;
B=A+3
If (B>=A){
C=A+B
} else{
C=A-B
}
C ;
HTML Javascript
;
DHTML
DOM
) / )
)
)
)
) HTML.
) HTML Javascript
button
,
:
= /2
)
HTML,
Javascript
.
HTML 2
Javascript, (
) (1=340.75 .).
.
56
3
: PHP
, , PHP
& MySQL.
, :
, HTML,
.
MySQL.
MySQL , , .
PHP.
PHP.
-
, , MySQL,
PHP
57
O
, , ,
,
.
, . o MySQL PHP. . MySQL
PHP
, .
58
3.1
, ,
HTML . ,
. ,
, , , JavaScript (
Internet Explorer).
, 3.1:
3.1
59
,
, :
1 : HTTP .
2 : .
3 : ,
email, (Databases) (OS Commands).
4 : To
HTML .
.
, :
. ,
.
.
.
,
.
,
,
HTML .
MySQL,
. , PHP,
, MySQL.
,
Active Server Pages (ASP) Java Server Pages (JSP), .
60
3.2 ySQL
3.2.1
MySQL
(Database). MySQL , ,
MySQL (http://www.mysql.com), . , , . MySQL (General Public Licence GPL), , http://www.mysql.com/company/legal/licensing/
3.2.2 MySQL
MySQL / (Client/Server).
, 3.2.
MySQL Server
Client
3.2 / MySQL
,
-
, -- (tables) (fields),
-- (records)
.
, MySQL SQL (
Structured Query Language). H SQL -
61
.
, MySQL, SQL Access, Microsoft SQL Server, Oracle, Sybase .
3.2.3 MySQL
MySQL ,
. , , ,
. H 3.3:
ID
2101234567
2101288888
3.3
,
(columns) (fields), .
, , ,
ID, , .
3.2.4 SQL
MySQL, (Structured Query Language) SQL. SQL (queries).
SQL
. SQL MySQL. MySQL
(database server software) , SQL .
62
3.2.5 MySQL
ySQL, , ,
MySQL, , , . MySQL Server.
http://www.mysql.com/
MySQL Server MySQL client .
,
(command line),
MySQL MySQL server. :
mysql -h <hostname> -u <username> -p
<hostname> IP MySQL server.
MySQL server, -h
<hostname> -h localhost. <username>
MySQL.
MySQL server, root, MySQL server Web host , MySQL .
-p (password),
.
, MySQL
MySQL, :
3.4 MySQL
63
, MySQL
MySQL Server,
MySQL Server. ,
server.
ENTER:
mysql> SHOW DATABASES;
MySQL server,
:
3.5 MySQL
, mySQL Server ,
mysql test Server. mysql mySQL Server ( ,
), test
.
(DataBase)
CREATE DATABASE database_name. ,
:
64
3.6
, USB database;
3.7
.
SQL (table) CREATE TABLE.
EPAFES,
:
3.8 MySQL
65
.
(column) ID (integer, INT). ,
(NOT NULL). , ,
, MySQL , (AUTO_INCREMENT). , (unique identifier)
,
(PRIMARY KEY).
:
Eponymo Onoma , (TEXT).
, Tilefono,
(NOT NULL).
, :
mysql> SHOW TABLES;
:
3.9
EPAFES.
DESCRIBE, :
66
3.10
() .
,
.
INSERT :
1 INSERT
mysql> INSERT INTO <table name> SET
-> columnName1 = value1,
-> columnName2 = value2,
-> ...
-> ;
2 INSERT
mysql> INSERT INTO <table name>
-> (columnName1, columnName2, ...)
-> VALUES (value1, value2, ...);
67
, Epafes , :
mysql> INSERT INTO Epafes SET
-> Epomymo = "",
-> Onoma = "",
-> Tilefono = "210121315";
INSERT,
.
SELECT, ,
SQL.
Epafes:
mysql>SELECT * FROM Epafes;
,
ID Eponimo, :
mysql>SELECT ID, Eponimo FROM Epafes;
68
MySQL dropping ()
, .. test, :
mysql> DROP DATABASE test;
Enter, MySQL test Query OK .
, .
MySQL,
:
mysql> DROP TABLE <tableName>;
MySQL
MySQL . ,
MySQL ;. ,
MySQL . ,
, :
mysql> SHOW
-> DATABASES;
MySQL ,
(prompt) mysql> ->.
,
\c ENTER, :
mysql> DROP DATABASE\c
mysql>
MySQL
.
, MySQL,
quit exit. ;.
69
: WHERE
WHERE SELECT,
, :
mysql> SELECT Eponimo FROM Epafes
-> WHERE Onoma = ;
"".
,
UPDATE, :
mysql> UPDATE <tableName> SET
-> <col_name>=<new_value>, ...
-> WHERE <where clause>;
, ,
EPAFES, :
mysql> UPDATE Epafes SET Tilefono="2109876541" WHERE ID=1;
ID , .
() SQL, :
mysql> DELETE FROM <tableName> WHERE <where clause>;
, EPAFES:
mysql> DELETE FROM Epafes;
70
3.2.6 PHPMyAdmin
SQL MySQL. MySQL Client
(Command Line). A
SQL , . ,
, . MySQL, PHPMyAdmin, MySQL,
www.phpmyadmin.net. H PHPMyAdmin MySQL,
PHP .
PHPMyAdmin,
.
Control Pannel, , .
3.11
71
3.12
, , :
3.13
72
,
DB WebAdmin :
3.14 DB WebAdmin
DB WebAdmin, PHPMyAdmin,
:
3.15 phpMyAdmin
73
To , . , EPAFES, 3.16.
3.17 EPAFES
74
, phpMyAdmin
, , . , phpMyAdmin MySQL .
75
3.3 PHP
3.3.1 PHP
PHP, Hypertext Preprocessor
( )
. PHP ,
.
Javascript, , PHP
HTML. PHP
, , , HTML. H
PHP (PHP parser), PHP. PHP www.php.net, ,
.
PHP , , . , PHP .
PHP , MySQL, Oracle, Informix, Sybase
.
, PHP
, .
3.3.2 PHP
, PHP. : notepad test.php
root directory web server.
76
3.1 Test.php
<?php
echo phpinfo();
?>
, Test.php .
PHP , :
3.18 3.1
phpinfo, PHP,
echo.
PHP .
PHP . A :
77
Notepad
kalimera.php root directory web server.
3.2 kalimera.php
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo "<p>"; ?>
</body>
</html>
, kalimera.php . :
3.19 3.2
78
O (Client) :
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p></body>
</html>
,
.
Server echo( ) PHP HTML.
PHP
, PHP
HTML <?php ?>. PHP , .php. .htm, o
HTML ,
. .php, ,
PHP. ,
HTML, .
3.3.3 PHP
PHP : C, C++, Java, JavaScript Perl.
PHP (commands statements), (instruction) Web server
. PHP
semicolon (;). , PHP
(Variables) (operators)
(functions).
79
PHP . $testvariable
3:
$testvariable = 3;
PHP ($).
, PHP
. PHP
Javascript . :
+
*
/
%
++
-==
!=,<>
>
>=
<
<=
&&
||
.
.
.
.
.
.
.
.
80
+=, -=,
*=, /=
///
.
, PHP
., ().
, $testvariable = . ! !
testvariable.
PHP Javascript, . PHP :
if ()
{ 1}
else
{ 2}
,
PHP.
if (1)
{ 1}
else if (2)
{ 2}
.
.
.
else if ( n)
{ n}
, PHP
. , PHP
, echo
3.2.2, ,
81
. , , , , . ,
PHP,
http://www.php.net.
, PHP
,
Javascript, . , , Enosis
. , $first $second,
,
echo Enosis($first, $second); $first $second .
<?php
function Enosis($wordA, $wordB) {
return $wordA . $wordB;
}
$first = " ";
$second = " ";
echo Enosis($first, $second);
?>
3.3.4 PP
PHP
. (server variables) PHP. , $_GET $_POST HTML ,
PHP G POST . ,
$_GET $_POST
PHP. :
82
3.3 Submitform.htm
<HTML>
<BODY>
<P> PHP
</P>
<FORM NAME='frmMain' METHOD=post ACTION="action.php">
:
<INPUT NAME=applicant TYPE=text><BR>
<INPUT NAME=enter TYPE=submit VALUE="">
</FORM>
</BODY>
</HTML>
HTML
applicant Button , POST, action.php .
3.4 Action.php
<HTML>
<BODY>
<P> <?php echo ($_POST['applicant']); ?>!</P>
</BODY>
</HTML>
, $_POST['applicant']
echo. Root Directory , :
83
3.20 3.3
3.21 3.3
84
3.22 3.4
85
3.4
)
, .
) :
.
H MySQL / (client/server).
MySQL MySQL Server.
PHP ML.
)
PHP
;
date
echo
mail
Javascript
HTML ,
, , . , PHP,
,
, , , .
http://www.php.net/manual/el,
PHP, .
, mail
. , .
, HTML, . PHP script ,
,
mail, .
86
, ,
ASP JSP.
, :
ASP, , PHP.
ASP.
JSP Javabean
JSP PHP ASP.
JSP.
-
ActiveServer Pages, VBScript, Java Server Pages, Javabean
ASP (ActiveServer Pages)
PHP, ASP Microsoft
Web IIS Microsoft.
, JSP (Java Server Pages) 87
88
4.1.2 ASP
PHP, ASP HTML,
, <% %>. , , ,
. ASP .asp.
PHP, ASP , VBScript JavaScript. ASP VBScript.
ASP.
ASP
Notepad
kalimera.asp, root directory web server.
Kalimera.asp
<html>
<body>
<%
response.write("Hello World!")
89
%>
</body>
</html>
.
:
4.1 ASP
response.write
! .
PHP, ASP , , :
<html>
<head>
<title></title>
</head>
<body>
!<p></body>
</html>
90
4.1.3 ASP
, ASP
, , , .
.
ASP PHP
. PHP,
$
, Dim,
VBScript.
Dim Pi ,
3.1415.
<%
Option Explicit
Dim Pi
Pi = 3.1415
%>
VBScript ,
,
. Option Explicit ,
. ,
ASP .
ASP
Javascript PHP, . , PHP
:
if () then
{ 1}
else
{ 2}
End if
91
, ASP
:
if (1) then
{ 1}
else if (2)
{ 2}
.
.
.
else if ( n)
{ n}
End If
PHP, ASP ,
, , , . ,
, .
, , Addition . , , .
<%
Function Addition(A, B)
Addition = A + B
End Function
%>
.
.
.
<%
Response.Write Addition(2, 3)
Response.Write Addition(5, 8)
%>
92
,
,
ASP, .
, hour (now) , .
:
Greeting.asp
<html>
<body>
<%
Dim h
h = hour(now())
response.write("<p>" & now())
response.write(" ( ) </p>")
If h < 12 then
response.write("!")
else
response.write("!")
end if
%>
</body>
</html>
greeting.asp Root Directory
, , :
4.2 Greeting.asp
93
ASP
H ASP
,
ASP. ASP
Response, Response.Write
. ASP
:
Application
Response
Request
Server
Session
.
.
.
.
,
.
,
, Response Request,
HTML.
4.1.4 ASP
Request.QueryString ASP HTML. . , ML .
Form.htm
<html>
<body>
<form action="form_action.asp" method="get">
, :
<input type="text" name="fname"><br><br>
<input type="submit" value="Submit">
</form>
94
</body>
</html>
, form_action.asp, action. To
:
Form_action.asp
<%
If Request.QueryString("fname")<>"" Then
Response.Write (" o " & Request.QueryString("fname") & "!")
Response.Write ("<br> ;")
End If
%>
, Request.QueryString("fname") fname L. ,
, .
Root Directory ,
Form.htm , :
95
4.3
Submit,
:
4.4
96
4.1.5
A) .
.. ASP .
. ASP.
ASP
.
B) .
O s ASP
) <% %>
) <! !>
) <* *>
)<@ @>
ASP
) Request.QueryString
) Response.Write
) Server.CreateObject
) ASP
:
.
.
ASP ,
.
) HTML ,
, ,
. , ASP,
,
,
. , ,
97
4.2 JSP
4.2.1
JSP (Java Server Pages) , Sun Microsystems Java. PHP ASP, JSP HTML,
Java,
.
, JSP, ,
, PHP ASP,
. , JSP Sun Microsystems ASP Microsoft. , ASP Web Server
Microsoft, JSP , UNIX.
JSP , PHP ASP
. .
4.5 JSP
, JSP JSP
(JSP Servlet Engine) . HTML .
98
, JSP
Microsoft (.. IIS), UNIX (.. Apache).
JSP Servlet Engine, JRUN omcat. JSP
,
JSP .
, JSP
JSP .
4.2.2 JSP
JSP, , PHP ASP. :
kalimera.jsp
<HTML>
<BODY>
<% out.println(""); %>
</BODY>
</HTML>
kalimera.jsp, ,
:
99
4.6 kalimera.jsp
, JSP
,
PHP ASP. E,
out.println("")
ASP Response.Write Response, PHP
echo().
JSP, .
4.2.3 (tags), (directives) (Objects)
JSP
, JSP . JSP
, JSP,
HTML. JSP
:
Declaration
<%! %>
Expression
<%= %>
100
Directive
Scriptlet
Action
<%...%>
<jsp: />
JSP Servlet Engine
JSP
, JSP (directives).
JSP
JSP. , <%@ page language="java" %> page language
JSP. page, JSP include taglib.
:
Page
Include
Taglib
JSP, ,
, (buffering) .
JSP JSP
.
,
. JSP
taglib.
, JSP ,
. ASP,
.
Request
Response
Out
Session
Application
.
Server
HTML .
,
.
.
101
Page
Config
Represents the JSP page and is used to call any methods defined by the servlet
class.
.
4.2.4 : Javabean
PHP ASP ,
,
. , .
:
, , . JSP, .
JSP,
JavaBeans. JavaBeans
JSP
. JSP . JavaBeans JavaBean
,
JSP , JavaBean .
JavaBeans . , JSP . PHP ASP,
JavaBean. JavaBean
:
Namehandler.java
package kalimera;
public class NameHandler {
private String username;
public NameHandler() {
102
username = null;
}
public void setUsername( String name ) {
username = name;
}
public String getUsername() {
return username;
}
}
, JavaBean NameHandler,
kalimera, public class NameHandler package kalimera, . kalimera JavaBeans.
JavaBean NameHandler username private String username. , setUsername getUsername, , , username.
O, JavaBean
, .
, .
main.jsp
<%@ page import="kalimera.NameHandler" %>
<jsp:useBean id="abean" scope="page" class="kalimera.NameHandler" />
<jsp:setProperty name="abean" property="*" />
<html>
<h1> . ;</h1>
<form method="get">
<input type="text" name="username" size="25">
<br>
<input type="submit" value="">
<input type="reset" value="">
</form>
103
<%
if ( request.getParameter("username") != null ) {
%>
<%@ include file="response.jsp" %>
<%
}
%>
</html>
, JavaBean namehandler. . , action,
response.jsp,
<%@ include file="response.jsp" %>
response.jsp, ,
JavaBean
.
response.jsp
<html>
<table border="0" width="700">
<h1>, <jsp:getProperty name="abean" property="username" />!
</h1>
</html>
Root Directory ,
main.jsp ,
:
104
4.7
, :
4.8
105
4.2.5
) .
) .
O s ASP
) <% %>
) <! !>
) <* *>
) <@ @>
O s JSP
) <% %>
) <! !>
) <* *>
) <@ @>
ASP
) Request.QueryString
) Response.Write
) Server.CreateObject
JSP
o
) Request
) Response
) Session
)
4.1.4, JSP.
, ASP JSP, ;
) , , 20 . ,
. ,
:
)
) PHP
) ASP
) JSP
) ( )
, .
106
: , .
, (scripting languages)
.
.
(Extensible Markup Language - XML) , .
,
.
XML
: .
XSL XML.
(event handlers) Javascript .
107
108
XML
HTML
XML
DTD
Document Type Definition
XSLT
2, 5
. XML
2, 12, 17, 20, 30, 35
3
3
5
8, 20
. DTD
17
22, 89, 107
Javascript
CSS
DHTML
Dynamic HTML
DOM
Document Object Model
Event Handlers
MySQL
SQL
Structured Query Language
PHPMyAdmin
PHP
phpinfo
echo
server variables
ASP
IIS
VBScript
JSP
Java
Servlet Engine
Apache
JRUN
omcat
Javabean
22, 30, 40
14, 40
40, 56
. DHTML
23
25, 26, 94, 100
25, 40, 56
. DOM
30, 107
32, 107
33, 79, 80, 91, 93, 107
33, 79, 80, 91, 93, 107
34, 81, 92, 93
38, 81, 92, 93
61,
62
. SQL
45, 62
71
76
77
77, 79, 81
82
89
89, 99
40, 89, 91
98
23, 98
98, 101, 106
99
99
99
100
100
102
109
110
T. Converse, J. Park, C. Morgan, PhP5 and MySQL Bible, Wiley, 2004.
S. Koch, Javascript, Wiley, 2003.
Arciniegas, Fabio, XML Developpers Guide, McGraw-Hill, 2001.
, - /, .
Manas Tungare, A practical guide to Microsoft Active Server Pages 3.0, Manas Tungare, 2001.
H Javascript, .
. , . , . , . , , , / / , 1999.
D. Goodman, Javascript and DHTML Cookbook, O'Reilly, 2003.
VisualBuilder JSP Tutorial, VisualBuilder, 2001 (on-line: http://visualbuilder.com)
H. Bergsten, JavaServer Pages 2nd Edition, O'Reilly, 2002.
R. Lerdorf, K. Tatroe, Programming PHP, O'Reilly, 2002.
- http://dide.flo.sch.gr/Plinet/plinet.html
111