1.
: , array().
array():
$massiv = array('one','two','three');
:
$new_massiv = array('name' => 'nobody', 'email' => '[email protected]');
=>. :
<?php //pr45
$massiv = array('one','two','three');
$massiv[5]="5";
$massiv[6]="6";
$massiv[]="7";
print_r($massiv);
$new_massiv = array('name' => 'nobody', 'email' => '[email protected]');
print_r($new_massiv);
print $new_massiv['name']
?>
1.1. *. * .
1.2. n , - @. , .
1.3. HTML , <>
1.4. . Shuffle(array arr); arrayrand(array arr, int num);
1.5. : , , , . .
1.6. : , , . .
2.
:
function fname ($arg_1, $arg_2,..., $arg_n)
{
echo " \n";
return $val; //
}
return , .
<?php //pr11.php- , // m //
$m=rand(10,150); // m
print "m=$m<br>";
for($i=1;$i<$m;$i++)
{$k=f($i);
if($k!=0)print "$k<br>";
}
function f($n)
{$l=$n;
do
{
if(($l%10)==9)return $n;}
while(($l/=10)!=0);
return 0;
}
?>
2.1. n .
2.2. n .
2.3. ,
<?php
if((date(G) >=5)AND(date(G) <= 11))echo Good Morning!;
if((date(G)>=12)ANDdate(G)<=18))echo Good Afternoon!;
if((date(G) >= 19)AND(date(G)<= 4))echo Good Evening!;
?>
3.
, , .
:
|
|
int fopen (string filename, string mode [, int use_include_path]). , filename, (). mode, :
"r" - . "r+" - . .
"w" - . . , 0. , . "w+" - . . .
"a" - (). . , . "a+" - . fopen()
$fp = fopen ("/home/a/bases.dat", "r");
$fp = fopen ("/home_dir/client/count.txt", "w+");
$fp = fopen ("http://www.yahoo.com/", "r");
fopen() "" , false.
URL- $ filename fopen (). , , , Web- FTP-.
: bool fclose ($fp).
URL, (, ), urlencode (). urlencode () (URL, ) URL. fn()
<?php
/* */
$fr = fopen("myfile.txt", '');
/* / */
$fr = fopen("myfile.dat", 'ba+');
/* / ( ,
include_path)*/
$fr = fopen("code.php", 'w+', true);
/* index.php, HTTP */
$fr = fopen("http://www.php.net/index.php", '');
/* index.php, FTP */
$fr = fopen("ftp://ftp.php.net/index.php", '');
/* URL, HTTP */
$url = "http://www.php.net/this is my invalid URL.php";
$url = urlencode($url);
$fr = fopen($url, 'r');
?>
: fgets (), , fputs (), .
: string fgets ($fp, $length). length-1 , $fp. length-1 , ( ), .
, :
|
|
<? //pr415
$fp = fopen ("pr415.php", "r");
while (!feof ($fp)) {
$stroka = fgets ($fp, 80);
echo $stroka."<BR>";
}
fclose($fp);
?>
HTML- : string fgetss ($fp, $length [, string allowable_tags]). fgets(), : HTML-, . , , .
fgets () fscanf ().:
fscanf ($filename, $format, $var_one [, $var_two...]]])
$filename , $format , $var_one, $var_two , ( ). fscanf () , false.
fputs () ( ) : fputs($filename, $data [, int $length]), $filename , $data , $length .
, .
1. . $. 60- , .
2. , , , . , ( ).
3. - ( ). , , ( ) . (, ) .
4. , 80- , 8 . , 1. . .
5. 60- , : $ ; # ; @ . , .
6. . , 80- ; .
7. ( 80 ) . ( ), .
8. . . , (, , , , . .). .
9. (, , , . .). . , .
12. .
13. , . , . $. .
|
|
14. , . , ( ) ; .
15. , , . , , , .
16. IP- S Server[΄Remoute_ADDR΄]. (, ).
17. IP-. IP-, . IP- .
18. ($_SERVER[΄SERVER_NAME΄]) ($_SERVER[΄PHP_SELF΄]), .
19. , ($_SERVER[΄HTTP_REFERER΄]).
20. , , , : ($_SERVER[΄HTTP_USER_AGENT΄]), ΄DownLoadMaster΄, ΄FlashGet΄ .
21. , HTTP- $_SERVER[΄HTTP_ACCEPT_LANGUAGE΄].
4.
. .
:
( ) , ;
. . .
;
;
(XHTML, JSP ..) ;
.
1. . , , .
:
- ;
- ;
- ;
- , .
:
- ;
- .
, .
, .
, 2- .
, .
, 2- .
2. . .
:
- ;
- ( );
- , .
:
- ;
- -, ;
- ;
- .
, .
, .
|
|
, .
, .
.
3. . .
:
- ;
- .
:
- ;
- ;
- ;
- ;
- .
, .
, .
, .
, .
.
4. . .
:
- ;
- ;
- ;
- .
:
- ;
- .
.
, .
, 1000.
, .
.
5. . .
:
- ;
- ;
- .
:
- ;
- .
:
- ;
- ;
- .
.
, 100 1.
, .
, .
, , .
, .
6. . .
:
- ;
- ;
- ;
- .
:
- ;
- ;
- .
:
- ;
- .
.
, , -10.
, .
1000.
7. . .
:
- ;
- ;
- ;
- .
:
- ;
- ;
- .
, .
, .
.
.
8. . - , . () . () .
9. . : - -. . .
10. . . Blob. .
?
?
?
5. WEB-
HTTP
HTTP , Web-, -, HTTP-. :
GET-. HTTP, GET. , Web- URL-. HTTP , GET , .
|
|
POST-. Web-, POST. , Web- Web-.
HEAD-. URL, URL, HEAD.
GET URL, POST . JavaScript, PHP.
HTTP Firefox, HttpFox .
HttpFox localhost.
HTML-
PHP HTML. , . . , .
, , HTML- <form...> n</form>. , , , , checkbox, jpg gif. . PHP.
, <form...> - . , , , , , , , . , web-, .
- php.ini - register_globals on, , , - : - , checkbox - True False , - . , , , $_POST_ $_GET. <input type=text name=myname size=30> $_POST['myname']) $_GET['myname']). , GET , POST - . $_POST $_GET , , . . . , PHP register_globals off . PHP: $_GET[], $_POST[], $_REQUEST[], $_COOKIE[], $_FILES[], $_SERVER[], $_ENV[], $_SESSION[].
.
PHP , . :
<form name="_" action="__"
method="__ GET POST ">
...
</form>
- , . , name . :
<form action="action.php" method="POST">
: <input type="text" name="name" />
: <input type="text" name="age" />
:<input type="text" name="password" />
<input type="submit">
</form>
submit, action.php. :
<html><body>,
<?php
echo $_POST["name"];
?>.
<?php echo $_POST["age"];?> .
:<?php echo $_POST["password"];?>
</body></html>
:
, . 20 . :******
- POST. The $_POST["name"] $_POST["age"] PHP. GET, $_GET. $_REQUEST, . GET, POST, COOKIE FILE.
GET
GET . : , URL ( , ), name=value , & (). :
http://site.domain/action.php?=&=
"=" , NAME.
, . 254 . GET, .
, PHP , GET, . , . $name "", $name, "".
, , , . - .
URI:
<!pr421.php -->
<html>
<head> </head>
<body>
<?php //
$a =$_GET['a'];
$b =$_GET['b'];
$c++;// on . $ =$_GET[''];
echo "a=$a,b=$b"; //
print "<br>c=$c";//
echo "<br> <a href='pr421.php?a=1&b=2&c=3'> </a>"
?>
</body>
</html>
:
http://localhost/MyPrimers/pr421.php?a=10&b=20&c=30
a=10,b=20
c=31
,
a=1,b=2
c=4
GET
<html><head>
<title>Simpleform.html </title>
</head>
<body>
<form action="form.php" method="GET">
:<input type="text" name="fio"><p>
<input type="submit" value="GO"><p>
</f orm>
</body>
</html>
<?php //form.php
echo "Hello, $fio<br>";
foreach($_GET as $fio=>$value);
echo "$fio=$value<br>";
print_r ($_GET);
print_r ($_REQUEST);
?>
:
Hello,valera
fio=valera
Array ([fio] => valera) Array ([fio] => valera)
POST
POST, GET, . , .
? . , , POST. , , ( - -), GET.
, PHP . :
<form action="formmail.php" method="post">
:
<input type="text" name="user[name]"><br>
:
<input type="text" name="user[email]"> <br>
:
<textarea name="user[message]"></textarea><br>
<input type="submit" value="">
</form>
$user, .
web :
Admin, , , , , , , , , , , , , , , , , , , , , , , , / ..
. . JavaScript PHP.
a) b) MySql.
1. . .
2. Send Mail. e-mail. E-mail . :
- .
- e-mail.
- .
- .
3. . e-mail , .
4. SMS - . .
5. ICQ - .
6. .
7. . : , , , E-Mail, login.
password. password E-Mail.
8. (, , ..).
9. Counter .
10. HTTP .
: . .
11. web-counter. RAMBLER:TOP100. : . - web-couter-. .
.
12. . , IP- , .
13. on-line .
14. .
- :
- e-mail:
- :
- :
- :
-
: , , . .
, , .
:
1.
2. .
3. .
4.
15. .
:
?
.
.
.
.
.
:
1) .
2) ( , , , ).
3) .
4) - ( ).
5) - , . , . .
16. , .
17. .
18. FTP PHP. FTP. . FTP-. FTP-.
19. .
20.
21. .
. : , E-MAIL, , , . : , ( ), ( ), ( ..).
22. .
23. . .
24. .
25. Forum & FAQ.
.
:
|ID_user|User_pass|User_Name
:
|ID_forum|Forum_name
|ID_theme|ID_foruma|ID_Autor|theme_name|theme_text
:
|ID_post|Post_data|Post_autor|Post_text|
26. PHP: , .
27. Cookie. cookie. cookie. cookie. cookie.
28. . . .
cookie. .
29. cookie.
30. text translite.
31. .
32. .
33. .
34. .
35. .
36. web-.
( Altavista) , . - . , *.
37. : (A,B,C).
38. .
39. .
40. .
41. , .
42.
43.
44.
45. FTP-
46. IRC
47. - . : , , . .
48. . :
-.
49. - (). :
html- CURL ( post- )
(NegExps)
50. ( PHPbb ).
51. ( ).
52. Tug PageRank .
53. , . ( Whois) .com;.info.
54. Http-. http, socks proxy.
55. (, IP ) , .
56. cookie & session: , , .
57. ?
58. .
59. -.
60. .
61. ( ).
1. - . . . .. .. .: , 1990, 504 .
2. Halsall F. Data communications, computer networks and open systems. Addison-Wesley publishing company, 1992, 772 pp.
3. Santifaller M. TCP/IP and ONC/NFS: internetworking in a UNIX environment. Addison-Wesley (Deutschland) GmbH, 1994, 288 pp.
4. . Java: :. . - .: BHV,1997.-320.
5. , , . Java. :. . - . , 1996. 736 .
6. ., . Perl: :. .- .: , 2000. - 736.: .
7. . Perl: :. . - .: , 2000. - 496.: .
8. , . JDBC: Java :. . .,1999.-320.
9. . Java: . - .: , 1998. -448.: .
10. http://www.citforum.ru
11. http://www.xpoint.ru
12. http://www.by.iatp.org.ua
13. http://phpclub.unet.ru
14. http://www.webmasteram.ru
15. http://kek.ksu.ru
16. http://inftech.webservis.ru
17. http://dit.vov.ru
18. http://chip.ua
19. http://www.adobe.com/support/dreamweaver/
20. " Adobe Dreamweaver CS4: System Requirements and languages ". "Adobe Dreamweaver CS4: ". http://www.adobe.com/products/dreamweaver/systemreqs/.
21. www.adobe.com, www.adobe.com/ru
WEB 2.0 .
1. http://wikipedia.org/
2. http://livejournal.com/
3. http://del.icio.us/
4. http://www.ebay.com/
5. http://www.craigslist.org/
6. http://www.skype.com/
7. http://www.google.com/adsense
8. http://netvibes.com/
9. http://maps.google.com/
10. http://habrahabr.ru/
11. http://digg.com/
12. http://www.backpackit.com/
13. http://www.basecamphq.com/
14. http://sourceforge.net/
15. http://youtube.com/
16. http://imageshack.us/
17. http://news.yandex.ru/export.html
18. http://web2.ajaxprojects.com/
Google Maps Google-
Gmail Google-
Flickr -
del.icio.us
Netvibes
Digg.com
Pligg 2.0 CMS
Quintura
Live Journal
Youtube
MySpace
Last.fm