You are on page 1of 153

Arab British Academy for Higher Education.

PHP

1
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP Course

PHP

Windows XP PHP
PHP 4.4.2 IIS

PHP

PHP

PHP

PHP

2
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

HTML

! ..
:
:

)(
)(

!
) (:

HTML .

.
:HTML Hyper Text Markup Language

. .

3
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


4.30

.
.

HTML

PHP, ASP

: DHTML Dynamic Hyper Text Markup Language


.
.HTML

. .

4
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:ActiveX Controls

C++ .

. :
. .HTML

CGI: Common Gateway Interface

. !

CGI

CGI .


.
ASP: Active Server Pages

. .PHP
PHP HTML

5
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

).(IIS, PWS

:JSP Java Server Pages


. .

. .jsp

) (
.

:ColdFusion PHP

.
) . (Allaire .

.
.

6
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

.
.

.
:Perl ) . (Larry Wall

. C, sed , :
awk .

php .
PHP

:PHP

) (Rasmus Lerdorf

.
Personal Home
) (PHP = Personal Home Pages

7
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP
Rasmus Lerdorf

2001

http://www.php.net/usage.php

open source

PHP Personal Home Page

hyper text preprocessor .

HTML

Compiler
.HTML

Compiler

Server .
Apache

Microsoft IIS .

asp perl java server .Cold fusion


8
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP :
PHP
C

Perl
.
PHP

C Java Perl

PHP


PHP

PHP CGI

PHP IIS
ISAPI

Apache
Apache

Apache
UNIX

PHP

PHP

.
PHP

FTP PHP
9
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

MySQL PostgreSQL MS SQL Oracle


XML
FTP

Flash
.

PHP

PHP PHP


Windows IIS

Apache

PHP

PHP .

PHP C

PHP
C
10
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

.XML

11
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

Windows XP PHP
PHP HTML

PHP
Plain Text Notepad

PHP

HomeSite

Notepad PHP
Notepad


53

Notepad .. 53

652

Notepad
Notepad .

PHP
PHP

.php

12
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP :

Windows .
Control Panel Add or Remove Programs

Internet Information Services

Internet

Information Services


Frontpage

2000 Server Extensions


13
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

.
C
Inetpub . wwwroot

Internet Explorer http://localhost/


wwwroot

14
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

Lan Settings

15
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP 4.4.2IIS
asp

Access PHP 4.4.2 :


:

http://www.php.net/distributions/php-4.4.2-installer.exe

php-4.4.2-installer.exe

16
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

17
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:Next Standard

: Browse

18
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:Next

:Next

19
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

Windows Xp 4 .Next

...

Next .

20
www.abahe.co.uk

Arab British Academy for Higher Education.

21
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP Course

PHP :

.PHP 4.4.2 :

?<
;)(Echo phpinfo
>?
phpinfo.php :

!!..
:

http://localhost/phpinfo.php
:

22
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

php.ini
php .
4.4.2 .

:
?<
;"echo "Welcome Azzam
>?
.php 1.php
:

http://localhost/1.php
:
23
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

.PHP

24
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

APPSERV
APPSERV :
http://prog.arccn.net/modules.php?name=Downloads&d_op=getit&lid=3

25
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:www


...

.... PHP

).(PHP 4.4.2

26
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP
HTML
JAVA


...

PHP
:
>? php ?< > <BODY html
<?php

>?
>? ?<
php

.xml
:

> "<script language="php


;echo 'Hi Its My First Page in PHP
></script

PHP HTML HTML

HTML.

27
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP

PHP

php html

.html

php
php php3 .phtml

request ) (

) response(

) (compile

)(client to server
.

) ( .

28
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:
);(

if

while

);(
.

29
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP
.

)( .

! PHP

$ name
)( :

;"" = $name
PHP


)( )( )_( .
:
>"<html dir="rtl
?<
;" " = $name
;echo $name
>?

30
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

Text Numbers

) (Counter ) (20:

?<
;$Counter = 17
>?

.
:

255

PHP

15

) ( )_(
Underscore $ .

)_(

) (/ , * , - , + &
.

) ($Name ) (name$
N

31
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


) ($counter

) .. ($user .
:

) (echo ) (print :

?<
;"$name = "Azzam
;echo $name
>?
) (Azzam ) ($name
.

32
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

1.php .
.C:\Inetpub\wwwroot :
:
?<
;$Counter = 20
;Print $Counter
>?

33
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP

PHP

: = , string = integer

= , Double , Boolean = , array = .object

.
.

:
" "

?<
;"$name = "Ammar
;"$number = "5.5
>?

:

?<
;$total = $name . $number
>?

34
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

total$
) ($space
:

?<
;" " = $space
;$total = $name . $space . $number
>?
:
?<
;"$name = "Ammar
;"$number = "5.5
;" " = $space
;$total = $name . $space . $number
;Print $total
>?
:

?<
;"$name = "Ammar
;"$number = "5.5
;$total = $name . " " . $number
;Echo $total
>?

35
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP

$ .

;) gettype($var
. :

?<
;"$name = "Ammar
;$number = 5.5
;)Print gettype ($name
;">print "<br
;)print gettype ($number
>?

) (Integer)
(Double :
?<
;$integer1 = 233
;$integer2 = -29
;$double1 = 5.27
;$double2 = -4.6
>?

36
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

):(Numeric
PHP

.
:
:

1+1

1-1

2*3

6/2

10%3

=+

$x +=5

$x = $x + 5

=-

$x -=5

$x = $x - 5

=*

$x *= 5

$x = $x * 5

=/

$x /= 5

$x = $x / 5

=%

$x % = 5

$x = $x % 5

++

$x++

$x = $x + 1

--

$x--

$x = $x - 1

37
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


:
?<
;$x = 7
;$y = 3
//
$a = $x + $y;//
$b = $x - $y;//
$c = $x * $y;//
$d = $x / $y;//
$e = $x % $y;//
;Print $a
;">print "<br
;Print $b
;">print "<br
;Print $c
;">print "<br
;Print $d
;">print "<br
;Print $e
;">print "<br
>?
:

38
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
<?
$x = 7;
$y = 3;
//
$a = $x + $y;//
$b = $x - $y;//

$c = $x * $y;//
$d = $x / $y;//

$e = $x % $y;//
Print $x."+". $y. "=" .$a;
print "<br>";
Print $x."-". $y. "=".$b;
print "<br>";
Print $x."*". $y. "=".$c;
print "<br>";
Print $x."/". $y. "=".$d;
print "<br>";
Print $x."%". $y. "=".$e;
?>

39
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


1 :

?<
;$counter = $counter + 1
>?
) ( counter$ 1

?<
;$counter = $counter++
>?

40
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

++ ) ( 1 --
1 .
) (
:

?<
;$counter +=4
>?
4
.

41
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

==

=!

===

>

=>

<

=<


||

true || false

true

OR

true true OR false

&&

false true && false

AND

false true AND false

xor
!

xor true xor true

42
www.abahe.co.uk

!true

false
false

Arab British Academy for Higher Education.

PHP Course

8 + 4 12

2 * 8 + 4 20



.

) (

)++ , -- , (cast
/,*,%
+,> < , <= , => ,
=! = = , = = = ,
&&
||
== , += , -= , /= , *= , %= , .
AND
xor
OR

43
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


).define ('var' , value

$
PHP

...

Variables :

?<
;)(phpinfo
>?

44
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:isset :
?<
;)echo isset($age
>?
1 ) ( $age

0
.

:unset :
?<
;)unset($age
>?
) (age$ .
:empty isset :
?<
;)echo empty($age
>?
1 ) ($age
0 ) ( ) ($age
.

45
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP

....
.

PHP .
.

)( date
.

:
;)date(string format
:
?<
;)'echo date('jS F Y
>?
:

.
:

am , pm

46
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

AM , PM

01 31

mon sun

September

12

1 12

24

0 23

12

01 12

24

00 23

00 59

, 1 0

1 31

Monday

, 1 0

01 12

Jan

1 12

00 59

TH , ST , ND

28 31

1970 UNIX
TIME STAMP

Sunday => 0 , Saturday


=> 6

99 , 98 , 05

2000 , 2005

0 365

)( getdate :

47
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

UNIX TIME STAMP

:
key

value

seconds

minutes

hours

mday

wday

mon

year

yday

weekday

month

48
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

?<
;)"Echo gmdate ("M D Y
>?

:

?<
)"Echo gmdate ("D, d M Y H:i:s
>?

49
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

. IF


.
:
:IF

) ( IF condition is true
{
) ( excute this code
}
PHP { } .

;IF condition is true excute function


{ }
.

50
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

)(1
?<
;""=$mood
)""==if($mood
{
"print
;"
}
>?
)==(

)=(
)=( )==(

. .
)(2

?<
;$S=20
;if ($S=20) echo 15
>?

echo Print

51
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:ELSE
IF ELSE
... ...
:
If condtion is true
{
Excute code
}
Else
{
Excute other code
}

.

:
?<
;$age=12
)If ($age>18
{
;" " echo
}
else
{
;" " echo
}
>?
.18

.18

52
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

?<
;$age=22
)If ($age>18
{
;" " echo
}
else
{
;" " echo
}
>?
:
If condtion is true
{
Excute code
}
Elseif
{
Excute other code
}
Else
{
Excute other code
}


. else

53
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
<html dir="rtl">
<?
$mood=";"
if($mood==")"
{
print"
";
}
elseif ($mood==")"
{
print";"
}
else
{
print" $mood";
}
?>
$mood=" ;"

54
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:
?<
;"$h="Azzam
;$f=64
)"If ($h == "Azzam
){ If ($f== 64
{
;" " echo
}
else
{
;)" "( echo
}
}
{ else
; " " echo
}
>?
.

55
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


... :

while

do - while
FOR

while
WHILE
1 5
100...

WHILE :
?<
;$x=1
)while ($x<=5
{
;)echo ($x
;)">echo ("<br
;$x++
}
>?
1 100
!!...
.
?<
56
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

;$x=1
)while ($x<=100
{
;)echo ($x
;)">echo ("<br
;$x++
}
>?

:
: 1 x
x 100


.
:
1 100 :

?<
;$x=1
;$total = 0
)while ($x<=100
{
;$total = $total + $x
;$x++
}
;"" echo
;)">echo ("<br
;echo $total
>?

.
do - while

57
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

Do
{
;do this code
}
;)while (expression
:
?<
; $f=15
do
{
;echo $f
;$f++
}
; )while ($f < 10
>?

$f ..

58
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:FOR

.
:

; set counter ; test value For (counter

)
{
code
}

:
?<
)For ($u = 18 ; $u>10 ; $u--
{
;"echo $u."\t\t
}
>?

....


59
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

)
(

php $u

18

$u $u
9 PHP

60
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP
php html php

GD

) .(GD Library JPEG GIF

.PNG .
:JPEG

) .(Joint Photographic Experts Group

.
:PNG
) (Portable Network Graphics
GIF .GIF

PNG .GIF
:GIF

) (Graphics Interchange Format


.

61
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

4 PHP
.1

.2

.3
.4

:
<?
$height = 200;
$width = 200;
$image = ImageCreate ($width , $height);
$white = ImageColorAllocate ($image , 255,255,255);
$black = ImageColorAllocate ($image , 0 , 0 , 100);
@imageFill ($image , 0 , 0 , $black);
@imageLine ($image , 0 , 0 , $width, $height , $white);
@imageString ($image , 8 , 50 , 150, 'Azzam', $white);
header ( 'content-type: image/png' );
@imagepng ($image);
?>

62
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

ImageCreate

ImageCreateFromPng ImageCreateFromJpeg

ImageCreateFromGif
.

ImageColorAllocate 4

;)$white = ImageColorAllocate ($image , 255,255,255


;)$black = ImageColorAllocate ($image , 0 , 0 , 100

:
. :
;)@imageFill ($image , 0 , 0 , $black
;)@imageLine ($image , 0 , 0 , $width, $height , $white
;)@imageString ($image , 8 , 50 , 150, 'Azzam', $white

ImageFIll 4 :

ImageLine 6 :

ImageString 6 :

.
63
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

HTML
.Header

;) 'header ( 'content-type: image/png

ImagePng
ImageJpeg ImageGif :

;)@imagepng ($image

64
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

)(

JavaScript ASP . php

. FORMS

) (name

) (submit
ACTION

php
:

ACTION METHOD

:ACTION

. php

>"<FORM ACTION ="TEST.PHP


..
></FORM

65
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:METHOD

GET.POST

>"<FORM ACTION ="test.php" METHOD = "GET

>"<FORM ACTIN = "test.php" METHOD ="POST


:

) (CONNECT;HEAD;OPTIONS:DELETE:TRACE
.

GET

-1 .

-2 .

-3 .

http://localhost/test.html?name=value
) (
) (name ).(value

) (name ) (value )&(.


:
66
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

http://localhost/test.html?animal=cat&age=30
) (query String
.

) (name

) .(PHP

POST get
body http response
.GET

GET :POST
GET POST
:
POST .GET
POST .GET
GET , POST
google yahoo msn.

67
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course


) ( )
) (

) (
.

><INPUT
TYPE= type - 1

.
NAME= name - 2

.
VALUE= value - 3

.
:
><INPUT TYPE= type NAME= name VALUE= value other attribute

SUBMIT RESET
-1 submit .

-2 reset

68
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

HTML
.

.
>"<html dir ="rtl
>"<FORM METHOD = "GET" ACTION= "edu.php

><br
>"" = <INPUT TYPE = "text" NAME = "education" value
><br
>""=<INPUT TYPE= submit VALUE
>""=<INPUT TYPE= reset VALUE
></form
></html

. HTML ). (edu1.html
:

>"<html dir ="rtl


<?php
;""."$education " Echo
>?

. php .edu.php

!!...

http://localhost/edu1.html :
:

69
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course


> <FORM

ACTION=edu.php

70
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

INPUT
TYPE=text
:

"" =Value

education
:

TYPE = SUBMIT
"" = VALUE

Type = reset
"" = Value

ACTION

.education .echo

><TEXTAREA
></TEXTAREA
rows
.cols
71
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

.
<html dir="rtl">
<form action="2.php" method="GET">
<h3>
<input type="text" name="user">
<br>< p>
<textarea name="address" rows="5" cols="40">
</textarea></h3>
<br>
<input type="submit" value=">"
</form>
</html>
22.html

:
<html dir="rtl">
<body><h2>
<?
print"
<b>$user</b><P>";

print" :<P><b>$address</b>";
?>
</body>
</html>
2.php
http://localhost/22.html .

72
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

73
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

> </p ><html dir="rtl" align="center"><p


>"<form method="POST" action="quiz2.php
><input type="text" name="name" size="20"><br
>"></p"=<input type="submit" value
></form
quiz.php

74
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
>"<html dir ="rtl
?<
{ ))If (isset($name
; " ." ". $name " Echo
' Echo
><br
>"<form method="POST" action="quiz3.php" dir="rtl
>"<input type=hidden name = thename value = "$name
> </p

> </p >"" name="khlifa "=<p dir="rtl"><input type="radio" value


></p >"" checked name="khlifa "=<p dir="rtl"><input type="radio" value
></p >"<p dir="rtl

></p "< "=<p dir="rtl"><input type="radio" name="faroq" value


></p >" checked"=<p dir="rtl"><input type="radio" name="faroq" value
>"" dir="rtl" = <input type ="submit" value
; '></form
}
else
{
; " " echo
}
>?

quiz2.php



quiz3.php

75
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

<html dir="rtl">
<?
If ((isset($thename)) && (isset($khlifa)) && (isset($faroq)))
{
Echo "" ." ";
$range=0;
$co = 0;
if ($khlifa =="{ )"
$range=$range+10;
$co = $co +1;
}
if ($faroq ==")"
{
$range=$range+10;
$co=$co+1;
}
if ( $range < 10)
{
echo ";"
}
else
{
echo "<br>"." "= . $co ;
echo "<br>" . " " . $range ;
}

}
?>

:
76
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:check.htm
<html dir="rtl">
<FORM ACTION="CHECK.PHP" METHOD = "POST">
) )
<br>
<INPUT TYPE="CHECKBOX" NAME = "academy[]" value= ""
CHECKED>
.
<br>
<INPUT TYPE="CHECKBOX" NAME = "academy[]" value= "> "

<br>
<INPUT TYPE="CHECKBOX" NAME = "academy[]" value= ""
CHECKED>

<br>
<input type= submit value = ">"
</FORM>
</html>

:check.php
<html dir="rtl">
<?
77
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

Echo "$academy[0] <br>" ;


Echo "$academy[1] <br>" ;
Echo "$academy[2] <br>" ;
?>
</html>

78
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:(Lists Or drop down menus)

< select> : html

MULTIPLE < OPTION>


. NAME
:

:test.htm
<html dir="rtl">
<form action = "test.php" method = "post">

<br>
<select name = "city">
<option> < /option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
</select>
<BR>
!!
<Br>
<select name="dis[]" multiple>
<option></option>
<option></option>
<option>< /option>
<option></option>
<option>< /option>
<option>< /option>
<option>< /option>
<option>< /option>
</select>
<br>
<INPUT TYPE=SUBMIT VALUE=">"
</html>

:test.php
79
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

<html dir="rtl">
<?
Echo " " . " " .
$city;
Echo "<br><br>";
Echo ";"
Echo "<br><br>";
Echo "$dis[0] <br>";
Echo "$dis[1] <br>";
Echo "$dis[2] <br>";
Echo "$dis[3] <br>";
Echo "$dis[4] <br>";
Echo "$dis[5] <br>";
Echo "$dis[6] <br>";
?>
</html>

!!....

80
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

):(Password fields


******

get

post
(Secure Socket Layer) SSL
.

:
:password.php
>"<html dir="rtl
><body
>"<form method=post action="password1.php
><h3><b
><br
>"<input type="text" name ="user
><br
></h3></b
>"<input type="password" name ="pass
><br
>""=<input type = submit value
></form
><body
></html

81
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:password1.php
<html dir="rtl">
<?
Echo " : ";
Echo "<br>$user<br>";
Echo " :";
Echo "<br><br>$pass"
?>
</html>

82
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:
PHP

.

0 .
.

:
:

... ..
:

?<
83
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

;" " = $items1


;" "= $items2

;" "= $items3


;" "= $items4

;" "= $items5


;" "= $items6

;" "= $items7


;" "= $items8
;"$items9 ="Adobe Photoshop
;"$items10 ="Visual basic
;"$items11 ="HTML
;"$items12 ="Java Script
>?

:
?<

" , " " , " " , " " , " ( $items = array
" , "Adobe Photoshop" , " " , " " , " " , "
;)""Visual basic" , "HTML" , "Java Script

>?

:

:

>"<html dir="rtl
?<
","Adobe "", "", "", "( $items = array
;)"Photoshop" , "Visual basic" , "HTML" , "Java Script
;]echo $items[0
;">echo "<br
;]echo $items[1
;">echo "<br
;]echo $items[2
;">echo "<br
;]echo $items[3
;">echo "<br
;]echo $items[4
;">echo "<br
;]echo $items[5

84
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

echo "<br>";
echo $items[6];
echo "<br>";
echo $items[7];
echo "<br>";
echo $items[8];
?>
</html>

<html dir="rtl">
<?
$items = array ("" ,"" ,"" ,"" ,"Adobe
Photoshop" , "Visual basic" , "HTML" , "Java Script");
for ($i = 0; $i<8; $i++)
{
echo $items[$i];
echo "<br>";
}
?>

..

85
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP .
:

)(:Sort

.. :
;)Sort (ArrayName

:
$Lolo=array
;)"("amin","Mahmoud","houda","Nehal","Ammar","Ramiz

)( sort :
?<
$Lolo =array
;)"("amin","Mahmoud","houda","Nehal","Ammar","Ramiz
;)sort($Lolo
))While (list($e,$r) = each ($Lolo
{
;">echo "$e\t\t$r<br
}
>?

86
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PHP
.

)(:Arsort
)( sort asort

rsort :arsort
?<
$Lolo =array
;)"("amin","Mahmoud","houda","Nehal","Ammar","Ramiz
;)asort($Lolo
))While (list($e,$r) = each ($Lolo
{
;">echo "$e\t\t$r<br
}
>?

87
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

....

....

<?
$Lolo=array
("a"=>"amin","M"=>"Mahmoud","h"=>"houda","N"=>"Nehal",
"A"=>"Ammar","R"=>"Ramiz");
asort($Lolo);
While (list($e,$r) = each ($Lolo))
{
echo "$e\t\t$r<br>";
}
?>

88
www.abahe.co.uk

Arab British Academy for Higher Education.

89
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP Course

)(:array_push

)( array_push:
,Elemnt1, Elemnt2, array_push (ArrayName
)Elemnt3,..

.
:

>"<html dir="rtl
?<
"", "", "", "( $items = array

;)"","Adobe Photoshop" , "Visual basic" , "HTML" , "Java Script


)for ($i = 0; $i<8; $i++
{
;]echo $items[$i
;">echo "<br
}
>?

90
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

...
....

) :

200 (..

>"<html dir="rtl
?<
","Adobe "", "", "", "( $items = array
;)"Photoshop" , "Visual basic" , "HTML" , "Java Script
;),,array_push ($items,Windows,
)for ($i = 0; $i<14; $i++
{
;]echo $items[$i
;">echo "<br
}
>?

...

91
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

)(:array_pop


array_pop

) Array_pop(ArrayName

:
>"<html dir="rtl
?<
","Adobe "", "", "", "( $items = array
;)"Photoshop" , "Visual basic" , "HTML" , "Java Script
;)array_pop($items
)for ($i = 0; $i<14; $i++
{
;]echo $items[$i
;">echo "<br
}
>?

....

.
92
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:Implode

.
:
<html dir="rtl">
<?
$items =array (" "," ","",";)"
echo $items[0];
echo "<br>";
echo $items[1];
echo "<br>";
echo $items[2];
echo "<br>";
echo $items[3];
?>

...

93
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

>"<html dir="rtl
?<
;)""","" ,"" ,"( $items =array
;)",$items"$r =implode (" ".
;echo $r
>?

...
:explode

94
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

.....
.
:trim
trim :
>"<html dir="rtl
?<
;" $name = " Azzam
;)$name = trim($name
;echo $name
>?

chop :ltrim
ltrim trim
chop .

printf :sprintf
print print

58.46589
. :

95
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

>"<html dir="rtl
?<
;$total = 58.46589
; ".$total " echo
;">echo "<br
;)printf ("New No. %.2f" , $total
>?

...

: %
.%% :

double )(float


:strtoupper
96
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

a A
.
:strtolower

A a.
:ucfirst .
:ucwords
.
:
?<
;'$name = 'azzam al-kasim
;)echo strtoupper ($name
;'>echo '<br
;)echo strtolower ($name
;'>echo '<br
;)echo ucfirst ($name
;'>echo '<br
;)echo ucwords ($name
;'>echo '<br
>?

:explode
explode
:

?<

97
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

$mail = 'azzam-k@mail.sy';
$site = explode ('@' , $mail);
echo 'user name:'." ".$site[0];
echo '<br>';
echo 'Company:'." ".$site[1];
?>
: :join implode
<?
$mail[0] = 'azzam-k';
$mail[1] = 'mail.sy';
$new_email = implode ( '@' , $mail);
echo $new_email;
?>

98
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:strlen
:
?<
;"$text1 = "azzam al-kasim
;)$result = strlen ($text1
;echo $result
>?

strstr :strchr
strchr

?<
;")$text = "VIRTUAL AND OPEN LEARNING ACADEMY (UK
;"$find = "OPEN
;)$result = strstr ($text, $find
;echo $result
>?


$text
$find OPEN
:

99
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:stristr strtsr
strrchr

strstr .

:str_replace
:
>"<html dir="rtl
?<
;" " = $text
;echo $text
;">echo "<br
;)""","" ,"( $oldwords = array
;)""","","( $newwords = array
;)$newtext = str_replace($oldwords, $newwords, $text
;echo $newtext
>?

100
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

... ...
...

101
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:require
:
) Require (string file .
:head.php
?<
;" " echo
>?
:academy.php
>"<html dir="rtl
?<
;) 'require ( 'head.php
>?
academy.php :

102
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

require

head.php .

PHP HTML HTML


PHP PHP.
:include
require

include
) (Warning require


).(Fatal Error

103
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.


:MySQL

PHP

: .
.
:

..

:
http://localhost/
:

PHPMyAdmin

104
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:
info :

105
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

info .Create
:

Create new table on database info


users 3 )

( Go :

106
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

unsigned
auto increment

Primary

PRIMARY KEY

. 20

20 50
Table comments save

:
107
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

PRIMARY user_id
KEY
:

DATE
TIME
DATETIME
TIMESTAMP
YEAR

FLOAT
DOUBLE
REAL
DECIMAL
NUMERIC

TINYINT
SMALLINT
MEDUIMINT
INT
INTEGER
BIGINT

108
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

BLOB

CHAR
VARCHAR

TINYBLOB
TINYTEXT
BLOB
TEXT
MEDUIMBLOB
MEDUIMTEXT
LONGBLOB
LONGTEXT

ENUM
SET


:
:char
255 .
col_name char (size):

. Passwords

109
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:varchar
255 :.
): col_name varchar(size

) varchar(15 Die Hard

MySQL varchar

.
:Text

65535 :
: col_name text

255 text
. FULLTEXT
:enum


65535.

': col_name enum('val_1' , 'val_2' , ) default 'val_1


:
tinytext , mediumtext , longtext , set

110
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

:
, :
:int/integer
]: col_name integer(size) [zerofill] [unsigned
] [
.

:float
]: col_name float(M,D) [zerofill
M D
.

:
)column_name float (7,3
column_name float 7 3
9999.999
:
tinyint , mediumint , bigint , double , real , decimal

111
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
:
:Date
: col_name date
:
) (YYYY-MM-DD 1000-01-01

9999-12-31
:datetime

: col_name datetime
)(YYYY-MM-DD HH:MM:SS
1000-01-01 00:00:00 :
9999-12-31 23:59:59

:

:timestamp
)col_name(size

112
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

size
2 14 :

Size Format
YY

YYMM

YYMMDD

YYYYMMDD

YYMMDDHHMM

10

YYMMDDHHMMSS

12

YYYYMMDDHHMMSS

14

.time , year

113
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
MySQL:
:MyISAM MySQL

K .

:Heap

InnoDB , BDB , Gemini


.
. MyISAM

:
SQL
:
:INSERT
:

114
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

auto increment

''
:SELECT

) (
:

*
:

:DELETE

:

:
http://www.mysql.com/
) PHP mysql_connect

:( mysql_pconnect

115
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

mysql_pconnect

.
) :(mysql_select_db

.
:

;)' '$conn = mysql_connect ('localhost','root',


;)$db = mysql_select_db ('zzzz',$conn
mysql_pconnect
.

) :( mysql_query

;)' '$conn = mysq1_connect ('localhost','root',


;)$db = mysq1_select_db ('zzzz' , $conn
;"$sq1 = "select * from zzzz
;)$result = mysq1_query($sq1 , $conn

116
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

) mysql_fetch_array

:(mysql_num_rows

mysql_num_rows

, mysql_query :

;)' '$conn = mysq1_connect ('localhost','root',


;)$db = mysq1_select_db ('zzzz',$conn
;"$sq1 = "select * from zzzz
;)$result = mysq1_query($sq1 , $conn
;) $number = mysq1_num_rows ( $result
:
mysql_fetch_array

mysql_query
key

value .

117
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

phpmyadmin

admin
config.php .install.php
...

.Config

118
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

config.php
?<
//
;"$db_host="localhost
//
;"$db_user="root
//
;""=$db_pass
//
;"$db_name="qq
)"$reslut_connect= mysql_connect("$db_host","$db_user","$db_pass
;)' '( or die
mysql_select_db ($db_name,$reslut_connect) or die
;)' '(
>?

... ..
:
.install.php

:
<?php
;)"include("config.php
( `$abosaleh_admin_create = mysql_query(" CREATE TABLE `admin
`user` varchar(250) NOT NULL default '',
`password` varchar(250) NOT NULL default '',
`id` int(11) NOT NULL auto_increment,
)`PRIMARY KEY (`id
;)";) TYPE=MyISAM
//
{)if($abosaleh_admin_create
>'Echo "</font><center><b><a href='create_login.php
;" > ....</a
{}else
;" config >Echo "<center><b
}
>?

119
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

.install.php
. config

...

... :
create_login.php
:
?<
;">'ECHO "<div align='center
> <br></p></h3></b ><h3><b><p
<table border='3' cellpadding='0' cellspacing='0' style='border-collapse:
'collapse; ' bordercolor='#111111' width='33%' id='AutoNumber1
>'bgcolor='red
>'<tr><form method='post' action='login.php?Next=outinstall
<td width='100%' align='center' style='border-style: 1; border-width:
>'medium
><br><h3><b
></td></h3></b

120
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

</tr>
<tr>
<td width='100%' align='center' style='border-style: 1; border-white:
medium'>
<span
lang='en-us'><input
type='text'
name='AdminName'
size='38'></span></td>
</tr>
<tr>
<td width='100%' align='center' style='border-style: 1; border-width:
medium'>
<br><h3><b>
< /td></h3></b>
</tr>
<tr>
<td width='100%' align='center' style='border-style: 1; border-width:
medium'><input type='text' name='AdminPass' size='38'></td>
</tr>
<tr>
<td width='100%' align='center' style='border-style: none; borderwidth: medium'>
<p dir='rtl'><span lang='en-us'>
<br>
<input type='submit' name='save' size='38' value=' ' style='lineheight: 150%; border-style: 2; border-width: 1'><br>
&nbsp;</span></td>
</tr>
</table>
</center>
</div></form>";
?>

...

... install.php

121
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course



) ( ... sql

INSERT INTO .

login.php

?<
;)'require('./config.php
$Re=mysql_query("INSERT INTO admin(user,password)"."VALUES
;)")'('$AdminName','$AdminPass
{)if($Re
><br><br></font><br >echo("<center><b
>'</font><a href='admin/index.php
></a><br
;)"></a><br><br >'<a href='index.php
;)"> <br><br >echo("<center><b
{}else
;)"> <br><br >echo("<br><br><cnter><b
}
>?

122
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

...

....


....

phpmyadmin
qq ... ....

123
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

admin ... ...

... ...

124
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
:Fopen ) (path
) (..... ...

$fp

$fp
..

..

r+

w+

PHP

PHP
a

PHP

a+

PHP

..

..

125
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

...

...

?<
;)"$fp= fopen("azzam.doc","w
>?

...

:Fread

..
:

;)"$fp=fopen("data.txt","r
;)$data=fread($fp,10
:Fgetc

) (False
..

:Feof
) (true .

126
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

file.txt PHP

?<
;)"$fp= fopen("file.txt","r
))While (!feof($fp
{
;)$char=fgetc($fp
;echo $char
>? }
:Fgets

.1+
:

:Fputs fwrite ..
:File

) (\n(
...
..


PHP ...

127
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
?<
;)'$fcontents = file ('file.txt
{ ))while (list ($line_num, $line) = each ($fcontents
;"echo "<b>Line $line_num:</b> $line <br>\n
}
>?
:Fpassthru

fclose

.
:

?<
;)"$fp=fopen("file.txt","r
)fpassthru($fp
>?
:Readfile

) (false

?<
;)"Readfile ("file.txt
>?
:File_exists
(1) true

false :

128
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

?<
;)"$Th=File_exists("file.txt
; echo $Th
>?
:Filesize false

...

?<
;)"$Th=Filesize("file.txt
;"echo $Th ." "."Bit
>?
:Fileowner ) (ID ...
:Filegroup ) (ID

..

:Filetype ) dir file


( block link fifo char file... dir

:Is_dir True ..
:Is_file True ..
)( :Copy

PHP ...

?<
{ ))'if (!copy($file, $file.'.bak
;)"print ("failed to copy $file...<br>\n
}
>?
129
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:Rename


..

?<
;)'Rename ('file.txt','newfile.txt
>?
PHP


:Opendir .

)( :Closedir .
:Readdir .

:Rewindir .

:Chdir .

:Rmdir

:Mkdir

:Dirname

130
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

debbug

PHP

cgi PHP

PHP

.
:

) (Syntax Error
:
:
?<
;"Eco "1

: //
;"Echo "1

131
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

>?

Parse error

) (semi-colon :
?<
"Echo "hello
: //

;"Echo "hello
>?
PHP

) brace (:

<? Php
) for ($loop = 0 ; $loop < 5 ; $loop ++
{
; Echo
>?

PHP

1 .:
?<
) for ($loop = 0 ; $loop < 5 ; $loop ++
{
) for ($loop1 = 0 ; $loop1 < 10 ; $loop1 ++
{
) for ($loop = 0 ; $loop < 5 ; $loop ++
{
code .
}
}
132
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

( } )
: . - 2
<?
Echo 10
<?
: . function - 3
<?
Htmlspecialchar($I);
?>

:
Fatal error: call to Undefined function: htmlspecialchar().
:
<?
Htmlspecialchars($I);
?>
: . - 4
<?
Echo arabbuilder;
?>
Parse error . )"(

133
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

):(Logical Errors

30 30
:
?<
; ": " echo
>echo '<br
>"<form method = "post" action = "age.php
>"<input type= "text" name = "age
><br
> " " = <input type= submit value
; '></form
>?
age.php :
?<
; If ($age<30) echo

; If ($age>30) echo
>?
..

) ( .

134
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

)(Run times error


.
:

?<
;$t=0
;$r=1
;$f=$r/$t
>?


) Warning: Division by zero in (path) on line (line number

) (unexpected

.
:

;$c=1
;$t=true
)while ($t=true
{
;$c++
}

) ($c

.

135
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:function
:

?<
)Function ($d
{
;$d =$d+$d
}
return
.
:

; If ($y=10) echo 12
:
; If ($y= =10) echo 12

136
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

.:

?<
//
; Echo
>?
:

?<
*/
+- --------------------------------------------------------------+
|
2
|
+- --------------------------------------------------------------+
*/
)function ($U
{
;$U=$U/2
; return $U
}
>?
Regular Expressions

) (a@y@.k.d :

(Regular Expressions) RE/


137
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course


.
:echo


.:

?<
;Echo this is: $name
;>Echo <br
;Echo this is: $Email
//
//
;Echo this is after: $name
;>Echo <br
;Echo this is after: $Email
>?
:html
html

138
www.abahe.co.uk

PHP Course

Arab British Academy for Higher Education.

PHP

PHP @ .
:

?<
)function amail ($y
{
;$y=$y/0
;return $y
}
;)$s= @amail(44
;echo $s
>?

139
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

php .
:
;)"Header("Content-Type: image/png

:
;)(session_start
;$new_string
;)'session_register('new_string

140
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
;)$img = ImageCreate(200, 40
;)$white = ImageColorAllocate($img, 255, 255, 210
;)$black = ImageColorAllocate($img, 0, 100, 222
img
image create

: 255,255,255 :0,0,0 :

md5
srand .

;)srand((double)microtime()*1000000
.
;))$string = md5(rand(0,9999
:
.8
;)$new_string = substr($string, 17, 8

141
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
;)ImageFill($im, 0, 0, $black
. 40200
:

;)ImageString($img, 5, 65, 10, $new_string, $white


.img
1 .5
80 10
$new_string .
$white .
...
:

:

;)"ImagePNG($im, "lolo.png
;)ImageDestroy($img
verify.png
img image

destroy .

142
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
<?php
Header("Content-Type: image/png");
session_start();
$new_string;
session_register('new_string');
echo "<html><head><title>lolo</title></head>";
echo "<body>";
ECHO "<div align='center'>";
$img = ImageCreate(200, 40);
$white = ImageColorAllocate($img, 255, 255, 255);
$black = ImageColorAllocate($img, 0, 0, 0);
srand((double)microtime()*1000000);
$string = md5(rand(0,9999));
$new_string = substr($string, 20, 8);
ImageFill($img, 0, 0, $black);
ImageString($img, 5, 65, 10, $new_string, $white);
ImagePNG($img, "lolo.png");
ImageDestroy($img);
echo "<img src=\"lolo.png\">";
echo "<br><br>";
echo "<b>"."
" ."</b>";
echo " <form action=\"handler.php\"
method=post>";
echo "<input name=\"random\"
type=\"text\" value=\"\">";
echo "<input type=\"submit\">";
echo "</form>";
echo "</body>";
echo "</html>";
?>


..

143
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

handler.php :
.
?<
;">'ECHO "<div align='center
;)(session_start
;)$random = trim($random
)if ($new_string == $random
{
;" "echo "<b>".
}
{else
;" "echo "<b>".
}
>?

144
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

145
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:IP
<?
$IP = gethostbyname("www.yahoo.com");
echo $IP;
?>
:
<HTML DIR=RTL>
<?
function hijri($GetDateFormat,$DFormat)
{
//start function
$Days=@date("D"); //print day name+Saturday-->Friday
//start hijri function date
$TDays=round(strtotime($GetDateFormat)/(3600*24));
$HYear=round($TDays/354.3667);
$Remain=$TDays-($HYear*354.3667);
$HMonths=round($Remain/29.5305);
$HDays=$Remain-($HMonths*29.5305);
$HYear=$HYear+1389;
$HMonths=$HMonths+10;
$HDays=$HDays+23;
//hijri function days between [29:30]
if ($HDays>29.5305 and round($HDays)!=30)
{
$HMonths=$HMonths+1;
$HDays=Round($HDays-29.5305);
}
else
{
$HDays=Round($HDays);
}
//hijri function months
if ($HMonths>12)
{
$HMonths=$HMonths-12;
$HYear=$HYear+1;
}
//hijri month names [print month name]
if ($HMonths=="1") $hmname=";"
146
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

if ($HMonths=="2") $hmname=";"
if ($HMonths=="3") $hmname=";"
if ($HMonths=="4") $hmname=";"
if ($HMonths=="5") $hmname=";"
if ($HMonths=="6") $hmname=";"
if ($HMonths=="7") $hmname=";"
if ($HMonths=="8") $hmname=";"
if ($HMonths=="9") $hmname=";"
if ($HMonths=="10") $hmname=";"
if ($HMonths=="11") $hmname=";"
if ($HMonths=="12") $hmname=";"
//day function [print day name]
if ($Days=="Sat") $dd=";"
if ($Days=="Sun") $dd=";"
if ($Days=="Mon") $dd=";"
if ($Days=="Tue") $dd=";"
if ($Days=="Wed") $dd=";"
if ($Days=="Thu") $dd=";"
if ($Days=="Fri") $dd=";"
$les = strlen($DFormat);
for($i=0; $i<=$les; $i++)
{
$df[$i]= substr ($DFormat,$i,1);
if($df[$i]=="A" || $df[$i]=="a")
{
$ddf=@date("a",$GetDateFormat);
if(substr($ddf,0,1)=="a")
{
$Result.="
";

}
else
{
$Result>="
";
}
}
elseif($df[$i]=="D") {$Result.="$dd";}
elseif($df[$i]=="d") {$Result.="$HDays";}
elseif($df[$i]=="m") {$Result.="$HMonths";}
elseif($df[$i]=="M") {$Result.="$hmname";}
elseif($df[$i]=="y") {$Result.="$HYear";}
elseif($df[$i]=="Y") {$Result.="$HYear"."};"
elseif($df[$i]=="g") {$Result.=@date("g",$GetDateFormat);}

147
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

elseif($df[$i]=="G") {$Result.=@date("G",$GetDateFormat);}
elseif($df[$i]=="i") {$Result.=@date("i",$GetDateFormat);}
elseif($df[$i]=="H") {$Result.=@date("H",$GetDateFormat);}
elseif($df[$i]=="h") {$Result.=@date("i",$GetDateFormat);}
elseif($df[$i]=="s") {$Result.=@date("s",$GetDateFormat);}
else
{
$Result.=$df[$i];
}
}
return $Result;
//end hijri function date
}
echo hijri(2004-04-28,"d M Y")."<BR>";
?>

:
<?
$s=getenv ("SERVER_ADDR");
$os=PHP_OS;
echo"<br>";
echo "IP The Server...";
echo"<br>";
echo $s;
echo"<br>";
echo "OS The Server...";
echo"<br>";
echo $os;
echo"<br>";
echo "*******************";
echo"<br>";
//Clint Info.
$ip = getenv ("REMOTE_ADDR");
148
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

echo "Your IP...";


echo"<br>";
echo $ip;
echo"<br>";
echo "*******************";
echo"<br>";
echo "ThanX For My Script";
?>

:
<html dir="rtl"> <?
//
$CurrentDate=date ("Y-m-d");
echo '' ." ". $CurrentDate;
//
$FromOneWeekDate=date
("Y-m-d",mktime
(date("G"),date("i"),date("s"),date("m"),date("d")-7,date("Y")));
echo "<br>";
echo '' ." ". $FromOneWeekDate;
//
$FromOneMonthDate=date
("Y-m-d",mktime
(date("G"),date("i"),date("s"),date("m")-1,date("d"),date("Y")));
echo "<br>";
echo ' ' . " " . $FromOneMonthDate;

149
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

//
$FromYearDate=date
("Y-m-d",mktime
(date("G"),date("i"),date("s"),date("m"),date("d"),date("Y")-1));
echo "<br>";
echo '' ." " . $FromYearDate;
//
$TomrrowDate=date
("Y-m-d",mktime
(date("G"),date("i"),date("s"),date("m"),date("d")+1,date("Y")));
echo "<br>";
echo ' ' . " " .$TomrrowDate; ?>

:
<?
$FromDate="2005-12-30";
$ToDate="2006-01-31";
$Difference = strtotime("$ToDate") - strtotime($FromDate);
$Days=ceil ($Difference / (60*60*24));
Echo $Days;
?>

150
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

:
<?
$Email="azzam@mail.sy";
$RightEmail=eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[_a-z0-9-]+(\.[_a-z09-]+)",$Email);
if ($RightEmail==1)
{
Echo ";"
}
Else
{
Echo ";"
}
?>

151
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

...
4
.. ..
..
.

152
www.abahe.co.uk

Arab British Academy for Higher Education.

PHP Course

153
www.abahe.co.uk