php - javad adib˘3 e˛ php +2 $ ˘c! ˛ /c˝ ˘ ˙- ˛j ˘9 $ ˙, $ $ ˙! c 5 p[75˘ˇ ˘4˙, easy...
TRANSCRIPT
��� ��� �
�� �� ��PHP
����:wwwwwwwwwwww....RightClickRightClickRightClickRightClick....ir ir ir ir
www.RightClick.ir �
�����:
����� ��
��� �� ���� � PHP
��� ���� �
��� ����)�� ��� � ������� ( �
��! ����)�� �"�#( ��
�$�%& ����)�� ��'( ��
()�* ����)+,��-( ��
(.� ����) �, ��/-$�MySql( ��
(�� ����)SQL( �
(�.� ����)�)��� 01�2 03�!( ��
(%4 ����) 03�!Login( �
(�� ����)Session( ��
(����5 ����)�� ���$( �
(������ ����)File Database( �
���� (��6�! ) +,�-Date( �
7��� � 89 ��
(5���, ���: ��$ (���! ;5 ��3 05�! ���,... �
� �4�/3 03�! ��� �
� �4�/3 03�!)� 01�2( ��
� �4�/3 03�!)��� 01�2( ��
� �4�/3 03�!) 01�2���( �
� �4�/3 03�!) 01�2��!( ��
� �4�/3 03�!) 01�2�$�%&( �
$� =5��5�: 0��! � >5$�- �� ?���!�PHP ��
@A9 ��� �Template ��
SQL Injection �� �, ��,�" � ... ���
5A4� ���'� 8BC ���
01�2 ;5 ��3 05�! ���,"� �, ��/-$� "(5���, ���
EF� ���*� � �4�, ��� �)?��! 7��3( ��
www.RightClick.ir �
� � ���,$�9 ��� ���G!�� H��
GD I 0��& ���
��84$ +,�-)7�4��( ���
$� 0J5�K!� ���� C���4PHP ���
���� ����!�'� � �� L5HTML MN$�O, P�15� ���
+,�- �� �.� �$�Q �& SMTP ��9 ?���!� III ���
��B $�B �.� 7* R� 7* $� �� 7B�B �, �$�Q �& I ���
;5 @$�� �.� �$�Q �& rss (��B �$�� 7* R� 7* P3�� �$ ���
�$�� �& ��4 �.� L5 8��' �$ ��8��' ��8S- � ��B �8�* 7T�8� $� I ��
$� U�' 7'��O- UV* ���, 89PHP � JavaScript ���
��, �4�W&���3 05�! ���$� 0!$� I (��9 ���
I (5$�XW, Y�Z � ��� �� ����4 ���, �4�W& ���
U9 �� ���:��� � ���9 U9 N�$��!�I 0��& ���
0 A�@+,��- 0.* $� ��,$�9 �& �I �$�� ���
& �5 � ?8� 05�! �$�� 7!$�� �& �� �,$�B �B (�1%, �.� �$�� L��! U-�4�F � ��
P �� (���! �:$�� P[ ip � ..$�$�� 0!8, �I ���
6 $ (�5$�WT�\���9 0.:��, P,�2 0.:��, P,�2 ��] � ���
�$� $� ^�_�- +,��- imagestring � imagejpeg � imagedestroy ���
P5�' ���4�� � C� ���4�� ���
N��AQ� �� �� 8�& U5�14 � �)��� C�3�! ���
www.RightClick.ir �
� ��� ���:
UV, C�T�� ��� � php 7 a��� �$ (��B.
8���/, php ��,� �, ��/� 7��3 �� ��: �b4 �� C 0J5�F!� ���� � ...0!�.
��,� �, P/2 �� �1� �:� C 8���, ?��B$�B 7�5�4 � �4�, ��� ��,� 7�B $�Z, �5 � �$ ��cF' �cB �6�& �� ��S5�! 7��3
85��: 7 ��5 � ��� 8��B 7 ...
���, H�3 85�, ��� $�B a����B (�4�8, php ?$�� ��d 75� 6�& �& � �� 7 ���� �)B � 0�� 7& ...
php H� $� �B 0�� 7�5�4 � �4�, ��,� ;5)7�B $�Q �, (��$ 7 $�B �,.
(��B (��"- (�4��- 7 ��!� �� �, �$ H� 7�5�4 � �4�, ��� ��,� 8���/, ...
1- ClientSide 2- ServerSide
Client Side �, �,: 75�� � �4�� �,$�B �-��J �B ��$ �, �B ��� 7 )0�5AB (P[ 84�� 7 ����:0J5�F!� ���� ...
ServerSide $��! ��$ �, �B 0!� 75�� � �4�,)?8��� E5��! (P[ ��� 7 ����: PHP \ ASP \CGI � ...
�� �� 7�1�2 ��$ �, �,$�B 7�2� 8����3 7 �1� A[ 8�B ;��B ���,� �., ?��� ��.4 ��� �, ����* �5 ... � �4�, C5�
�,$�B �-��J �B ��$ ��� 7 ���� ... (��5��, 0J5�F!� ���� �, (�4�- 7 �$ C5�...
0�� +2� �5 � � C5� �B ��B �)��� �1� 05�! ����� ��- �$ �6�& �5 �4��, �,$�B A[ 8����3 7 �B 85�, �)���
��& �., ��)4� $��! ��$ �,0!� $��! ��$ � 05�! 7 �1- ��& � ��S H�3 I ...
8�5��, 8� ��: �� � 8" �5 �B d�# H�3 php (��B a��� �$.
��� ���, ��d: php
P[ �W.5��5� ;5 DreamWeaver �, 7T� �� 7 (� 8* N�4 �, ��/T� 85�- 0#�$ C5� ...
��� � �4�, �B e�� ;5 php 4�� ���� �)4�� C4��,;5 P[ 8 �B $��! php ��B 7 N$�*�! (� �$ ...
$��! ��� �B 84$�� ���� (� 75�� � �4�, ��/T� 8c��B 7c ���c! ��/c� �c �-��J �B ��$ �$... Pc[ Easy PHP �
Wamp � ...
�57* �.R�.��, 7�3 e�� 7*��4 � �4�, 5�7�5 ?$�� �4 I
+2�� $� php � �e �37 �4�� ?$�84 74�- �- C��, (� 8* N�4 �5��T� 87� ����� e75 f�' ��� � ��K5 c�S7 �, c5 8
�$� 5 �., ���� $��! L ...��/T� �9 Easy Php �� � �4�, �75� P[ 5$��! ��� C �$ �, �$�J �9 � /c� � �-�� ��c! ��
7 8��9 .
www.RightClick.ir �
YO4Easy PHP � ?��! (� �$ ��� � 0!7 8��9 ���4�� �5� @$�� �� 8�4�- ...
http://easyphp.abbal.com/depot/easyphp1-6_setup.exe
�B d�# H�3 $�8.� �5 ���T���5�' 8���, ����� ����5�' �:� M8��B ���� �$ ��� \85��B U/O4 ?8� ... ?��c�� U%, �1�
858, ...
$� ��F5� �5 ���� �� 8S, 85� 7 $� U5�14 �, 0��! $��B.
H�3 �, ?���!� P,�2 �B C5� ���,(��B 7 7Q �$ �5� P#�� 8� :
��$ �, �8�,� ?8c� ��c, ��� �� � (��B 7 ;��B 0!�$ 0��! $��B $� � �4�, C5� ��F5� Configuration �c5� �� �
?8� ��, ��� EasyPHP (��B 7 ��, PF� g,�Z �$...
$� 8S, �1B� ��$ �, � 8��B H�V�4� 7���W4� �$ � �4�, ��,� ?8� ��, ?�)�* Apply 8c��B ;��B \ $��c! d�c# H�c3
(5��84� 7 ?�$ �$ 7&�*�\ C�1� �, $��! N$� MySql (5��84�� ?�$ (� �$ ...
www.RightClick.ir �
�, � �4�, ��F5� 85�, d�# H�3 ���, $� �� ;1.& PF�.
H�3 ' d�#�I (��� $��2 �)B 85�, �$ $��! ��$ ��� P5
��- �$ � �4�, �B C5� h�' �, �5�$� C ���* � Program Files 8���, ?��B YO4 ...85��, ��� C5� �, 7��5�, :
:آ�
C:\Program Files\EasyPHP1-7\www
8��B 7JB �)4�� �$ ��-��3 H� N�� � ...
P5�' ����� ���, 04���5� �, ��/� �6�& �5 7�S5 ��-��\��$ �, Local Web 8��B ;��B .
$� �- U�* �:$�� h�'8�B ��, �$ 7�� H� �� .
www.RightClick.ir �
���, ?��� ?�W5�* 05�58 ��2 � i��S � �4�, Php My Admin ?��c1� 6c�4 Easy PHP ��c�� ���c, �cB �$��
�� �, 7!��!� \��$ �, PhpMyAdmin ��� �� Configuration (��B 7 ;��B.
# H�3�d 7�5�4 � �4�, a��� ���, 6�& �1� �B php � ���, 8� ?�� �7 �T�&�B 8B �5 ���� (��5�4 ...
:آ�
<?php print("WelCome To PHP World!"); ?>
N�4 $� �$ 8B C5� ��4 �, 7�5�' $� � 8��B �$�� 8* index.php 0!�� ��B�T 7�� ��� $� www $� Easy php
8��B ?��3j. 8c5��, @$�� Cc5� �, � 8��B ��, �$ ��3 �: $�� ��# http://127.0.0.1 c5 �http://localhost \ �c-
�$ ��3 �� 8���/,.
8B 8S, ���� �� 7�5�4 php (��B 7 a��� �$.
www.RightClick.ir �
��� ����) �� ���� ��� � ���(:
� $�5�� ��% �, 01�2 C� �� ��� � �� �7����* 5(.
�� �� &�I �
�9 h�'� �1� 8����V� 85L�8� $�8" � 5 �5 (!� A[ ���$ L5�W4 �$ �4 L $��5 �� 8S, � 85�! L� ?$�,�� ��$�9
�9 ?���!� ���� 8 .��,�� 5& �� $�9 C�6��, �� ��4� ?���!� �7�9 � (. �2� +2�� $�7 5�� L���S- �$ �5 c k7 c�9 � (
5�� 01�2 L �b'�# Ram !� �$�$ �$ (��7�9 � �9 �$ �& �� � (7���3 � �)4� (7�4 5�� ( .$� �� � �4�,�� 5 �cW
P[ C , Pascal ,… �S- ��W�� � 5�� k��, �5��7�S- (� �$ �� a�4 5k �9� ()...& a�4�I � (�- � �� php 4���� �c,
�S-514 a�4 k7��3 8��, php �$ �� a�4 V.-� l78�� .5?��! ��[ � :
:آ�
$a = 25;
�9 02��8 � $� �95��[ C a �� � �8� � 0!� �mn$�8" ��� �� $� � �9 0!� �?��� $��2 � �5( .
�, $��!� �� �� 8S, 8� ��: A/2 �9 $�Q ��1�5! 8�1� C�K ; $��27�� �( . 0 A� $&��- I �� php �c� ��4 �� P/2
�� ��, �5��7� �1�# 5�� $��2 �$ 0 A� C�( . $�XW �4��� � �� �5�! L� 4��c2 � c9 ?$�� C cT�� A[c �� ��� ��9�$�c9 C
14� �4�� _ ���,5� �r1� � �., a��� �8� �,��, C5��7�9 ?���!� �/T� i��# �� ��� �4�14 �1� A[ (� �58��!$��4 �:
:آ�
$_salam = 12; $65a= 10;
$�X: ��4 �, �9 ��#�8� ���� 5/, (�����" �& (5���- ��� ��� � 74��- ��� $��2 (� (5%, ��� a�4 �& (W, ��75$�� 5(:
:آ�
$a = 12;
�5 a�4 C5L � �8��0!� ^ .
:آ�
$a = 12.5;
�5a�4 C 51 �8� L� $���� 6)$�.��� (0!�.
:آ�
$a = "Ali";
www.RightClick.ir �
�5 C5L �9 02� 0!� ���$���, �9 8��, ���$ ���9 �$�� 5��7 0 A� �� �� " "5 � ' '?���!� �9� (5�S7 :
:آ�
$a = 123;
�, :
:آ�
$a = '123';
3��7 T�� ?$�� f�'7 �8� tmu �� � 0!� 7 ��9�$�9 t � m � u (� ��/4� �, �9 0!� 5�$ ���$ L K.-� P7�� .
d�#5��[ � :
:آ�
$num1 = 10; $num2 = 5; $total = $num1 + $num2; print($total);
02� �:� �9� 87, ��� 8�� �� ��� � ��� e3 $� �9��� ��4 �, �� num1 � num2 �S- �$5��9 k5( ��� $�8" �5 � (
� a�1) 8S, e3 $�5�� $� �$ �� C�� total ��� $��258S, e3$� � ( ��45 v�& �$ w7�9 � () c ��c!$� �: $�� �,7
�9�((.
���-:S! 7�9 ��9 8 1���� ��4 �.��� �, �1� �, �8, ��-�� �5 C��,�� 5 L19 � �4�, (%' �, 8S, �9 C7 T� � �c�9 c� P
�5� ��� �W54d�Q ��� �4�, �:� �9 ��7� �., 5: �W�14 w7�� 58.
H�3 �� �, �9 d�#�8� ���� �� �5�, (5 x��! (�� ��� .
�9 h�'��- 8�?$��2 ��� �4�, �,$�9 ��4 �,$�9 �9��14 �$�� �$ ��3 $�/� �1�9 � 50!$� N$� $� � 8 �� �c� ���,
� �� �$�� 84���,5�W���, ��� �� 5 $�9 C)5�S7���9 L& username � password �� ?���!� ���7�9 �( .
A[ :
:آ�
if( � ��ط� ) { ---- ---- ---- }
www.RightClick.ir �
�9 PK�7� �, ��� 5�-$� C . 6�4��* P3��5 �$ ��� �7�4 5��, � (� C{ }-�$��!� 7:� �9 6�4��* P3�� ��� �
$��2�, �, ��,5 $��2 �$ 84�� ���� 87 ���(.
A[ :
:آ�
if($user == "ali") { print("Welcome Ali!"); }
-$� $�7�� �9 �� user �,��, ���$ �, ali $��!� ��, print ���� ��� P3��7�� .
� �2�5 C==& �I �
H�3 �, d�#5� H��� x��! (5 C���! :
��,�!$�, 7& �� � �� (� �, 65�! L��� 0 A� ?���!�7�9 ��S �9 (7� �$ �4�� 5(���4 � :
== !$�,7���- �& �� �6
> ��K&�9
< ��:$6,
=> ��K&�95��� ��
=< ��:$6,5� ��� �
=! kT�V )��� �4�(
��K43 ��7(% :�9 02� ���, �9 8�!$�, 7���- � �� =��K4 ?���!�8\� 5� ��5 H���4� P1� C� z��, � 0!� ��� �.
1� �1�� 8��, $��2�, �....
� z#�/ �� ���5����� 01�2 $� �9 84$�� � 8S,�!$�, �, 7 �%4� 7����* 5(.
www.RightClick.ir �
��! ����) �� �"�#(:
�b4 $� �$ �� �"�# 01�2 C5� ���, (�'�: ...
� ���, 74�,� �� $� �� �"�#A[ ��$ 7 $�B �, �$��F- ���$�B ��)4 6c�& �c� �5 � �)��� w5��4 �� 7���T U5�14 ���,
�� �W5� ...�� a�4 �! C �� C5� $� $� �B 75�� �"�# php �8� ^�_�- �$ ��$ 7 $�B �, ... a��c� ?��c! ��[ �5 �,
(�B 7 ...
�1�B �5 (���V� C t{��., v�& $�, ...
:آ�
for($i = 0 ; $i<10 ;$i++) { print("Salam<br />"); }
�1�B 8B �F- C5� Salam �$t{?8� U5�14 �:$�� ��- (� �5� $�, ...
^�_�- �, d�# H�3 7 (5����* :
�"�# �, (5��, $�B �, �B �"�# C5� for C5� ��� 7�B PF� � 0!� i��S 0!� �$�Q ...
:آ�
for(1 ; 2 ; 3) {
����� � }
^�_�- :
|} 7 �$ ��T�� $�8" 01�2 C5� $� (�5�4 . �"�# ?84$�1� 7�S5)I (�., a��� �)B �� ...
m} 7 �$ 7Q�� N$�/� �5 01�2 C5� $� 0!$��4 ��� C5� �B C5� ~� �, � (��5�4 7�S5 ��� false �"�# �� �.,
(5�� 7 �$�3 ...�, �B (��5��, 7Q�� 85�, 8��B 02�7S2� �5 ?�3d false �c:� ��c& (�.c, �$�c3 �"�# �� � �.,
�"�# ��- $�Q C�1� (�.4 �$�3 (�5��14 ����, 8,� �- � (�3�& 7 .
u} 0!� ��!� �"�# ��: �, �B 01�2 C5� $� �c5 ��B �'�_� �6�& �5 ��T�� $�8" �, A[ �B (��5��, �$ 7-$�/� 7��5�,
��B (B ��� ... �� e5��� �, 7W��,?$ ...
I �"�# �48,
� �B 0!� 7-�$��!� �"�# �48, (��B $��F- �$ �%4� (����3 7 ...$��!� d�, ��[ $� print �c4��� �"�# �48, ��, �c�
���, ��- (� �W5� �"�# �- 8�& �4�- 7 7�# ���, (����V, �B $��!� �- 8�& ...
www.RightClick.ir ��
(% N�F4 :
* ����� �, ���� �5 � �B 8��B 02�(��'�: �b4 $� ��T�� $�8" ... �c4�- 7c 7c�S5 ���, �6�& �� �4�- 7 $�8" C5� �
���, ��B�$�B �5 �8� ...
* ��� ���, ����84 (5��B k5�S- ��T�� $�8" ��- � �B ����� �, 7Z,$ =�� �4�- 7 �"�# ...
* � � (B 7F5 7F5 �4��� C��r1� �., ��5� �5 �., (B �4�- 7 �"�# ��:��5 $�, �� 7�# �5 � �.,{,t��B ����- ...
* $i++ I ��&
��5� ���S �"�2� C5� :
:آ�
$i = $i +1 ;
���� �, 7F5 7�S5 i ��B 7 �'�_�\�� �5� C�1� ��- �W5� 6�& �5 (��5�4 7 PF� C5� �, �B (5$�� $i-- �4�� �5 7�S5
�� i ��B 7 (B ...?��! $�� �5 ���5�4 ...
* �"�# �4�: �! ��� 01�2 �� ;5 �� (�4��� � )��T�� $�8" 7�S5 �c"�# ��: � ��� � ( 8c5�, �c�/T� (��c5��4 �$ ';' �$
(5$�XW, .A[ :
:آ�
for(;;) { ��� �� د���ر }
(�., �$�3 �"�# �� �$�� �5 85�, �B 7�W4 �W �2� I ���! �5} 7c14 �$ ��c� �B d�# cZ& (��c5�4 �c"�# �� �$�
(�., �$�3 ...I
�5 ��4 �, (5$�� $��!� break ��� 7 �$�3 �"�# �� 8�!$ $��!� C5� �, � �4�, �� �� �B ... 7 � Y�c# �c, (�4�c-
(��B ���� �$ $��!� C5� (��!��3 �B �� �� �"�# ��- �� ���4 .
�"�# (��B 7 7!$�, �B �8S, �"�# while 0!� ... �, �$ d�, ��[ �"�# C�1� (��5��� :
:آ�
$i = 0; while($i < 10 ) { print("Salam<br>"); $i++; }
www.RightClick.ir ��
C5� 7�B $��3�! 0!� PF� C5� �, �"�# :
:آ�
while(ط��) { ��� ��� }
~� �, ��� C5� ~"4 �B C5� (false) (5�� 7 �$�3 �"�# �� ��� ...
�8S, �"�# do while 0!� :
:آ�
$i = 0; do { $i++; print("Salam<br>"); }while($i<10);
�, 72�' �& C5� H�3 while I 0���
C5� P[ �"�2� �"�# while Cc5� �.c� 7!$�, �"�# ��5�* $� �"�# ��� �B N��- C5� �, 0!� N$�c �c� $� �c"�#
P[ 75�� �"�# 7T� ��� 7 ���� $�, ;5 P2�8# while , for 7-$� $� Ac� 8c��/4 $��c2�, ��� �"�# �� P/2 �B
;5 �1�# �"�# a�4 C5� � � ��.�14 �"�# �$�� ��� 7 �$�� $�, ...
�"�# ��, C5� � ...
�� ��' �$� $� �8S, N���� $� (��B 7 z�, �,$�B �� N��AQ� C�'�: �.
www.RightClick.ir ��
�$�%& ����) �� ��'(:
� �B 75�� � �4�, ��&84�� 7 ���� �,$�B 0!��3$� �, � 8���� $��! ��$ (��5�4 7 �� ��' �, 01�2 C5� $�) �B
8���� 0!��3 $� a�4 ;5 ((5����* 7 .
I ��& ��' ;5 �B �� �5)8�& (��4 �B 75�� P[ ?$�� N��AQ� ��$� ���, 75�� �5 � �1B� �- $�c/� �1�B � ��,$�B
�� P[ �5 � (��B 7 �$�� �$P� �5 � �1B� �5 �B P:�: ��� ?$�� ��$� ...
(��!�' 7 $��! 01! �, �$ N��AQ� N$� �� �, �� ��' �,)�5 (��8� 0!��3 $� �#AZ�: (
1- Get 2- Post
��' 03�! :
���, 8B �� 7��5�, ��' C�3�! Html �, 7Z,$ (��B ?���!� php ?$�84
;5 �� ��[ ;5 ��':
:آ�
<form method="POST" action="Page.php" name="MyForm" target="_self"> <input type="text" name="T1" size="20"> <input type="submit" value="Submit" name="B1"> <input type="reset" value="Reset" name="B2"> </form>
��1� ��! �- �- 8�& 8���, 7 �B $�Q�- ;5 �B 8���� ? <form> </form> � 0�� �4�� e!� �W5� �- �- 8�&
...
8���� ��' ����� �, ��,� �� 7Z!� ���.
�- 7!$�, <form> :
��� �- ��", P[ (� �- C5� html 0��3 ��! ;5 �� 7 (�3 �� �5 �, � �� 7 a��� �� �5 �� � ?$��.
method: �$ 0!��3$� a�4 �B 8�B 7 lV. 84��- 7 POST �5 � GET �$ Cc5� Ac� �cB 7-$�c $� 8��,
�, (��5��4 h�.�* N$� Get ��� 7 ��'�: �b4 $�.
Action: 8�B 7 lV. �$ 8O" �� ��8cB �, $��! 01! �, ��� ��!$� ���, ��' ���B �* �� E* �B C5� 7�S5
�., ��!$� �� ... �, ��,� ��� 8B �B (���, 7 � ��� $�(��5��, 8O" �� ��- 85�, �$ ��' .$� C5� �B 7-$�
��� 7 ��'�: �b4 $� 8O" �� �$�� �� (��5��4 �$.
www.RightClick.ir ��
Name: ���, �B 0!� ��' ��4 php 0J5�F!� ���� �� (����V, �:� 7T� (5$�84 ��� �, ����4 �� 7 ���4 (��B ?���!�
...��� ��!$� �� P/2 P�15� 0� ���B ;& P[ 7F5 02� �5 �- ��F4 74�Z��.
Target: $8* �� \ 858� �� \ �$�� �� P �� �B 8O" �� �8� ��, a�4 � ��3 (5�' ;5 \ ... 0c!�
.�� E* �B 8���, ?�$�3 �, 7-�� �, ��# �, �- ��F1 ��c �c5 ��c- �$ �)��4 ��' ��!$� �, ��,� �1B� ���.'
85��B ?8��. 858�.
�- H�3��)�5� html �, ��-��3 �B ��, FrontPage 7 �Q�,� ��� � �4�, �5 85���, 8�4�- . ��c!$� �c, ��c,� �
��, N��AQ�.
(� 0'�5$� �, �B C5� ���, H�3 (�4� 7 �T�&�B ��[ �5 (5�., ���� :
�B (��5��, �� � �4�, (����3 7 (��B h�' �4�� � ?��B 0'�5$� �$ ���$ ;5n�B v�& $�, I�
(5��! 7 �$ ��� ��' ���)�B html 0�� : (
:آ�
<form method="POST" action="print.php"> <p><input type="text" name="T1" size="20"></p> <p><input type="submit" value="Submit" name="B1"></p> </form>
��' C5� � 8O" �� �B 0!� ?��! 7��3 ��' �5�� print.php E* ?8.4 ?��� 7!$�� ��& � 0�� �cB �� ��
��� 8B �B �� �� � �4�� ��- ��' php ?8� ����4 ��� ��- (print.php) 8���, $8T�' �5 ��- 7��5�,.
8��' �5 ��' C5�)7 ��� ��- �$ N��AQ� �B 75�� (��5�4 (?$�� �1B� �5 �.
8B d�# H�3 php ��� )�� print.php : (
:آ�
<? $my_str = $_POST['T1']; for($i = 0 ; $i < 5 ; $i++) { print($my_str); } ?>
�, ��� e3 $� ��4 �, ���� �5 my_str $�8"
:آ�
$_POST['T1']
www.RightClick.ir ��
�$ (5��� H�O�4� .� 0�� ��' ����� �, 7!��!� ���, $�8" C5� T1 0!� � 8��' ��� ��4 � �B �c5 ��- �$ ��� ����
�$ ��� �"�# ��- � (��V5$ ���� n(5��B v�& $�, .
�, �B 7-$� $� ��' ����� �, 7!��!� ���, Get �� 8���, ?8� ��!$�
:آ�
$_GET['FieldName']
(��B 7 ?���!�.
www.RightClick.ir ��
()�* ����) +,��-(: 0��& +,�-...I
$�B �5 � �B 8��B h�' �5 ��� ��- �B (5$�� ���! �$��3 �4�3 Uc%, �$ �c�T�� ���c i�cQ �5 �� �B 0�� ?�W�!�
��F�* �� ��, �83 �W5� i�Q �� � (��8� ����, ��� ... �c�� ��c� x��& A[ ��B �8�* �T�&�B l"4 �5 � (58 �� d�#
714 C��$ 84��... !�)�5�0�W�!� ��� 85�, � 7�S5 �.� a��� �� �!�$� �B ��F�* �B �$6, $���, ? �� �$ ?���� �$
?8� ��3�! ��F�* �B 74� � �- (58� U%, �B ��T�� ��� �B C5� ��� ��c)B (���/, �- (5��W, �b4 �5� ?8� P5��- � �, �$
�W�T 7 $�B ...� 0V! $�B �S2�� 0!� ���: �� � .
�- 8�& �$6, ?�W�!� �5 ��� �, � �4�3$�B 8��B h�' ��# W�!� ?8c� 8c�T�- �cSZ2 ?�W�c!� �c� �B ?$�� �T�&�B ?�
�- ?8� �W5� ?�W�!� �5 �, �$ ���3 �., (��! � ��$��3 ?�3d�, . �c 0c'�: N$�c d�, PF. P[ 7�F. �:�
?�W�!� �5 e"' (��B Y�� +'$ (����3 7 �$ �T�&�B ?���#�$ 7��3 C5� � \ ...
� �4�, ��- $ � �4�, �B ?��%, � (� �� ��01�2 �5 �:� �B (��B �F- �F- k��V ���$�B @�!� �, � (c� �, ���5� � �4�,
(��B ���: $�$� (����V, �$ 01�2 ��� e"' �� .C5� �� ��8B �� �, C.cF4�' �5 �� � �4�, �F-) +,�c- ( Cc5� �cB (�cW�
�� 7 ����4 �$�Q.
:آ�
function salam() { print("Salam"); }
4�' �5 C5�0!� ?��! C.F ��F� v�& �$ �A! �1�B �B ...
��8, (5��F� ?���!� �� C.F4�' �� (� A/2 � (���, 8�, �4�� �B C5� !!!
C.F4�' A[
:آ�
print();
��� �, �B P�/2 C5� �� � 8���� ���� .��3 7�3�� C.F4�' ;5 C5� ��/T� �B php 0�� .
+,��- �, ��,� N�#AZ� :
74��3��' : �B 7S,�- ��� �8 ���, d�, ��[ ��- (�46, �8 �$ +,�- �B C5� 7�S5 ��d �cB �� �� �B ��'�B e"' (����4
(��5��, �$ +,�- ��4 (�����:
:آ�
salam();
www.RightClick.ir ��
��5�J �B 7�S5 php ����� 84�$ 8!�, N$�/� C5� �, 7�2� 3 � ���� +,�- x��! �, � ��F� k2�� �$ � �4�, ec3 �c, e
+,�- �- 8�F� ���� �$ +,�- 8�8� � ��� � ���W� �, ?$�,�� 8S, \ ��� ��1-.
+,�- ���$�: ���$� �- 8�& �5 ;5 �4��� � +,�- � ?�c�W, �$ $�c/� �1�B � ��,$�B ��4 �B +,�- �5 A[ ���, ����� (�
�,$�B �B ���/, � �4 �5 0�� �/�S ...W4 �5� +,�- �, �4�14 ���,��� � ?��W� ���$� �5 �B 8��B ?� �$n v�& (� �5� $�,
��F� :
:آ�
function my_prn($mystr) { for($i = 0 ; $i < 5 ;$i++) print($mystr."<br>"); }
�8 �$�Q C5� �4�� � (�46� :
:آ�
my_prn("My Name");
��� �, ��/T� "My Name" 4��� (58, $��2 ���� �5 (��� :
:آ�
$my_name = "Mojtaba"; my_prn($my_name);
+,�- 7���3 : 7�S, � ���, �$ $�8" ;5 �F�, 8��F�14 v�& �$ �6�& �B 8���� +,��- �� �, 8�4���W� �cB 7S,�c- A[
6 $ �, �$ �� � ���W, �$ �,$�B ;5 $�/� �1�B �� �� 8S, � 8�B P58/- 7�3 (c5$�� ��c ��3 �B �6 $ �, �$ 6 $ C5� �
(��B ��5�" ) ��� v�& �6�& (����V�14 �B C5� 7�S5 (?��! ��[ ;5 :
:آ�
function sum($a,$b) { $c = $a +$b ; return $c ; }
7 �$ �8� �� f�' +,�- �8c��B �c1�B �� ?���!� �, \ 84���: 7 �, �$ �%4� a�1) � ���: return & �c, �$ �6c� 7c
(�4���:.
I (���, ����� 7,���!� 7�.:�, $�8" �, �4�W&
C��& C5� (�4��- 7 f�' +,�- ���, (��5��, :
www.RightClick.ir ��
:آ�
$s = sum(2,5);
+,�- 7�.:�, $�8" d�, 8B sum ��� ���$� ���� �, �$m � n�B ��.� ����� $� �$ s �65$ 7 . ��c& s �c��� �c5
!� ��", P[ ��3 (�4��- 7 � E* 0
:آ�
sum(2,5)
��� $� �$ � v�& $��!� \ �� �"�# \ �� ...(5�/, $�B �,.
A[ :
:آ�
if(sum(2,5) > 7) { print ("Grater"); } else { print ("Less or Equal"); }
N�F4 (% :
|} �8��B �1�B function , return �1�#84�� ����4 ;&�B 7��5�,.
m} 0!� �� ���� �$�X: ��4 P[ +,��- �$�X: ��4 C�4��2.
u} ��$� �B 75�� ���� 8c4$�84 � �4�, ��� ���� �, 7Z,$ =�� 84�$ 7 $�B �, +,�- �48, ) ��c)5� 7cTA�3� 7c�S5 7c14
8��B(.
�} $��!� �, �B �� �� +,�- $� return 0!� ?8� ��1- +,�- (�!�, � 8c4� ?8� ����4 +,�- �48, $� �B �8S, N�$��!�
84�� 714 ����.
www.RightClick.ir ��
(.� ����) �, ��/-$�MySql(:
E�,��5� �, ��/-$� ��� � ��� � MySql �8� ��� � �$.
I ��& E�,��5� A�
��4 P[ 75�� ?��� (��B 7 ?��3j �)4�� �$ �� �� ?��� �B 0�� 75�� �5 E�,��5� ��,$�B� �%4� P�15� \ �%4� $�/� �1�B \
� ... C�1� P[ �!5 0RightClick.ir0�* � �� ;�*�- 7 �1- �B ��B 7 �$�8%W4 E�,��5� ��- �$ ��.
���%, 7�84� ��! �� ?��� �B C5� ���, ��8c� �c4�� �, �B �� 7 (��"- 75�� 01�2 �, (� E�,��5� ��3 8���, �����
(Table) (�W� . �$� ���,7 ��%, � 85��W, �b4 $� $8T�' �5 �$ E�, ��5� 8�4�- Table �$ �� �� ��$� ��c� P5�'
��3 ��/T� Table ?$�� �$ ���3 ��3 ��� �8�, (��"-.
�� Table 8��' ��! ;5 ��)���! ( �$�B$ �)�Z! (A[ 0!� ?8� P�F.- Table �� ��5�).4�� ?$�1c� ��c� 8c��'
75�).4�� \ ��4 \ ���4�3 ��47: \ ��$� ��! \ ���$ \ � +Z" ...�B ?8� P�F.- 8c��' �c5 N�OV. C5� �� ��8B �� �,
(�: 7 .
��- ?��� ��! �5 8��B h�' d�# H�3 �5� N�OV. �, 74�5�).4�� N�OV. A[ (5��B �$�� ��8� C5� :
834421\ \ �$8�F!� \ 7/�) �u7!���$�B \ �-��J �B \
84213581� \ C�# \ \ ���0��$� \ $�B \�7!��
820012 \ ���� \ C��# \ �m7!���$�B \ ;56�' \
.
.
.
N�OV. C5� ��! �� ��8B �� �, H�3 )�Z! �� ((�5�: 7 �$�B$ �5 .� ��� $� 85�� 7 ���� ��.�, z�/ .
E�,��5� �, $�B ���, MySql ��! �5 �� 85�, �, �B (��B ?���!� N�$��!� Query ��,� �, � 8�'��S SQL 7 ����4
���: ��5 84�� SQL 85��W� ��5 �$ ��� +5�! $���, � ��#�$ 7��3.
$���, � �4�, �5 � � 8�1-$82)H� 0�- (05�58 ���, MySql �, �B ?8� ����4 PhpMyAdmin �'��S .
H�3 � �4�, PhpMyAdmin 8��B ��, �$) . 75�1���$ :�� �:� Easy PHP !��� �c, 8c��B 7 ?� ��c- �c5� @$��
85��, ��-�:$�� : (
:آ�
http://127.0.0.1/mysql/
� 75�.B 0��T �5 �& 01! $� H�3��$ �1� ��� E�,��5� �B 0 ?8� ��.4 . �c5 0c!�$ 01c! 01�c2 ��- �
����� �, 0�� 01�2 Create new database �B 8��B ��)5� 858� E�,��5� 8�4��� .
www.RightClick.ir �
��4 A[ : MyDB ��$ � 8��B �$�� �$ Create ;��B 8��B . ?8c� ��c��* �5 �B (5�� 7 �W5� �� �5 �$�� H�3
8� ��3�! �1� E�,��5� �B . ����4 �B 0�� 01�2 �5 ��� C5�5� 01�2 $� � :
:آ�
SQL query: CREATE DATABASE `MyDB` ;
� �4�, �)�5� PhpMyAdmin ��� Query �- ?��B ���� �B � 7�!��3$� N���1� ) E�,�c�5� C�3�c! �c)�5� $� ( �$
��)4� ��F� ;1B � ���: ��5 �, C5� � ��5��� �$ ?8,.
01�2 $� H�3 Create new table on database MyDB ��4 Table (�c�F� �$�� �$ (5���, (����V� �B �
A[ : users
01�2 $� � Number of fields 75�� 8��' ��8S- ��� 0�c� ��c�4 ��8c� ���, �B A[c (��c5��� �$m) $�cb�
username � password (0�� .
�, ���, 8S, �� $� N�OcV. �cW5� � �� a�c4 � 8c��' ��4 �1� �� 85� ?��B �$�� P/2 ��#� ��- �B ��8� ��� �$
8���V� .�8� ^�_�- 7F5 7F5 d�#.
Field: �$ 8��' (!� 01�2 C5� $� 7 8��5�4. A[ : username
Type: A[ 8��F� lV. �$ 8��' a�4 01�2 C5� $� � �$�.�� �8� \ ^�� �8� \ ���$ \ ���B�$�B ... ��c4 ���c,
��1� �� �1� ��,$�B VARCHAR) �[B�8# ���$mnn���B�$�B (8��B ?���!�.
Length/Values: $� Q 84$�� ��Q �, ���4 �B 75�� a�4 ���, 01�2 C5� A[c (��8c� �$ 8c��' �� VARCHAR
���4 $� �$ 7T�Q ��3 ?���!� �$� �, ���- �, 85�, �1� (��5��, �$ �� ��Q �1�# �B �$�� �4 � ���, (B �4 �B 85��W, �b4
���, ��5� . ��,$�B ��4 ���, A[ )��[ C5� $� (m{ ��,�3 �8�.
Attributes: 0!� 8��' �, ��,� ��� 0��3 ��! �5�$�� �[B� �B ��� 714 ?���!� .C584 ����- �$ �� (� �1�.
Null: C5� �B 8�B 7 lV. �4 �5 ���, 7T�3 �4��� 8��')�8� ��.�, ^�_�- 7�5�4 � �4�, ��-(.
Default: U�* $�8" 0!� �1� 8��' h�'.
Extra: �5 01�2 C5� $� - C �B ?$�� ���� 8��' ���, 7'�_� N�4�F � ��! (c� ��1� � �8584 7F5 �� ��.�, d�# �
�� 7 ^�_�- .0�� ��� (!� auto_increment 8��8, �8��' �, �$ ��F � C5� �:�)85�, �� a�c4 INT �c��, ( ���
��F� �'�_� 7F5 �$ 8��' C5� �$�B$ �� ���B �'�_� �, 8��')�� 1 ��B 7 a���.(
Primary: �.B EF� �5 e"' ?8.4 ����4 01�2 C5��, �B ?8 ?8� ��.4 �$ C� C5� ��� ��$ @�� C�'$ . C5� �:�
0 A� 8��' �5 ���, �$ 01�2 8c5�/4 �cB 75�c� 8��' ���, d�1S � �.� ��8� 7�� 8��B �A� �, 8��' ��� 8�46,
?$�1� �5 �).4�� �� 85�/4 �B 75�).4�� ?$�1� 8��' P[ �� 7 ?���!� ���, �$��F- 8���, �����.
www.RightClick.ir ��
�,P[ �W5� ��� 01�2 �� Index , Unique �8� ^�_�- 8S,.
�B �8S, 8��' H�3 password (��F� 0!$� d�, ��� 75�1���$ g/Q (� �$ 0��. �1B� ��$ �, 8S, Save ;��B
(��F� .
85�, �.� ��3�! � ��8� Query �6�& �5 �1� ���, �� �5� C5� ��- .
:آ�
SQL query: CREATE TABLE `users` ( `username` VARCHAR( 20 ) NOT NULL , `password` VARCHAR( 32 ) NOT NULL , PRIMARY KEY ( `username` ) ) TYPE = MYISAM ;
��$ �, d�, ��� d�# H�3 Insert �5 � 8��B ;��B username , password ��$ �, � 8��5��, Go 8��B ;��B.
PhpMyAdmin �5� N�4�F ��B ?$�� �� 85��: 7 ��5 �$ �4�� �1� ���B$�B �, . �c, �$�cQ Cc5� (����3 714 � � �
$�B E�, ��5� (58, ��)4� 7�5�4 � �4�, �, �$ ��$�B C5� (����3 7 � \ (��B .��.2 ��' �5 A[ N��AQ� � (���, �����
�5 �5 (��B �$�� ��8� ��- �$ �4�� � (5��W, �,$�B �� �$ ��- �)���(58, ��)4� ��8� .
��- �B C5� ���, php �, MySql ��! �5 (��B $�B (58, ��)4� Y�-�- �, �$ �4�� 85�, �B ?$�� P#�� .
0!�� �, ��O-� : �B 0�� ��-��J �B ��� 0!�� �� $�b� MySql ?��3j �)4�� �� ?��� �1� � �/O4 ��� ��$ C.c�
. d�1S (��5�4 7 � �B 75�� � �4�, ��-��1� localhost 0!� .�, ��O-� ���, �c5 �c, ���4 0!�� username ,
password (5$�� .PO� 0!�� �, �5� $��!� �� ?���!� �, (5�� 7 .
:آ�
mysql_connect( HostName , HostUserName , HostPassword);
��$ �:� � $��!� C5� �� ��[ ���, 8��B 7 $�B 85$�� ��-��3 �-��J �B8��B ?���!� �$�Q C5 :
:آ�
$myconn = mysql_connect( "localhost" , "root" , ""); if($myconn) print ("Connection Sucsessful!"); else print("Connection Failed!");
5� �5$�Q C�:
:آ�
$myconn = mysql_connect( "١٢٧.٠.٠.١" , "root" , ""); if(! $myconn)
www.RightClick.ir ��
print("Connection Failed!"); else print ("Connection Sucsessful!");
��/T� myconn �1� ���, C5� U1!� (���� 0!�� C �B ?���� �5 �� 7& ��!85$�XW, 8����� 0.
��5� 85�, (58� 0F4�B 0!�� �, �B d�# H�3 (��B H�V�4� �$ ��1��, .�5� $��!� �,
:آ�
mysql_select_db(MySqlDataBaseName,ConnectionID);
�3 ��[ ���,��� 7 �$�Q C5� �� :
:آ�
mysql_select_db("MyDB",$myconn);
�$�B �� ��# (5��B H�V�4� (� �$ �� ��3 E�, ��5� d�# H�3 ���c, 8c5�, (��8c, ��c)4� (��c!��3 �B Query
��- �B 75�6�& ��1� (��5��, PhpMyAdmin (� ��� 7 ��.4 ��1%,.
;5 ����� Query :
;5 ����� $��!� Query ��5� :
:آ�
mysql_query(QueryString , ConnectionID);
��[ :
:آ�
mysql_query("SELECT * FROM users" , $myconn);
�5 �B C5� ���, 8���, ?85� �$ ��� � $�B �� �)��4 . ���� �$ �5� 8B8��B :
:آ�
<? $myconn = mysql_connect( "localhost" , "root" , ""); if($myconn) print ("Connection Sucsessful!<br><br>"); else die("<font color=#ff0000> Connection Failed !!! </font><br><br>"); mysql_select_db("MyDB",$myconn); $result = mysql_query("SELECT * FROM users" , $myconn);
www.RightClick.ir ��
for($i = 0 ; $i != mysql_num_rows($result) ; $i++) { print(@mysql_result($result,$i,0)." ".@mysql_result($result,$i,1)."<br><br>"); } ?>
8S, ���� ��- ?$�, $� AB SQL ��B (����3 z�, 7�5�4 .
www.RightClick.ir ��
������() SQL(:
�$� $� ��� � SQL (�: 7 .
SQL kV I ��& Structured Query Language �, � 0!� ��'�5 03�! ��� � @�* ��,� 7�S .
I �� @�*
�5 �� � @�* �AZ� Query (��B $�F& ����, (�5��V� �$ (5$�� �B 7-��AQ� � �B 0!� 7�S C5� �, . A[c ���
(��B �'�_� 75�6�& �5 U%, \ (58, �����- \ (�4�V, �$ ��� �� 7�1�2 \ (�4�V, �$ � ...
��[ :
t} >5$�- �� �B 74��,$�B ��1- 0��T tm C5�$��' tu�n�, (���3 7 �$ 84� ?��B ��4 0/� 8S,.
m}CB P2 �$ 74A' ��,$�B H��# .
u} �B ��,$�B �$��* user�, �,��, ��� ali � �, �$ 0�tmu?8, ����- .
� ��# (�4�1%, �-��J �B �, �$ �� C5� �$�Z& �B (�4�8, (�5��3 7 .
�[B� Query �� (��B 7 ?���!� � �B 75���8����4 �$�3 �5� 0T�# :
|} Select \ �84��3 �)��� ...
�} Insert 858� N��AQ� �$�.
�} Update���! ��W�� �, .
�} Delete N��AQ� iX#.
SELECT:
85�.4 w�: �- (�46� ��[ �5 ���:
:آ�
SELECT user FROM userTable
C5� Query ��8� ��� �$�B$ 7 �1- �� userTable 8��' user �$ 8�B 7 �8�*.
�W5� 7F5 :
:آ�
SELECT user, name, lastName, Id FROM userTable
7 �1- 7F5 C5� j ��� 8��'$��!� ���� ?8� �B SELECT ��8� �� �$ userTable ��B 7 �8�*.
�:� ���� �$ �� 8��' �1� 85�, I 7& ?8, ��.4 (�5��V, �$ �� 8��' �1� SELECT I(��5��,
�� 8�4�- 7 8��5��, �$ �� 8��' �1� ��4 �B C5� ��� �, $�B C5� ���,*?���!� 7�S5 8��B :
www.RightClick.ir ��
:آ�
SELECT * FROM userTable
A[ I7& (����� ��� �5 �:�"��4 �B CB �8�* �$ ��,$�B ��� ��,$�B ali ��� �$��* �tmu0!� "...
$� ��� ���, query �� �� WHERE ?���!� (��F� .�$�Z�5�:
:آ�
SELECT * FROM userTable WHERE userName = 'ali'
C5� 7�S :��� �$�B$ ��1- ��8� userTable �$��� �B CB �8�*
:آ�
userName = 'ali'
�$ 8���, �����.
C5� A[ I 8���, ����� 0T�# 8�& �� �� ��� �:�:
:آ�
SELECT * FROM userTable WHERE userName = 'ali' AND userPassword='123'
7c�S5 : ��c1- ��8c� ��c� �$�cB$ userTable 8c��' �cB CcB �8c�* �$ userName , ��� �c, �c,�� ali 8c��' �
userPassword �, �,��, ���tmu���, .
��� �, �4��� Y�-�- C�1� �, AND �1�B OR '�_� 8��!��3 7Q�� �� C�4��� C��r1� C58, $��2 �$�8��B .
7���3 ��� ?��� ���! Y-� :
���B Y-� ���, ��- $��!� C5� �� 8��' ;5 @�!��, 7���3 Query (��F� ?���!�.
:آ�
ORDER BY FieldName ASC
�B FieldName 7 N$� ��� @�!� �, ���! Y-� �B 0�� �8��' ��4 ��� � ?��: ASC ���c! Y-� �B �W�
���, 7T�64 ���! Y-� (�5��V, �:� M ���, ���S ��� �, ASC �� DESC (��B 7 ?���!�.
��[ :
:آ�
SELECT * FROM postTable WHERE postId>50 ORDER BY postTitle ASC
�& 7�S5..I
www.RightClick.ir ��
�$�B$ ��1- ��8� ��� postTable 8��' $�8" �B CB �8�* �$ postId �� ��:$6, ���n{ ��� � �c��, @�c!� �c, �$
8��' postTitle CB Y-� ���S N$� �,.
I 7& C., ?��� ��.4 �$��F- ��� ?��� (�5��V4 �:�
��
:آ�
GROUP BY FieldName
(��F� ?���!�.
A[ :
:آ�
SELECT * FROM postTable WHERE senderId=103 GROUP BY posted
7�S5 :�$�B$ ��1- ��8� �� �$ �� postTable 8��' �B ?8, U5�14 postID )?8��B ��!$� 8B ( �,��, ���t{u 0c!� .
CB iX# �$ �$��F- ��� 0�* � . )�B 75�� �$�B$ ��� postID 7F5 e"' 84$�� 7%,�. ?8, ��.4 �$ ���(.
���/4 7,�3 ��[ 85��...
�)���:
��� ?��� $� �)��� ���, �:� A[ �B 7-$� �, ��8� �5 ali �)��� �$9 N$�c/� P �� �B 7)5��4 7 �1- (5�� ali
(��� ��.4 �$ ��.� .
:آ�
SELECT * FROM postTable WHERE postBody LIKE '%ali%'
�B 75��6�& ��1- ��- ali ��F� �8�* �$ ���,\ �, ��.T�� �B 75�4�� e"' (�5��V, �:� ali �c, �c� 7c a��c� ��c�
'%ali%' ��3� e"' %7�S5 (5$�X: 7 :
:آ�
SELECT * FROM postTable WHERE postBody LIKE 'ali%'
�, �B 75�4�� ���, ali UT�� e"' �4�$�� C� 7 (�3 % (5$�X: 7.
���, 0'$ 7 ���5 0��� ;5 �)��4 ���1� SELECT +,�- �� ���, (% �� ��, ��8S- e"' �B COUNT 7 ?���!�
(��B:
:آ�
SELECT COUNT(*) FROM userTable WHERE registerDate < '85/10/15'
www.RightClick.ir ��
+,��- ��/T� 8�., (: $� �! ��F1 ��& (: 714 AS' �B 0�� (� �� �W5�.
INSERT:
C5� query ��- 858� ��B$ �$� ���, �.� ?���!� ��8�.
�$�Q C5�:
:آ�
INSERT INTO myTable (userName, userPassword, userReallyName) VALUES ('ali', '123', 'Ali Agho')
�� 7 ���- ��/T� �., ?84�3 ���#�$ �B (���4 e3 8�& �- $�Z�5� (� ��-�� � �4�, ��-8��5��, �.
C5� H�3 query ��8� ��- �$ 858� �$�B$ �5 myTable 8c��' $�8c" �cB �c�F� �$� userName ��� ali �
8��' $�8" userPassword ��� 123 8��' $�8" � userReallyName ��� Ali Agho 0��.
�8��' �:� 7T�� 6�4��* �- ?$�84 7T�F�� 8��5��4 �$)��� 8��' �:� ��/T� Not NULL ���/4 ($�8" Default ��- $��2
���, ?8.4 C��S- ��8� C�3�! +2� �:� �B ?��W� Null 8� 8���3 .N$� �� $� ��c- �cB �8c��' ��8cS- 7��5�,
�,��, ��� 6�4��* 8��' ��8S- �, 8��5�4 7 7T�� 6�4��* ���,.
��� 6�4��* ��- 02�4�� 85$�XW4 �$ ��� 6�4��* AB 8�4��� C1_ $����, 8��B C��S- $�8" 7��5�, �� 8��' ��1-.
��F4 �5 :
��- MySQL 8�4��� n �5 �, �$ �$�B$ �- query 8��B �$� .��[ :
:آ�
INSERT INTO myTable VALUES ('ali', '123', 'Ali Agho'), ('mojataba', '1100012', 'Agh Mojtaba'), ('reza', '1545587ax1', 'Agha Reza')
7:��! C�1� �,.
UPDATE:
6�& �5 U5��5� ���, �.� ?���!� .�$��* ����- A[ � Y�Z �5 U5��5� \ ...
��[ :
:آ�
UPDATE myTable SET userName='ali'
7�S5 :��8� ��� �$�B$ ��1- ���, myTable 8��' $�8" userName �, �$ ali ?8, ����- ...
www.RightClick.ir ��
�� �$�B$ ��1- \�&I �
(5��F4 C��S- 7Q�� �B C5� ���, .�$�B$ �, ��8� 02� ��� (��5��, �$�Q C5� �:� )��� (�� 7 7�3:
:آ�
UPDATE myTable SET userName='ali' WHERE userID=53
75�� �$�B$ e"' 8��' $�8" �B userID �, �,��, �4��nu8��F� ����- ���, .
�� 61� (�4��� � ' �- 8�&(58, ����- (� �, �$ 8��:
:آ�
UPDATE myTable SET userName='ali', userPassword='123', userReallyName = 'Ali Aghoye Gol' WHERE userID=53
WHERE P[ �)�5� ��- SELECT 0��.
DELETE:
���, �.� ?���!� ��8� �� �$�B$ iX# .A[ :
:آ�
DELETE FROM myTable
. رو حذف ميكنه myTable تمامي ركورد هاي جدول
���- :
t} �� 8S, �)�5� DELETE �� P/2 � FROM �, 0��4 �6�& SELECT 8��F4 ?�/���.
m} $�� C5� Y��� 7��3 85�, query 8���, �� .�5 �Q�3 �, �� 02� 7�S, ��& 0c!� �� �6�& 7��3 �T�&�B ?�/���
84��� .
(����V, �:��$�B$)��� (�$ 7�3 P[ (��B ?���!� ��� �� 7��5�, (��B iX# update :
:آ�
DELETE FROM myTable WHERE userID=662
75�� �$�B$ e"' 8��' $�8" �B ��B 7 iX# �$ userID �,��, �4����m���, .
��, C5� � H�3 query .
��d AS' �B 75��6�& � (W, ?��! 7��3 ���B 7S! C (�W4 ��/4 �$ �c �d �cB 75�c�6�& (58�!$ U%, �B +2� �, \
(W� .
www.RightClick.ir ��
� ����.(�) �)��� 01�2 03�!(:
03�! ��� � ��� �5-��AQ� L4�, $� �)��� L7 ��� � �$ �85(.
�-�� 5�, 01�2 C Request ��, � ��5,�7� �� N��AQ� 5, ��� ���� E7�� 5(.
��� H�35��' � 4�$�� ��5�9 (�)��� ��' � � 7��� :
:آ�
<form method="get" action="search.php"> <p> <input type="text" name="q" size="20"> <input type="submit" value="Search" name="searchBtn"> </p> </form>
d�, 8B 84��* �, P5�' �5 ��- �$ html 8��B ?��3j.
, d�#� �4� phpMyAdmin ��, �$ 7 �9� � (5� �5,���8� E5�- � 8� ��� 58� ��8� �5 c 87 ��c! 5 () �c:� �c�/T�
T�8�7 �9 7 ��3�5��W, ��- (5���, ����84 ���� ((.
�� ��8� 03�! ���, SQL ?���!� �5� 8��B:
:آ�
CREATE TABLE `text` ( `id` INT NOT NULL AUTO_INCREMENT , `title` VARCHAR( 255 ) NOT NULL , `body` TEXT NOT NULL , PRIMARY KEY ( `id` ) ) TYPE = MYISAM ;
)��- phpMyAdmin ��$ �, �b4 �$� E�, ��5� H�V�4� �� E* SQL 8c��B 7cJB �c)4�� �$ d�, 8B � 8��B ;��B
��$ �, 8S, Go �b4 �$� ��8� �- 8��B ;��B �., ��3�!(.
C5� �� 8S,��8� �B text ��$ 8��3�! �$ Insert 8�& � 8��B ;��B 8��B �$�� ��8� ��- �$�B$ �- . ) 7Sc! AcS'
8S, �- 8��B �$�� C�-d 8��B ... (.
� �4�� ��- N��AQ� ��! �5 �B ��8� �5 � (5$�� �)��� ��' �5 � d�# H�3 (��B �)��� ��� ��- (�5��V� ...
* �' C�3�! x��! (5�, H�3P5 search.php �B ?$�B 01�2 C5��1% :
P[ �W.5��5� �5 notepad �5 Dream Weaver 8��B ��,.
www.RightClick.ir �
�1B� ��$ �, �,$�B �B 7S2� search P5�' ��- html � ��' ��� ��F� ;��B 7T�� �c, �c4�� ��$ �cB 75���� 7 �1-
P5�' � $��! �- ��� ����5��" search.php ���, � �B (5��B C��S-. ��c3 �� �B 0�� �5�$� �5 php � 0�c�
?8� ��!$� ��' �5��" 7 �1- $�8" A[ ?��W� $��2 ��� ��- Edit Box �$ ��� ��4 �B � q C5� ��- ?�� (����X: :
:آ�
$_GET["q"]
C5� GET �, � ��' �B ?�� $�B �, 7S2� ���, method c get �, �:� ?8� ��!$� post �� ��c, ?8� ��!$� POST
(5��F� ?���!�)�, 85�, �B 8��B 02� C., ����4 �$6, i��#(.
(5�� E* ?��B �$�� 7& �,$�B �B (�4�8� �B d�# H�3 8S, 01�2 x��!.
�W5� ?�$ �� 8 �� ��Z�� �,$�B �5 �:� (W, ��'�4 ���5 �- 7�!�$ P5�' �� search.php �$ ��� @$�� A[c ��cB ��, �$
��- Address Bar 0��4 ...02�4�� ��4 �, �6�&
:آ�
$_GET["q"]
���� ?8� $�$$� � �, � �4�, � ?$�84 (��B 0/� ?$��2 �$ �6�& �B 75���� ��- C��r1� \ (Insert) 7T�3 �$�B$ 85�/4
�., 0/� ...
��4 �, 7S,�- �� 7��5�, $�B C5� ���, isset �$�Z�5� \ (��B ?���!� :
:آ�
if(isset($_GET['q'])) { ... }
�B 7-$� $� +,�- C5� $�8" ���, ����� ���� ����� C�r1� true N$� C5� ��] $� � �4���W� �, false �, 7c
�4���: .(��F� ;& �$ ��� ��1�5�' 7T�� ��Z3 ��- � E*.
:آ�
if(!isset($_GET['q'])) die("The Search key word is not set !!!");
�� �,$�B �B 7-$� $� (��B 7 v�& �Z3 ����* �5 ���, ?8.4 P"�� �� C5� �, ��' g5�Q.
d�# H�3 C5� �, ?$�XW4 7T�3 �$ �)��� �$� $�8" �,$�B �B (��B ;& 85�, :
:آ�
$key = $_GET['q']; if($key == "") die("The Search key word must be entered !!!");
www.RightClick.ir ��
�2�7� �, 5 �)��!��� (5�G1Z �W��Q �� �,$�9 �9 (5�, ��' g �5� �:� ��& ?8 �� �)�5 d�c, ��cZ3 $� ��c/4 $�cZ�75 �c,
$��!� die 7 ��5�* �, � �4�, (58�!$ 714 �)�5� �, � 8�!$.
?��� ?�W5�* ���$�B d�# H�3)�)��� ( :
- A/2 �B �$ E�,��5� �, ��/-$� ��� 8B �1� �� ���(��5��� �$ ?8� ?��� ^�_� :
:آ�
$DbConn = mysql_connect("localhodt", "root", "" ) or die(mysql_error()); mysql_select_db("test",$DbConn) or die("Can Not Select DataBase Because: ". mysql_error());
8� ��)4� 0�"'� �, ��O-� �B d�# H�3 ��! (5�, \x SQL :
:آ�
$sql = "SELECT * FROM `text` WHERE `title` LIKE '%".$key ."%' ";
� �B 8��B 02� 8��' @�!� �, �$ �)��� title ��8� �� text 8��' �B ��$�B$ �� � (58� ��)4� title ��� ��3 ���
� ��, �$ ��B 7 �$�� �,$�B �B ���, �6�& �,��, ��� �� 7�1�2 �5�8�* � ��F� .
d�# H�3 query (��F� ���� �$ :
:آ�
$SearchResult = mysql_query($sql) or die(mysql_error(). "<br />SQL: ". $sql);
�- �:� ?���!� �, �$ �)��� w5��4 d�, e3 ����� �, ���, ?8� ��)4� 0�"'� �, 6�& �1� d�# ���� �� SearchResult
7 0!� �, (5$�� .� (���/, 8�5��, �1� �� ����8�& � ��)� ����� �)��4 �- :
:آ�
$TotalResults = mysql_num_rows($SearchResult);
���� $� �$ w5��4 ��8S- d�, e3 TotalResults ?65$ 7 .
?��, �, $� �� �)��4 �:� �B (��F� ;& �$ ?8 � 0!� �, w5��4 ��8S- d�# H�3 ���)�� ( ��c/4 �c:� � (�c�B v�c& �$
(��B v�& Y!�� ����*:
:آ�
if($TotalResults <= 0) die("Not found any record for your key word !!!");
d�# H�3 (��F� v�& �$ w5��4 :
www.RightClick.ir ��
;5 w5��4 �, 7,���!� ���, �B (�4�8, 85�, ��� query 85�, +,�- �� mysql_result (��F� ?���!� . ���� ��%, ��[ �,
85�� 7 :
:آ�
for($i = 0; $i != $TotalResults; $i++ ) { //<!-- Start of Print Results... $TextTitle = mysql_result($SearchResult, $i, 1); $TextBody = mysql_result($SearchResult, $i, 2); print($TextTitle ." ==> ". $TextBody ."<br /><br />"); //End of Print Results. --> }
+,�- d�, �"�# ��- mysql_result ���$� �! �, �B (���/� �$ �c)��4 �cB 0�c� ��c��� ��� ���$� ?8� 74�3��'
����� Query ���$� \ (��V5$ ��� ��- �$ �� � ?8� �8�* � ��)��� ��- �B 0!� ���B$ ?$�1� ��� a��� �
�.� )�B ��F1 ��& (�c�B v�c& 7cF5 7F5 �$ �4�� �"�# ��- 7��5�, 8�B �8�* �$ �$�B$ 8�& � ��)��� \ ���$�
8��' E584� ��!)���! (�.� a��� � �� (� ��� �B 0!� � ��8�.
� ��� � P �B @$�! (� C5� :
:آ�
<?php if(!isset($_GET['q'])) die("The Search key word is not set!"); $key = $_GET['q']; if($key == "") die("The Search key word must be entered!"); $DbConn = mysql_connect("localhodt", "root", "" ) or die(mysql_error()); mysql_select_db("test",$DbConn) or die("Can Not Select DataBase Because: ". mysql_error()); $sql = "SELECT * FROM `text` WHERE `title` LIKE '%".$key ."%' "; $SearchResult = mysql_query($sql) or die(mysql_error(). "<br />SQL: ". $sql); $TotalResults = mysql_num_rows($SearchResult); if($TotalResults <= 0) die("Not found any record for your key word!"); for($i = 0; $i != $TotalResults; $i++ ) {
www.RightClick.ir ��
//<!-- Start of Print Results... $TextTitle = mysql_result($SearchResult, $i, 1); $TextBody = mysql_result($SearchResult, $i, 2); print($TextTitle ." ==> ". $TextBody ."<br /><br />"); //End of Print Results. --> } ?>
��F4:P5�' html P5�' � (��3�! ��� �B � search.php 8���, ���. $8T�' �5 ��- �$.
���-:8B C5� �� 8��!��3 �:� C5� ��& �B P�T� C5� �, \ 8��B N$�. C �, �1�# 8��F, 7�1� ?���!� ����5��,� ��-
8�r�* 7��3 �B ?8.4 05��$ ��� ��- 7��� � P��� ?$�� 7��� � �/�� 8B�.4 ?.
�Ac- �c, ?8� ��)4� �)��� �$� �5 ���, e"' 0!� ?��! 7��3 C5� C1_ $� 8c�4��� ��.c�, query ?8c�r�* ��c�
�� � N8 A[ 8��F, �W5� ��$�B 7��3 � 8��5��, �)��c� �$�c �cB �8��B ��� �1�B �5 85$��, 0!� �, �$ �)���
w5��4 ��- �$ ��'�: $��2 � (58, ��.4 7W4$ ...
www.RightClick.ir ��
����%4() 03�!Login(:
��� � �4�, (�4�- 7 (��'�: ��5 �$ E�,��5� �, ���B $�B ��$ ��& 8S, �, C5� �� ���,$�cB � $�cV, �$� �c, \ YcT��
(��5��, .
� �4�, ;5 03�! ��� � Login �Q C5� ���: ��5 �4�%, �, �8� ��� � �$� �� ?���!� Session 85��W� ��5 (� �$ ��.
�5 �, ���4 �1� �� ��� Table �4�� P3�� � ���,$�B $�/� 6 $ � ��,$�B ��4 �B (5$�� :
����� �, Query $� �5� PhpMyAdmin 85���, �$ �b4 �$� ��8�:
:آ�
CREATE TABLE `user_table` ( `user` VARCHAR( 32 ) NOT NULL , `pass` VARCHAR( 32 ) NOT NULL ) TYPE = MYISAM ;
�- 8�& �5 user ��- (� ��� Insert 8��B.
��' �5 8S, Login (��F� 0!$� :
:آ�
<form method="POST" > <p>User name: <input type="text" name="user_name" size="20"></p> <p>Password: <input type="password" name="password" size="20"></p> <p><input type="submit" value="Login" name="login_btn"></p> </form>
d�# H�3 P5�' ��- login.php 7�!��3$� =�� �:� �B (�W� ��� (5���, (� �, ?$��2 �B (Request) ?8.c4 ��!$�
?8, ��.4 �$ ��' .��B ��$� �1B� ��$ �, �:� (��F� 7!$�, �5� ��� $� E*; �c, ��c,� ��c� $�cB 0c!� ?8c�
Login 7 ��.4 �$ ��' �8S, ��Z3 ��- �4 �:�� ?8, ��)4� �$ (5�.
:آ�
<?php if(isset($_POST['login_btn'])) { // --- // --- // --- }//End of if(isset($_POST['login_btn'])); ?>
www.RightClick.ir ��
5$�� 7�!��3$� (��B h�' d�# H�30!� ?8� ��!$� ��' 7�S5 ( \ �$��* � ��,$�B ��4 �B (���/, (��B ;& 85�, E*
I �4 �5 ��!$� ?8� �$��
��� H�3 �� �5��" Text Box (565�� ���� �� $� �$ $�/� �1�B � ��,$�B ��4 :
:آ�
$user_name = $_POST['user_name']; $password = $_POST['password'];
H�3 d�#��,�� 5/, �9 C��� 8���� 0!$� (5�, �4 �5 �� 85� Query (��B ?���!� :
:آ�
$sql = "SELECT `pass` FROM `user_table` WHERE `user` = '$user_name'";
d�# � ���B ���� Query:
:آ�
mysql_connect('localhost','root',''); mysql_select_db('test'); $sql = "SELECT `pass` FROM `user_table` WHERE `user` = '$user_name'"; $result = mysql_query($sql) or die(mysql_error());
H�3 (�c�B 7c ;c& (� �$ 7�'�5$� $�/� �1�B �� �)��4 �8� �8�* N$� $� d�# . �cB (�c��/, ��� w5�c�4 ��8cS-
SELECT (5�, (5$�� �)��4 ;5 �:� \ 0!� �- 8�&�$��* 7!$�, x��!:
:آ�
if(mysql_num_rows($result) == 1) { //Check Password ... if($password == mysql_result($result,0)) { //Logined Ok! print("Ok"); exit(); } } print("The User name And/Or password is invalid!");
8B d�# H�3 (�5�4 7 �$ �� P �B :
:آ�
<html> <head> <title>Login Page...</title>
www.RightClick.ir ��
</head> <body style="font-family:arial;font-size:10pt"> <?php if(isset($_POST['login_btn'])) { $user_name = $_POST['user_name']; $password = $_POST['password']; mysql_connect('localhost','root',''); mysql_select_db('test'); $sql = "SELECT `pass` FROM `user_table` WHERE `user` = '$user_name'"; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result) == 1) { //Check Password ... if($password == mysql_result($result,0)) { //Logined Ok! print("Ok"); exit(); } } print("The User name And/Or password is invalid!"); } //End of if(isset($_POST['login_btn'])); ?> <form method="POST"> <p>User name: <input type="text" name="user_name" size="20"></p> <p>Password: <input type="password" name="password" size="20"></p> <p><input type="submit" value="Login" name="login_btn"></p> </form> </body> </html>
Session:
5�� � H�3�$ �,$�B 0 (5��B 7!$�, �� C5� ��- ... �c5 �c 8c��B h�c' I 7& (��'$ �W5� �� �5 �, �:� � �
��B ��!$� �$ �6�& �5 �4��� �,$�B �� ��� ��- A[ �B (5$�� �,$�B ���, ��� 7c!��!� N�c�AQ� ��! �5 �,
���, ����� ...1474�- ��- (���4 �,$�9 �� �� �� �,$�9�1�9 � !�J, �$ $�/� �� �9 ( ... �c��� 8c5�, $�B C5� ���, I
(���, ����� 75�� ���� a�4 C5� �, ���, 7,���!� P,�2 05�! N�� 7 �1- ��- �B (Session)7 (�:.
www.RightClick.ir ��
�����(�) Session(:
� �4�, ;5 P/2 ���� ��- Login � �4�, �5 (� �, � (5��� $��2 7!$�, �$� �$ Login ���4(� ...
�,$�B 8��B h�' H�3 Login � ��B UserName � Password � ��, 0!$� ��� �cW5� N��c �c, 0c!��3
�B 7-$� $� � ?�, 05�! Login 7!��!� N�� ��� �, ���, ?��B (58c, U%, ���.�, N�4�F � A[ �5 ���, �����
...�� (58 �� �� ��� ��- 7�2� H�3 �,$�B �B (�1%, �)B Login ?��B ... �c��� �c5 A[ �B ��5� ��%��$ �� 7F5
� (5��W, �$ ��� true (��B ;& �4�� �� �� ��- 8S, (��B ...����� �B 7�2� �B ��& �� 714 �4 �c, ��c ;5
+,�c� C5� �� 7F5 �.� ���� ��'�: (���! �� �B 7S,�� ��1- �!$ 7 ��5�* ���c� �cb'�# (RAM) ��c� �c��� �cB
�1 �4�,�$� �, ��$ C5� E* C� 7 ?��3j ��� ��- � ?$�3 714 ....
(��B $�F& E* H�3 ...��- �B ��5� ��� � 0�� �W5� ��$ �5 (��B ?��3j �$ �� ���� �,$�B �-��J �B ... �.c� �W
I ��, �:$�� ��� 7B�B ��- ...7��5�* $���, 0�� � �� �B ��& �� 714 ���- ��$ C5� 7T� ?$��$�3�, ...
�, �B �4� 7 �W5� ��1S ��$ �5 H�3 Session) ���� (�'��S �c��� $�c� �5 �B ?$��2 C5� �� ��� $�B ��$ �
?��3j $��! ��$ �$ (�W� U%, � �B ��3 �c� ���c, � (c5$�� 7!��!� U%, 05�! N�� ��1- ��- �� �B ��F�
� ?��' �, �O�� �,$�B (���! ;5 ���, �B �56�& �"�2� C5� Login (5$�� ���4 U%, ���,$�B ... �c, �$�cZ& H�c3
(��B $�B ��� ...I
��[ �5 :
:آ�
$_SESSION['LogedIn'] = true;
��[ C5� ��- H�3 LogedIn ���� ��4 session � 0�� � true (5��� $��2 ��� ��- �B 0�� �$�8" .
(% N�F4 :
|} �8��B �1�B SESSION �, �1�# 7��5�,��� ?��, $�B �, (���4 �B 7�F� C�1� �, � ��� ����4 �$6, i��# .
m} ��� �, ' �� 8�4��� "8��B ?���!� (�.
�} $��!� �, �B 7�2� �- ?$ 714 C�, �� �5 ��B 714 ����- ��3 �, ��3 85��F4 h�� �$ ��� $�8" ^5�.
�} ���� ;5 e"' �� ?���!� �, ��8� Session 8���, 714.�� 8�4��� A[ �� kc��V ��c� ��4 �, 8�5��V, �B �- 8�&
8���, ����� �4��.
�} �B 7-$� $� lV. �� � ;5 �� 8S, ���, ����84 $��! �, 7Q�/-$� �,$�B Session ?�� C�, �� ���.) �c, ��c/-$�
8�B ��, �$ � 05�! �� �� ;5 A[ �B C5� 7�S5 $��! (...�� � N8 C5� �- lV. (�cb�- Pc,�2 $��c! �58 e!
0��.
� �4�, �5 8�5��, H�3 Login �T�&�B �,$�B �:� �B (��B 0!$� Login 7c!��!� �cb4 �$�c �� �5 �, ���, ?��B
���, ����� ...
www.RightClick.ir ��
(% ��F4 :
* $� �B C5� �� P/2 ��c ;c5 php �� Session �c1�# 7��c5�, (�c�B ?���c!� �c� Session �$ Start (�c�B .
,$��!� C���4 �
:آ�
session_start();
$� �� (�4��� ��1�5�' ��� Session (��B ?���!� ��1 �4�, $�.
** (% ��F4 : $��!� �� �B C5� �� P/2
:آ�
session_start();
$��!� �� 7�S5 (���, ����� 7���3 =�� 85�/4 (��B ?���!� print � (��B ?���!� 85�/4 C5� ��[ �C��r1� HTML
(���, ����� 85�/4 (� ����.
H�3 �� �1� �� ��� Login �� ;5 �B (��F� 0!$� �$ HTML 0�� :
:آ�
<html> <head> <title>Login User...</title> </head> <body> <form method="POST" action="login.php"> <p>UserName: <input type="text" name="username" size="20"></p> <p>Password: <input type="password" name="password" size="20"></p> <p><input type="submit" value="Login" name="LoginBtn"></p> </form> </body> </html>
(!� (5$�XW� �$ (��3�! �B �� �� C5� index.html .
, H�3�� x��! (5� login.php �� ��� ��- �B user, Password �.� 7!$�,
$��!� �1� �� ���
:آ�
session_start();
www.RightClick.ir ��
8��' �� C�V5$ 8S, username, password � ���� �-�� ��- �4�� 7!$�,) ?8�r�* ��5� �B C5� ���, 01�2 C5� $�
�.4 user,pass E�, ��5� �, �$ - \ (��B 714 ;&8� ?��� ^�_�- P/2 01�2 ��( .
:آ�
<?php session_start(); $user = strtolower($_POST['username']); $pass = $_POST['password']; if($user == 'ali' && $pass == '123') { $_SESSION['LogedIn'] = true; print('<h1>Welcome</h1><br /><br />Click on the below link :<br /><br />'); print('<a href="user.php">Go to User Page</a>'); }else{ print('<font color="#FF0000">The User Name And/Or Password is incorrect! Please try again...<br /></font>'); print('<a href="index.html">Back</a>'); } ?>
�:� d�# H�3 userName �$ ali �$ $�/� �1�B � (��B �$��tmu� �, ;��T �5 � ��.� �$�� (�46, �c �B ?8� ��.4
�� �, �$ user.php ��B 7 05�8�.
��F4:��4 �B 75�)4�� +,�- �, �$ ��� �84�3 ��' ��� ���� �� �$ ��,$�B strtolower P58/- ;&�B i��# �, ���cB
�B �:� �-�., (���! �$�� �4��, (� ��, ��B �$�� �$6, �$ ��3 ��,$�B ��4 �,$
:آ�
$user = strtolower($_POST['username']);
�� x��! (5�, d�# H�3 user.php ...
�� (�5��3 7 ��& session ��� e3 ��- �$ ��� (��B ?���!� start (��F� . Ac� �B (��F� ;& 8S, session �
�� ��- �B login.php ?$�� ���� 8� ��3�! �4 �5 ...
:آ�
<?php session_start(); if(isset($_SESSION['LogedIn'])) {
www.RightClick.ir �
if($_SESSION['LogedIn'] == true) { print('<center><h3>Welcome</h3><center>'); ?> <form method="POST" action="user.php"> <input type="submit" value="Logout" name="LoutBtn"> </form> <? exit(); } } print('<font color="#FF0000">Access Denided</font>'); ?>
d�# 7,�3 x��! (5�, LogOut ��X: �� C�1� ��- �1B� �5 �,$�B��B 714 $�B AS' � � (�� ...
���, LogOut �B ��'�B Session (��B ��,�4 �$ ...$��!� �, :
:آ�
session_destroy();
(58� ��)4� �$ $�B C5�.
?8� P �B d�# H�3 user.php :
:آ�
<?php session_start(); if(isset($_POST['LoutBtn'])) { session_destroy(); } if(isset($_SESSION['LogedIn'])) { if($_SESSION['LogedIn'] == true) { print('<center><h3>Welcome</h3><center>'); ?> <form method="POST" action="user.php"> <input type="submit" value="Logout" name="LoutBtn"> </form>
www.RightClick.ir ��
<? exit(); } } print('<font color="#FF0000">Access Denided</font>'); ?>
H�3 ...
��, C5� � Session ?��! ��,� �,.
�T�&�B � �4�, �5 ��- 8S, ��� 01�2 $� 8��B 7 Y�B ���.�, N��,�)- (5��! 7 (� �, �B.
www.RightClick.ir ��
����5���(�) �� ���$(:
$� �� ���$ �$� $� ��� � php 0/�7�9 �(.
ali is a good student \5L 0�� ���$ .1�� �9 $�Q C7, ���& ���$ 8�)� 6��] � Y5/74 � 0�5 ��9�$�9 0. �
0.* �9 (� �!���.
�S-5$� �� ���$ k php :
�S-5$� ���$ k php �S- P[ 5", k�� �� �0!� �� � :
:آ�
$MyStr = "salam";
���$ salam �� $� �$�� MyStr $5�V�( .
�9 02���9 8 $� ���$"" $��2 �W� ��/T� ?��L- �4�� quote ���, (�5�S7� 5$�Q C� ' '�& \ 2�'7I 84$�� (� �,
�$ �� ���$�4����#�$ �, (7�- ��8, �5 (5�9 v�& ��� ( 5�- ��� 5, ����, E565( ... �� ���$7�� 89 C4�- � HTML
�5� JavaScript 8��, ... & �� �A3��� 67...
� 89 �, A[ 5�9 02� ��8 :
:آ�
$MyStr = "salam"; $MyBrackLine = '<br>'; for($i = 0; $i < 5; $i++) { print($i); print(' - '); print($MyStr); print($MyBrackLine); }
5 �- salam �5� v�& (�� (� e3 ?$�1� � ��K� �� �46{ �- � .
�9 02��L- �9 8 <br> �95L L- HTML v�& (� 0��7 ��& � � �� 5 �c- L HTML �c- �c 0�c��
�4 �:$�� ����$ ��� �) �/��� ()?8S, e3 �, C�'$ �9 .(��,�� 52� �8��, ���$ g5��7 source /, �$ ���� c�8 ) $�
�:$�� IE �,5� �, 85� C���, �58(View -> Source .
)(Literals �� ��9�$�9��S �, 7:
www.RightClick.ir ��
�2��:� �!��3� (5�! ���- ��3 ��9�$�9 ��, ���, ��1��$ 5�9 $�K& 8�� A[ (5 ���cV, �9 C� ( c5� 0c A�" ec!�
\ ���, ��1��$
/,��� e!� �$ ��1��$ � �:� 8" "$�XW, 5��� e!� ( 1474�- � ( "$�XW,5 �K' ��& (�� �9 ��K5 � ?8� ��1- ���$ �)�
", ����Z3 ��� � �W� ?� ...��,�� P# 5 PK. C5 �� P/2 ��9�$�9 �" �$�XW5� �, � (5 U%, $�9 C�W�( � �, �95 $�c9 C�
� ��, ����845�� �� C ...
�� ��9�$�9��S �, 7 :
n 8� e358
r�Z! �!
t 5L Tab ��� �,
$$d�� 0 A�
" P,�� -�9�C.
� �� ��89 ��5-$� �, � ���$ $� �9 �� ��9�$�9 C7, ���52 �9 8�P/ �- ���, ��� ������3 7�S 7 c�3 7 c 7 8c��
)�� ��1�75����4 ���� �9 ( .
���- : ��, ����84 +2�-��- �:� �9 8� 5���$ L n 5� r 5� t ���X:� �c- 8� �4 ��c-�:$�� � �$ �c) /,�� c� �$ ��c& 8�
source ��-� ���$ �4 �$�XW����3 7 HTML ... �1�#7!�* ��& �, E* 8 �$�7 ?$�3 ...I
��K4:�- � php 5 �6T ���$ �7�- �9 ?$�84 � 5���, e3 � � 89 A[ 50!� 0!$� A �9 � :
:آ�
$MyString = 'Salam bacheha ... hame khubin ... Felan Bye';
f�'" �, '& �I �
T �9 d�#��: �$ �� �����( �4���� f�' (5W, (� �$ �� C�( ...
�� ��9�$�9 �� �:�� �, �S7�9 ?���!� �( �,5��7 �� �1�# " "�9 ?���!� � �� �:� (' '�9 ?���!� � �c� ��9�$�9 (� �S �c, 7
�, ��� v�& �8� ��1�� 7A[ 84�� :
:آ�
print('Salamnn bacheha');
2�� P3�� ���$ �"' ' v�& �$ � ��K5�S7���3 7� 5�� :
:آ�
Salamnn bacheha
www.RightClick.ir ��
� �5C :
:آ�
print("Salamnn bacheha");
���37 :
:آ�
Salam bacheha
*�9 02� (� ��,�� �9 85���3 C7� �:$�� �� $� 5$�Q C�4 �0� $� e"' Source � �, �� c5 0c!� PKc� C
���V, �:���- (�� �: $�� 5$�Q C��, ���, 5� 85C $�Q���, 5��( :
:آ�
print("Salam<br /><br /> bacheha");
�1���$ N���� ���$ :
6�5� ��65 01�2 C7 ��3�5�$ (��1� �� ���$ ��� N�758, ��)4� �$ 5 �c, \ ��c�$ ���9 �K- �K- \ �)��� P[ ( (c�
� �� ���$ �84�/�& ...
- �� ���$ �84�/�& (� �, :
:آ�
$Str1 = 'Salam'; $str2 = "khubi?"; $str3 = $Str1 . $str2; print($str3);
� $�589 C str1 , str2 (� �, �$7& �4�/�$� � ( Str3 $5�V� ( . �/���1� �, �9 8��#�$ C7 �, 5� c (c� �c, �cZ"47
8�/�&.
5��K4 � :
:آ�
$Str1 = 'Salam'; $str2 = "khubi?"; $Str1 .= $str2;
�5(� 89 C Str2 �, �$ �%�4�� Str1 7�4�/�& .
www.RightClick.ir ��
- �,5���$ �8�� :
+,�- �� ?���!� �, substr �4����1�2 (7 �� 5��/, �$ ���$ L5(
:آ�
$Str1 = 'Salam bacheha khubin'; $str2 = substr($Str1, 15);
�5 ��9�$�9 �� 89 Ctn�, ���$ �� 8S, Str1 �$7���$ $� � ��, Str2 7$ 5�6.
:آ�
$Str1 = 'Salam bacheha khubin'; $str2 = substr($Str1, 5,10);
�5 ��9�$�9 �� 89 Cn�- |� ���$ �� �$ Str1 �$7���$ $� � ��, Str2 7$ 5�6.
- �� ���$ $� �)��� :
+,�- strpos �5��, �$ $�9 C� ��)4� � �8�8 ...
:آ�
$Str1 = 'Salam bacheha khubin'; print(strpos($Str1, 'bacheha'));
�5 89 C �8���$ v�&7�1�9 ��& 8�9 bacheha 0!� (.� ��9�$�9) a��� � �� �$�1���. .(* �:���8 8.4
��r714 v�& ���K .
� �4���W, U%, (��$ 8S, �, �8�& ��9�$�9 �� �9 ( ?��W, :
:آ�
$Str1 = 'Salam bacheha khubin'; print(strpos($Str1, 'bacheha',10));
�5� 89 C� ��9�$�9t{��/4� �, 8S, �, bacheha 7?��: .
- iX# Space ���'�_� 7:
�� ?���!� �, trim ����'�T�3 7 5 iX# �$ ���$ L7�9 �( :
:آ�
$Str1 = ' Salam '; print(trim($Str1));
���37 �5�1�9 e"' 89 C Salam 0!�.
www.RightClick.ir ��
- ��56W5�7 5���$ �, ���$ L� 5�W :
:آ�
$Str1 = 'Salam bacheha khufin ... !!?'; $Str2 = str_replace("salam", "Hello", $Str1);
�5�- 89 C����$ Str1 �1�9 ��/4� �, salam ��� �� � ?��W � �4��5�1�9 8 Hello c �$7 c: �c� ?$�X� 8cS, ���
���37�- �$ � Str2 ��5?6.
www.RightClick.ir ��
����(������) File Database(:
��� � php ! 01�2� (��6)7�5�' E�,��5�(
�� 8�4���� \8��B �8�* 7!$ 0!� �� �, 8�4��- 714 � 85$�84 E�,��5� �1� �:� DBM 8��B ?���!� 7* R� 7* ��3 .
���� ��8, \ ?8� ��)4� ���5��, (� �$�B �1� ��, $��!� �- 8�& e"' �� ��B @� N�$��!��$�� ���3 �.
$��!� �� ?���!� �, dbmopen() 8��B ��, ��, �:� � 85���, ��/4 �:� �$ E�,��5� 8�4���� .
$��!� C5� ?��W� ���$� �- �� ...
0!� N���1� ��)4� ���, ��W5� � P5�' ��� 7T�� :
���, N��AQ� 7,�5��, r
���B �'�_� � N��AQ� 7,�5��, ���, w
C�3�! ���,E�,��5� ���B �'�_� � N��AQ� 7,�5��, �$�� ���� �:� � c
858� E�,��5� ;5 C�3�! n
$��!� �, �$ �� E�,��5� �, $�B �� E* dbmclose() �, PF. �, � �4�, �- (58�/� �$�V4.
(��F� P1� N$� C5� �, N��AQ� ���B �$� ���, :
:آ�
<?php $db = dbmopen("./data","c") or die("Could not open DBM"); dbminsert($db, "Name", "rightclick"); dbmclose($db); ?>
� �8 �� ��� dbmopen() �$ Pc[ �.� �� ��B @� �- C5� (�V5$ ����� ;5 �-Table\ � �� ?���c!� �c, $��c!�
dbminsert() (��3�! �B 7�5�' ��� N��AQ� 7T�� �B ���$� �- �! �B?��W� $��2 @� �- �� 8��' ��4 �.� 7 �� \
0!� ��- $�8" (� 7 �! � �� ��B.
����- ���, (��F� P1� N$� C5� �, 74�!$ ���, ��1� �5 N��AQ� :
:آ�
<?php $db = dbmopen("./data","c") or die("Could not open DBM"); dbmreplace($db,"Name","Mahdi"); dbmclose($db); ?>
7 �$ ��! � ��� e3 0�� �& (�4�� I !
www.RightClick.ir ��
0�� ��1�5�' N��AQ� ���$� U�T�� ��� e3 \ (� 7 �! � �� 8��' ��4 (� 7 �8 8c��' Cc �cB 0c!� �� $�8c"
name �$�� �$ �$�8" rightclick �, mahdi ���� ����-.
�3 ���,4�(��F� P1� �5� N$� �, N��AQ� �8 :
:آ�
<?php $db = dbmopen("./data","c") or die("Could not open DBM"); dbmfetch($db, "Name"); dbmclose($db); ?>
7 �$ ��! � ��� e3 I0�� �& (�4��!
$��!� dbmfetch() ��4 7 �� � P5�' �, ��,� N��AQ� 7T�� �B ?��W� ��$� �- �� 0!� �� 8��'.
(��B 7 ?���!� 8B C5� �� (� 8��' ;5 ���B ��* ���, :
:آ�
<?php $db = dbmopen("./data","c") or die("Could not open DBM"); dbmdelete($db, "Name"); dbmclose($db); ?>
��� e3 ^�_�- :$��!� dbmdelete() 8��' ��4 7 �� � 0!� P5�' �, ��,� N��AQ� 7T�� �B ?��W� ���$� �- ��
�8� ��* ���,.
& 8��' ��- 8�1%' �.� (� �5� $��!� �,�:� \ �4 �5 ?8� 0/� �6� �,��, �$�8" ���, ?8� 0/� true ?8.c4 0/� �:� �
�,��, �$�8" ���, false ��� 7 .
N���_�- :0!� 8��' ��4 7 �� � P5�' �, ��,� N��AQ� 7T��.
:آ�
dbmexists($db, "Name");
8��B 7 �8�* �5� $��!� �� ?���!� �, 8��' C�T�� U5�14 ���, :
:آ�
dbmfirstkey($db);
0!� P5�' N��AQ� (� ��� ?��W� ���$� ;5 e"'.
www.RightClick.ir ��
U5�14 ���, 8��B ?���!� �5� $��!� �� �8S, ��� 8��' :
:آ�
dbmnextkey($db, $key);
��,� U5��$� C� �� � 0!� P5�' N��AQ� �, ��,� U5��$� C�T�� �1� �b4 �$� 8��' 7�/2 8��' �,.
www.RightClick.ir �
���� (��6�! ) +,�-Date(:
C5�\���� +'$ U�F. ?$�� PF. �� �� 75�� �- 7B �� �B �$�6� �$ >5$�- +,�- ��� � �.,.
+,�- �F�5� ��� date() U5�14 YT�2 �, ��,� U�T�� �B ?��W� ���$� �- �� 7c�3 f�c-� (��84 �:� U� �� � 0!�
�& U%, �:� 8�'� 714�$� >5$�- U%, 85�, (5��� �6 ?8, U5�14 (5��� U%, �B 7� �' �� �, �- (��8, �$ �b4.
+,�- C5� YT�2 U5�14 ��8�M 0!� 7�F� C5� :
A P/2 � �%���5 ��.4 �$ �%���8S, �78�� / P/2 �%���-�%���8S,
a f. � �5H �. ��.4 �$ �78�� / f . �-H .�
d 8�&�C ?� �� ��$12$�� �8� N$� �, �$ 7 / {t - {m - {u - ... - ut
D �, �$ ��� ��$ ��4 5�1�9 L / � - � - ... - �
F ?� P �9 ��4 /�$��' 5 C-�$� 5 0.%/- ... -8�!�
g �145 N$� �, 0��! Utm����! / t - m - u - ... - tm
G �145N$� �, 0��! U �� ����! / { - t - m - ... - mu
h �145 N$� �, 0��! Utm12$�� ����! 7 / {t - {m - ... - tm
H �145 N$� �, 0��! Um�12$ �� ����! 7 / {{ - {t - {m - ... - mu
i �1452� U��"/ {{ - {t - {m - ... - n�
l (lower L) �145����$ U��8� N$� �, ?� / t - m - ... - tm
m �145 N$� �, ?� U12$�� �8�7 / {t - {m - ... - tm
n �145�8� N$� �, ?� U/ { - t - m - ... - tm
s �1454�� U� �52� L��" / {t - {m - ... - n�
t ?� ?8� lV. ����$ ��8S-)�$�3�8�( / m�
w 8�&��, ��� ��$ C N$�512$ L- �8� L7 / {)5�/�.K ( - t - m - ... - �
y �145�! U�8� N$� �, � 12$��7 / �n - �� ...
Y �14512$ $�%& �8� N$� �, ��! U7 / tu�n - tu�� ...
8��B ?���!� $��!� C5� �� ��� �� �$�* $� >5$�- ���� $��2 ���, d�# strtotime() P58/- $��!� C5� �, �B ���8�� �5
N$� C5� $� ��& 8��B ?���!� 84� ?8� 5��, 7��/��� >5$�-�$�� 7 ����, ���.
02� ��$�� 0!8, ���,=5��5��:(� 8��B ?���!� +,�- C5� �� 8�4���� :
:آ�
gmdate()
C5� 0!� 75d�, +,�- P[ (� +,�-.
���V, �:� d�#�� �, �$ ��# �� � 85H��# +,�- C �9�8\� 5 C ��)4� �$ ��1��78��� :
www.RightClick.ir ��
:آ�
gmdate("Y-m-d H:i:s", strtotime(time() + (3.5 * 3600)));
: ���,�XCB ?���!� 8B C5� �� >5$�- C�� :
:آ�
date("l j F Y g:i A");
�B l j F Y g:i A 0!� >5$�- � 0��! U5�14 YT�2) ��� g/Q (�: d�, �B �� ?8��2.(
�, ?8, U5�14 7���3 7 �B �$ 7V5$�- 7�!��3 �:� d�# ���t��t-tm-{t tm:u{:{{ $�- �5� 8B $�5 ��A� �, �$ >
CB �$��.
:آ�
date("l j F Y g:i A", strtotime("1991-12-01 12:30:00"));
C5� �� (� 7!$�' >5$�- C���X: ���, �B ?���!� 8B8� :
:آ�
<?php /* Jalali Date function by Milad Rastian (miladmovie AT yahoo DOT com) //The main function which convert Gregorian to Jalali calendars is: // Copyright (C) 2000 Roozbeh Pournader and Mohammad Toossi //you can see complete note of those function in down of the page AND JALAI DATE FUNCTION this function is simillar than date function in PHP you can find more about it in http://jdf.farsiprojects.com Copyright (C)2003 FARSI PROJECTS GROUP // //\\ // //\\ // ////// // // \\ // // \\ // // // // \\ // // \\ // // \\ // /////\\\\\ // /////\\\\\ // // \\// // \\ /////// // \\ ////////// ///// /////// //\\ ////// //////// // // // \\ // // // // // \\ // /////// // // /////\\\\\ // // //////// // \\ // ///////// */ function jdate($type,$maket="now") { //set 1 if you want translate number to farsi or if you don't like set 0
www.RightClick.ir ��
$transnumber=0; ///chosse your timezone $TZhours=0; $TZminute=0; $need=""; $result1=""; $result=""; if($maket=="now"){ $year=date("Y"); $month=date("m"); $day=date("d"); list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day); $maket=mktime(date("H")+$TZhours,date("i")+$TZminute,date("s"),date("m"),date("d"),date("Y")); }else{ //$maket=0; $maket+=$TZhours*3600+$TZminute*60; $date=date("Y-m-d",$maket); list( $year, $month, $day ) = preg_split ( '/-/', $date ); list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day); } $need= $maket; $year=date("Y",$need); $month=date("m",$need); $day=date("d",$need); $i=0; $subtype=""; $subtypetemp=""; list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day); while($i<strlen($type)) { $subtype=substr($type,$i,1); if($subtypetemp=="\\") { $result.=$subtype; $i++; continue; } switch ($subtype) { case "A": $result1=date("a",$need); if($result1=="pm") $result.= "از�����"; else $result.=" از��� ! � "; break; case "a": $result1=date("a",$need); if($result1=="pm") $result.= " ظ.ب ";
www.RightClick.ir ��
else $result.=" ظ.ق "; break; case "d": if($jday<10)$result1="0".$jday; else $result1=$jday; if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "D": $result1=date("D",$need); if($result1=="Thu") $result1="پ"; else if($result1=="Sat") $result1="ش"; else if($result1=="Sun") $result1="ى"; else if($result1=="Mon") $result1="د"; else if($result1=="Tue") $result1="س"; else if($result1=="Wed") $result1="چ"; else if($result1=="Thu") $result1="پ"; else if($result1=="Fri") $result1="ج"; $result.=$result1; break; case"F": $result.=monthname($jmonth); break; case "g": $result1=date("g",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "G": $result1=date("G",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "h": $result1=date("h",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "H": $result1=date("H",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "i": $result1=date("i",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "j": $result1=$jday; if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "l":
www.RightClick.ir ��
$result1=date("l",$need); if($result1=="Saturday") $result1="� ��"; else if($result1=="Sunday") $result1="� �,-�"; else if($result1=="Monday") $result1="� دو��"; else if($result1=="Tuesday") $result1="� �� ��"; else if($result1=="Wednesday") $result1="� ر�����"; else if($result1=="Thursday") $result1=" �,/�0� "; else if($result1=="Friday") $result1="��12"; $result.=$result1; break; case "m": if($jmonth<10) $result1="0".$jmonth; else $result1=$jmonth; if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "M": $result.=short_monthname($jmonth); break; case "n": $result1=$jmonth; if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "s": $result1=date("s",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "S": $result.="ام"; break; case "t": $result.=lastday ($month,$day,$year); break; case "w": $result1=date("w",$need); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "y": $result1=substr($jyear,2,4); if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "Y": $result1=$jyear; if($transnumber==1) $result.=Convertnumber2farsi($result1); else $result.=$result1; break; case "U" : $result.=mktime(); break; case "Z" :
www.RightClick.ir ��
$result.=days_of_year($jmonth,$jday,$jyear); break; case "L" : list( $tmp_year, $tmp_month, $tmp_day ) = jalali_to_gregorian(1384, 12, 1); echo $tmp_day; /*if(lastday($tmp_month,$tmp_day,$tmp_year)=="31") $result.="1"; else $result.="0"; */ break; default: $result.=$subtype; } $subtypetemp=substr($type,$i,1); $i++; } return $result; } function jmaketime($hour="",$minute="",$second="",$jmonth="",$jday="",$jyear="") { if(!$hour && !$minute && !$second && !$jmonth && !$jmonth && !$jday && !$jyear) return mktime(); list( $year, $month, $day ) = jalali_to_gregorian($jyear, $jmonth, $jday); $i=mktime($hour,$minute,$second,$month,$day,$year); return $i; } ///Find num of Day Begining Of Month ( 0 for Sat & 6 for Sun) function mstart($month,$day,$year) { list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day); list( $year, $month, $day ) = jalali_to_gregorian($jyear, $jmonth, "1"); $timestamp=mktime(0,0,0,$month,$day,$year); return date("w",$timestamp); } //Find Number Of Days In This Month function lastday ($month,$day,$year) { $jday2=""; $jdate2 =""; $lastdayen=date("d",mktime(0,0,0,$month+1,0,$year)); list( $jyear, $jmonth, $jday ) = gregorian_to_jalali($year, $month, $day); $lastdatep=$jday; $jday=$jday2; while($jday2!="1") { if($day<$lastdayen) {
www.RightClick.ir ��
$day++; list( $jyear, $jmonth, $jday2 ) = gregorian_to_jalali($year, $month, $day); if($jdate2=="1") break; if($jdate2!="1") $lastdatep++; } else { $day=0; $month++; if($month==13) { $month="1"; $year++; } } } return $lastdatep-1; } //Find days in this year untile now function days_of_year($jmonth,$jday,$jyear) { $year=""; $month=""; $year=""; $result=""; if($jmonth=="01") return $jday; for ($i=1;$i<$jmonth || $i==12;$i++) { list( $year, $month, $day ) = jalali_to_gregorian($jyear, $i, "1"); $result+=lastday($month,$day,$year); } return $result+$jday; } //translate number of month to name of month function monthname($month) { if($month=="01") return "4�5ورد�"; if($month=="02") return "6,� ارد�"; if($month=="03") return "�7داد"; if($month=="04") return "�8�"; if($month=="05") return "�9داد"; if($month=="06") return "ر�����"; if($month=="07") return "��9";
www.RightClick.ir ��
if($month=="08") return "ن�;"; if($month=="09") return "ذر;"; if($month=="10") return "دي"; if($month=="11") return "41�"; if($month=="12") return "��>ا�"; } function short_monthname($month) { if($month=="01") return "�5و"; if($month=="02") return "ارد"; if($month=="03") return "�7د"; if($month=="04") return "�8�"; if($month=="05") return "�9د"; if($month=="06") return "���"; if($month=="07") return "��9"; if($month=="08") return "�;"; if($month=="09") return "ذر;"; if($month=="10") return "دي"; if($month=="11") return "?�"; if($month=="12") return "@ا� "; } ////here convert to number in persian function Convertnumber2farsi($srting) { $num0="٠"; $num1="١"; $num2="٢"; $num3="٣"; $num4="B"; $num5="C"; $num6="D"; $num7="٧"; $num8="٨"; $num9="٩";
www.RightClick.ir ��
$stringtemp=""; $len=strlen($srting); for($sub=0;$sub<$len;$sub++) { if(substr($srting,$sub,1)=="0")$stringtemp.=$num0; elseif(substr($srting,$sub,1)=="1")$stringtemp.=$num1; elseif(substr($srting,$sub,1)=="2")$stringtemp.=$num2; elseif(substr($srting,$sub,1)=="3")$stringtemp.=$num3; elseif(substr($srting,$sub,1)=="4")$stringtemp.=$num4; elseif(substr($srting,$sub,1)=="5")$stringtemp.=$num5; elseif(substr($srting,$sub,1)=="6")$stringtemp.=$num6; elseif(substr($srting,$sub,1)=="7")$stringtemp.=$num7; elseif(substr($srting,$sub,1)=="8")$stringtemp.=$num8; elseif(substr($srting,$sub,1)=="9")$stringtemp.=$num9; else $stringtemp.=substr($srting,$sub,1); } return $stringtemp; }///end conver to number in persian function is_kabise($year) { if($year%4==0 && $year%100!=0) return true; return false; } function jcheckdate($month,$day,$year) { $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); if($month<=12 && $month>0) { if($j_days_in_month[$month-1]>=$day && $day>0) return 1; if(is_kabise($year)) echo "Asdsd"; if(is_kabise($year) && $j_days_in_month[$month-1]==31) return 1; } return 0; } function jtime() { return mktime() ; } function jgetdate($timestamp="") { if($timestamp=="")
www.RightClick.ir ��
$timestamp=mktime(); return array( 0=>$timestamp, "seconds"=>jdate("s",$timestamp), "minutes"=>jdate("i",$timestamp), "hours"=>jdate("G",$timestamp), "mday"=>jdate("j",$timestamp), "wday"=>jdate("w",$timestamp), "mon"=>jdate("n",$timestamp), "year"=>jdate("Y",$timestamp), "yday"=>days_of_year(jdate("m",$timestamp),jdate("d",$timestamp),jdate("Y",$timestamp)), "weekday"=>jdate("l",$timestamp), "month"=>jdate("F",$timestamp), ); } // "jalali.php" is convertor to and from Gregorian and Jalali calendars. // Copyright (C) 2000 Roozbeh Pournader and Mohammad Toossi // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // A copy of the GNU General Public License is available from: // // <a href="http://www.gnu.org/copyleft/gpl.html" target="_blank">http://www.gnu.org/copyleft/gpl.html</a> // function div($a,$b) { return (int) ($a / $b); } function gregorian_to_jalali ($g_y, $g_m, $g_d) { $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29);
www.RightClick.ir �
$gy = $g_y-1600; $gm = $g_m-1; $gd = $g_d-1; $g_day_no = 365*$gy+div($gy+3,4)-div($gy+99,100)+div($gy+399,400); for ($i=0; $i < $gm; ++$i) $g_day_no += $g_days_in_month[$i]; if ($gm>1 && (($gy%4==0 && $gy%100!=0) || ($gy%400==0))) /* leap and after Feb */ $g_day_no++; $g_day_no += $gd; $j_day_no = $g_day_no-79; $j_np = div($j_day_no, 12053); /* 12053 = 365*33 + 32/4 */ $j_day_no = $j_day_no % 12053; $jy = 979+33*$j_np+4*div($j_day_no,1461); /* 1461 = 365*4 + 4/4 */ $j_day_no %= 1461; if ($j_day_no >= 366) { $jy += div($j_day_no-1, 365); $j_day_no = ($j_day_no-1)%365; } for ($i = 0; $i < 11 && $j_day_no >= $j_days_in_month[$i]; ++$i) $j_day_no -= $j_days_in_month[$i]; $jm = $i+1; $jd = $j_day_no+1; return array($jy, $jm, $jd); } function jalali_to_gregorian($j_y, $j_m, $j_d) { $g_days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $j_days_in_month = array(31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29); $jy = $j_y-979; $jm = $j_m-1; $jd = $j_d-1; $j_day_no = 365*$jy + div($jy, 33)*8 + div($jy%33+3, 4); for ($i=0; $i < $jm; ++$i) $j_day_no += $j_days_in_month[$i]; $j_day_no += $jd; $g_day_no = $j_day_no+79;
www.RightClick.ir ��
$gy = 1600 + 400*div($g_day_no, 146097); /* 146097 = 365*400 + 400/4 - 400/100 + 400/400 */ $g_day_no = $g_day_no % 146097; $leap = true; if ($g_day_no >= 36525) /* 36525 = 365*100 + 100/4 */ { $g_day_no--; $gy += 100*div($g_day_no, 36524); /* 36524 = 365*100 + 100/4 - 100/100 */ $g_day_no = $g_day_no % 36524; if ($g_day_no >= 365) $g_day_no++; else $leap = false; } $gy += 4*div($g_day_no, 1461); /* 1461 = 365*4 + 4/4 */ $g_day_no %= 1461; if ($g_day_no >= 366) { $leap = false; $g_day_no--; $gy += div($g_day_no, 365); $g_day_no = $g_day_no % 365; } for ($i = 0; $g_day_no >= $g_days_in_month[$i] + ($i == 1 && $leap); $i++) $g_day_no -= $g_days_in_month[$i] + ($i == 1 && $leap); $gm = $i+1; $gd = $g_day_no+1; return array($gy, $gm, $gd); } ?>
��� �, e"' date(); �� jdate(); �B ?���!�8�.
www.RightClick.ir ��
� � 89��7:
� � 89 03�! ��� � ��� � ���!�� �A!��7��, �$ �(���X: �1� ...
�, �1� �� P/258 4�8,�A� �9 (4 �& ����� �, 0�� 5$�9 C ...
/,��� �1� 85�- ��' ���! 5���� $��5 d�# � �, ��/-$� A[ 85 �4 �5 �T�&�9 � �4�, ����5� � ��7�, �$ �1� ��' 5 �
�!���" 5� submit � � ��K5 �S'� ��/��� �9 8������������� ���� �' �� P �- ?8 ��� Inbox ��-...
d�#���V5 (5$�9 ���K, � �� e"' �9 (�& �� ��, �4��, ��6���!�, 6 ...
��,�� 5� � 89 �9 C��7��, ����� �* (�� C ��%�.5 �9 ��5�' �5��, ����� P�( ��,��O- 03�! 5 �9 �� �� � ��!��3� (
�9 ?���!� ����(.
�'5T�- P��O- 85�:
:آ�
<? //SecImage.php session_start(); if( !isset( $_SESSION['SecImageStr'])) exit(); $Str = $_SESSION['SecImageStr']; $SecImage = imagecreate( 50, 20); $BgColor = imagecolorallocate( $SecImage, 255, 150, 220);//Background color $FrColor = imagecolorallocate( $SecImage, 0, 0, 255);//ForeGround color $LineColor = imagecolorallocate( $SecImage, 255, 0, 150);//Line color for($Index = 0; $Index != 3; $Index++) { $LineDegree = rand(15, 50); imageline ( $SecImage, $Index, $LineDegree, ($Index+1) * 20, $Index, $LineColor ); } imagestring ( $SecImage, 4, 5, 1, $Str, $FrColor ) ; imagejpeg ( $SecImage , '', 100 ) ; header("Content-type: image/jpg"); imagedestroy ( $SecImage ) ; ?>
www.RightClick.ir ��
d�# H�3 ��75 �9 ���V5�9 ?���!� (�(:
:آ�
<? //test.php session_start(); // Create Security Code ... $SecCode = md5(rand(0,9999)); $SecCode = strtolower($SecCode); $_SESSION['SecImageStr'] = strtoupper(substr($SecCode,0,4)); ?> <img src="SecImage.php">
� �� 8S, H�35�- �$ d�, 89 �9 C� 5���X: ��' ����, (�� 5C �9 L& �9�/, (��� ��!$� (5�, �4 �5�- (��' 5�7�- �9
Action ��'���5��( :
:آ�
<? //check.php session_start(); $UserSecCode = strtolower($_POST['SecCode']); $SysSecCopde = strtolower($_SESSION['SecImageStr']); if($UserSecCode != $SysSecCopde) { die('The Sec Code is invalid!'); } ...ادا�9 ����9 ...//?>
1� �,�C :��!7 ... �9 02� e"'�� �9 85� �, �$ �T�" C5� $� �9 (���4 �Q�3 C5 � C��[9� �� ����75� �9 5� � �8� U�
�*�5 e"' � ��589 �T�- � 8��, �4�� � ��K client ��!$� �T� ��K7� 5�� � �)� session ��9 ?��!� ��5(.
��K4 : ��,�� 5�O- ��)5� �,5��7�4�V,��9 GD �$����, ��S' � YO4 �1� $��! .
www.RightClick.ir ��
(5���, ���: ��$ (���! ;5 ��3 05�! ���,...
0J5�F!� ;5 (���3 7 �T�" C5� $� php �%, �$�5 �� 7 ����, �B �8, ��.4 �� ��1�5�! ���, ���: ��$ 01�2
(��B 0!$�) ��� �� ��- �B �6�& ��1� P[ www.RightClick.ir 0��.(
\ (��B 7 ?���!� ��8� ;5 �� e"' � $�B C5� ���, g,�Z �$ ��8� (5��! 7 N�$��!� C5� :
:آ�
CREATE TABLE `poll` ( `id` int(11) NOT NULL auto_increment, `topic` text NOT NULL, `type` char(1) NOT NULL default '', `count` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM COMMENT='My Web Poll' AUTO_INCREMENT=14 ;
�T�&�B ^�_�- �5 d�# H�3 7 ��8� �$� $��� :
��8� C5���B ?$�� 8��' �- id 8��' Auto increament 0!� � topic ���: ��$ ��� ��56: � ���: ��$ ���!
�B ���: ��$ 8��' C5� $� 0!� 7F5 e"' q �� ��56: ���, � (��� 7 $��2 s (��� 7 $��2 .
8��' count �$�� 7 �W4 ��3 $� �$ ��56: �� ���, ��$ ��8S- �B (�0!�8��' $� C��r1� type lV. ��K�( �9
�5 0!� � ���! �$�9$ C5 �5K76: �� 5�� ��� 0!� � ... ���! ���,.
(% ��K4: I (5��F4 ?���!� ��8� �� �� ��& ���, ��8� �� �� ��.�, 7��3 ��8� ;5 �, 7,���!� 0��! �B C5�
0!� .
x��! (5�, H�3 8B :
:آ�
<?php $host = "localhost"; $db_name = "temp"; $db_user = "root"; $db_pass = "MyPassword"; $link = mysql_connect($host,$db_user,$db_pass) or die(musql_error()); mysql_select_db($db_name,$link) or die("Can not select Data base!"); //Check Action Set ... if(isset($_GET['action'])) { if($_GET['action'] == 'vote') { $poll_id = (isset($_POST['webpoll'])) ? $_POST['webpoll'] : ''; if($poll_id != '')
www.RightClick.ir ��
{ $sql = "UPDATE `poll` SET `count`=count+1 where `id`='".$poll_id."' AND `type`='s'"; $result = mysql_query($sql) or die(mysql_error()); } } $count = 0; $sql = "SELECT * FROM `poll` WHERE `type`='s'"; $result = mysql_query($sql) or die(mysql_error()); $n = mysql_num_rows($result); for ($i=0;$i<$n;$i++) { $count += mysql_result($result,$i,3); }; if($count == 0){$count = 1;}; $output = 'The Result of Vote<br><br>'; for ($i=0;$i<$n;$i++) { $num = mysql_result($result,$i,3) * 100; $num /= $count; $num = (int) $num; $output .= mysql_result($result,$i,1).' '.$num.'%<table border="0" width="'.$num.'%" height="20" bgcolor="#0000FF"><tr><td></td></tr></table>'; }; $output .= '<br>The webPoll Result From '.$count.' Votes<br><a target="_self" href="'.$_SERVER['PHP_SELF'].'" >[Back]</a>'; } else { //Web Poll... $sql = "SELECT * FROM `poll` WHERE `type`='s'"; $poll = mysql_query($sql) or die(mysql_error()); $topic_sql = "SELECT `topic` FROM `poll` WHERE `type`='q'"; $poll_result = mysql_query($topic_sql) or die(mysql_error()); $poll_question = mysql_result($poll_result,0,0); $poll_total = mysql_num_rows($poll); $output = '<p align="center" dir="ltr">'.$poll_question.'</p><form method="POST" action="?action=vote">'; $vote_count = 0; for ($i = 0; $i < $poll_total; $i++) { $vote_count += mysql_result($poll,$i,3); $poll_value = mysql_result($poll,$i,0); $poll_name = mysql_result($poll,$i,1);
www.RightClick.ir ��
$output .='<input type="radio" value="'.$poll_value.'" name="webpoll" style="CURSOR:Hand;" >'.$poll_name.'<br>'; } $output .='<input type="submit" value="vote" name="submit_poll" > <br><br><a title="View Poll Result" target="_self" href="?action=show_result" >Total Votes : '.$vote_count.'</a>'; }//End of Action Set //---------------------------------------- //Print the output print($output); ?>
75�1���$: �, � 8��!��3 �B 7 �4 �� �, 7�5�' $� �$ 8B C5� 84��* php 8�5�14 ���� � 8��B ?��3j .
$�
:آ�
$db_name = "temp";
�� �,� temp M8��5��, �$ ��3 E�, ��5� ��4.
$�
:آ�
$db_user = "root";
��� �, root M8��5��, �$ ��3 E�, ��5� ��,$�B ��4.
$�
:آ�
$db_pass = "MyPassword";
��� �, My Password M8��5��, �$ E�, ��5� $�/� �1�B .
8B C5� 7!$�, � � � :
@�!� 7 (��"- �$� PB ��8S- �, �$ ��56: �� ��$� ��8S- �B 0!� N$� C5� �, 8B C5� $�B �c, �$ �� 8c $� � 8�B
�- �� ?���!� �, �� @�!� �, � �$�� 7 0!� <table> 8�B 7 (�!�- ��8� ;5 ��56: �� ���, .
e3 $�� � �H�V�4� � 0!�� �, ��O-� (��� 7 ��)4� �$ E�, ��5�.
www.RightClick.ir ��
e3 ��t{ �- �m7 w5��4 U5�14 � �$� 0/� �, ��,� 8��,.
(�!�- ���, (� �%4� ��", Radio Button � ��$ �1B� � �� ...0!�
��$ 0/� 7!$�, ...
e3 $�tt c ;& �cB (�c�B 7 action �c:� �c4 �c5 0c!� ?8c� 0c! (5�c� 7c ��c� �$�� 8c��, ?8c� 0c!
e3 $�tu�,$�B �B ��� 7 $��2�, ��� 7-$� $� 8��, ?��B ;��B �$ ��$ ��!$� �1B� . ��c� C5� �, ��$� �� E*
e3 $�tn poll_id 8B �B �cB 7-$�c $� (c5$�� 7 0!� �, �$ 0!� ��56: �� ��' �, �O�� poll_id �$�8c"
����84 �$� w5��4 e"' � E* 0!� ?��F4 H�V�4� �$ �� ��56: �,$�B �B 0!� 7�S C5� �, 8��, (�c�� 7 U5�14 �� �, �$
8��, ?��B H�V�4� �$ �� ��56: �,$�B �B C5� �, h�' d�# ... e3 $�t� � t�;5 query M (��B 7 ���� � ����4 �$
C5� query H�V�4� ��$ �, 8#�� ;5 ?8� 8�B 7 �'�_� .
e3mm �- �t01�2 C5� $� 0!� �$� w5��4 U5�14 �, ��,� ��8S- ��56: �� 8$� U5�14 ���, 8� ��: �B $�Q ��1�
PB �, �$ �� �, ��,� ��$� $� � (��B 7 (��"- �$� ��8S-t{{(��B 7 v�& (� �5� �$ �%4� � (��B 7 H�_ .
$��!� ;5 �� e"' ��& print I (5��B ?���!�
���, 0!� �-d�, �� 0��! (��B ?���!� $��!� C5� �� ��1B �& �� � �4�, $� �B C5�.
�$�V, ��656� �1� �$� �, ��� � C5� �B �$��8� �.
, g'� 8���.
www.RightClick.ir ��
� �4�/3 03�!)� 01�2: (
��� ��� � �:� php �, (�4��� �9 (58�!$ 75�� �, �d� 8���, ?��9 ��/4� �$ 05�! C5� �$ �cT�&�9 ?���c* �c5 (c�
���(��9 a ...
�$ � �4�/3 � �4�, �5 03�! �4�14 ���, C �$�� (� P�T� �- 8�& � (�9 7 ��%�.�*...
�9 � �4�/3 0J5�K!� �5 C�3�! �, $�cb�4� �c3� $� �9 (5��W� ��5 75�6�& �5 (5���� �$ ��� 01�2 �5 ���� �� ��-
?�� 85��W, ��5 �$ �5� ���6�& �9 :
|} L5 03�! 7�9 ��� �,85�� 7 ���� ?���* .
�} �, Session 8��9 $�9 ���,$�9 N$� �, � 7�#�$ �, 8�4��, ��.
�} +,��- �, php 85�� 7 ���� (5�, 7 $�9 �, ?���* C5� ��- �9.
�} �$ P�15� ��!$� �"5�Q (��9 ��!$� P�15� ���5� ��8S- $�Z& �9 C5� � 85��: 7 ��5.
n} a��4� �, Query ���� ��85�� 7.
�} 85�� 7 ���� 84�/� d�, �$ H� �� 0�� � �9 75�%��$ �,.
�,�3 7��3 ���, ?�$ ����!� �9 C5� ���, �A3.
?���* a���:
��& � �4�, �� � ��� ���4 �9 (���/, 85�, �1� �� ��� I C �9 �$ ��! �5���9 0��T �)�5� 8�!$ 7 (��j �,:
t} ���3 �4��, �,$�9 ����9 ��4 0/� .
�} � ��4 �., 0/� � �4 �/3 �, �� C�!��* >5$�- � P�15�) .���, �$���3� ��4 ��/T�(
u} ��S' �$ ���3 05��� �4��, �.� ��!$� ���, ��4 0/� +2� �9 7��15� g5�Q �� �,$�9 ��9.
�} ��9 iX# �$ U��15� �4��, ���3 �,$�9)���, �9 7��15� �, (� ��, ��/T� �!$��.� �(
n} 0!�� �9 02� �� � (��9 ?��3j (�4��, �$ (��5��� �9 75�� C� (��!�, ���8S- �5 �1� ���, �$ ��� (�����.
�} P,�2 �58 e!�- ���,$�9 N�OV. ���, U5��5�.
�} ���W, $��2 0� @��!� $� � C., ���$� �1� �� �/3) .�, ��/T� �58 ?����(
�} 4 (��j �, �6�& �W5��!��1 ...
E�,��5� 7#��Q ...
�9 75�� $�9 C5� ���, H�3 (�'�: �b4 $� ��8� �! (�: :
t} ���� ��8� :
:آ�
CREATE TABLE `users` ( `uid` INT NOT NULL AUTO_INCREMENT, `email` VARCHAR(255) NOT NULL, `name` VARCHAR(150) NOT NULL,
www.RightClick.ir ��
`active` VARCHAR(1) NOT NULL, `join_date` VARCHAR(10) NOT NULL, `delete_code` VARCHAR(32) NOT NULL, `sec_code` VARCHAR(32) NOT NULL, PRIMARY KEY (`uid`) ) TYPE = myisam;
m} �� C� ��8�)�� � �4( :
:آ�
CREATE TABLE `letters` ( `lid` INT NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `sent` VARCHAR(1) NOT NULL, `date` VARCHAR(10) NOT NULL, `show` VARCHAR(1) NOT NULL, `body` TEXT NOT NULL, PRIMARY KEY (`lid`) ) TYPE = myisam;
u} 05�58 ��8� :
:آ�
CREATE TABLE `admin` ( `user` VARCHAR(32) NOT NULL, `pass` VARCHAR(32) NOT NULL, `last_log_date` VARCHAR(10) NOT NULL, `last_log_ip` VARCHAR(16) NOT NULL ) TYPE = myisam;
� �4�, ���� :
�, 85�, � H�3 (���, (� � �4�, ���� �K' ...���� ?�$ ��� AS' � ���� � � 8O2 ��&�� ?���!� ( ���c � �$ YcT�2
�8, ^�_�- ��$� $� PO ��$ �5 �- �8�14.
t} 0/� �� �5 7 ��4 @��! 7��3 �9 (����3 :
)�8�!�4 ����� �, �.4 ?8�r�* �9 C5� ���,(
:آ�
<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Join to Us...</title>
www.RightClick.ir �
</head> <body> <form method="POST" action="Register.php"> <p>Name :<input type="text" name="T1" size="20"></p> <p>Email : <input type="text" name="T2" size="20"></p> <p><input type="submit" value="Join" name="register"></p> </form> </body> </html>
m} (����V� �58 ��$� ���, �� �5 :
:آ�
<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Newsletter Login...</title> </head> <body> <form method="POST" action="Login.php"> <p>User name: <input type="text" name="user" size="20"></p> <p>Password : <input type="password" name="pass" size="20"></p> <p><input type="submit" value="Login" name="LoginIt"></p> </form> </body> </html>
��N$� �, ?$��2 ��& (��K� 7!$�, 8S, �$ 05�58 N �., ��3�! L� ��5��.
�$ ��4 0/� 7�5�4 89 8S, ���� �- �,�3 �� C�1� �- AS' (��9 a���.
www.RightClick.ir ��
� �4�/3 03�!) 01�2���: (
* (� �, �$ � �4�/3 03�! �� ��� 01�2 ��� ��W��� ��K��9 ���- (� �9 85(� 01�2 � � �� P/25��� C�� ���c�� �c9 (
��� ��� � php )03�! � 01�2 � �4 �/3 (0!�.
�$ ��4 0/� 01�2 ��� � H�37��! 5( ...
�- �$ ��4 0/� ��' �1� �� ���� 5��4 �, �� � Register.htm ����5( :
:آ�
<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Join to Us...</title> </head> <body> <form method="POST" action="Register.php"> <p>Name :<input type="text" name="Name" size="20"></p> <p>Email : <input type="text" name="Email" size="20"></p> <p><input type="submit" value="Join" name="register"></p> </form> </body> </html>
H�3 �5 �, ��' ��!$� �� 8S, �� C5� �� �5 �W���4 �, ?� Register.php ) H�c3 I ��& �c- ��c& �c ��S �
01�2 Action � @$�� ��'5���4 �$ �� C�((
�, d�#5x��! ( �� Register.php :
*� �� P/25�9 a��� �9 C��, (5 �9 (W, 8�&3 � ���7���� � 4 ��1 �4�,�� �, $�9 �, ��5, ���$�� E5 C ( c5 c +,�c- �7
�45�- �$ ��� � (�� 5�' �5P ��4 �, config.php $��27�� �� � �� 754 �9 �� �, $�9 �, ��5, ����' ��� (���� E5P �$
f��T� �� � �4�, �,7 ?���!� ��� � (�9 � (�K ...8.4 ���� �:�5�2� 87a��� ���� A �9 ���97�� 58.
�'5P config.php :
:آ�
<?php function connect() { mysql_connect("localhost", "root", "") or die(mysql_error());
www.RightClick.ir ��
mysql_select_db("newsletter"); } ?>
�-�� 5�' C5P 5�S- +,�- �5��9 k5��4 �, ( connect �!��3 �9 �� �� ��� �, (5, ���., PO� E�e"' ( '�9� � �c9 � c5 C
4�3��' �$ +,�-7�9 �( ...
��K4t: �9 02� � � �9 8���4����� ( �47��V, �9 �5��, (���, e"' (/�9 H�V�4� ��1S,�- �� 5Q�/-$� �9 C7 �$�c9 �,
����� � C ���,5���9 H�V�4� �$ ��4 C.
��K4m: +,��- mysql_connect � mysql_select_db 1�� +,��- (�: (� A/2 �9 $�Q C ��c3 php �c9 8���c�
��,��, ��O-� �5, ���E MySQL ?���!�7�� .
��K4u: newsletter � ��45, ���� 0!� � E root �,$�9 ��4�� 5,����$��* ��8, � E.
�, H�35�' x��! (5P Register.php �9 �1���- ��4 0/� N�� N$� ��� �W�?� ...
t} T���$�9 C��, �9 5�K, 8�� (5�' �9 ��5P config.php � �, �$5�' C5�9 f��T� P�� �, ��& (5,���$�� $�9 E5(:
:آ�
include("config.php");
m} �9 L&�/, (����Q �� �,$�9 �9 (5� �$�� ��' g5?8� �� C 51� �4 ��$�Q C��- ?8 �� � ?�� @$�� ...
:آ�
//Check The Form is Submitted!? if(!isset($_POST['Name'])) exit();
u} �- �$ ?8� ��!$� ��' N��AQ� d�# H�3��� �- �� �� �7 $565�9 ?���!� ��� �9 (�(
:آ�
//Read Data From Form... $Name = $_POST['Name']; $Email = $_POST['Email'];
�} ��,�� 5����' �9 C�T�3 7 (Space) �,$�9 �9� �8�,� $� , �� ?��9 �$�� �%�4�� +,�c- �� ���c, C trim c ?���c!�7
�9�(.
:آ�
//Trim the Strings... $Name = trim($Name); $Email = trim($Email);
www.RightClick.ir ��
n} !$�,7 7�9 �� �1�# �,$�9 �9 (51� 8��, ?��9 �$�� �$ P)� $� ��&5(% ��4 � �4�, C 4�14 L& �$ ��� 0�7�9 �((
:آ�
//Check Empty Email Addr... if(empty($Email)) die("Please Enter your Email Address!");
�} ��56W5�7�� ��9�$�9 ���3 HTML �14 $�8" �,5.7 �� )�5C ��, $�9�� 5 8c9 �c4��4 �,$�9 �9 �� HTMl � c5�
JavaScript $6- � � �4�, �,5��9 g(
:آ�
//Set The special HTML Characters 2 HTML Codes $Name = htmlspecialchars($Name);
�} ��9�$�9 �,$�9 ��4 P3�� ��' iX# �$ ��K��- �9 (�$�9 � �,5,����.4 PK. $�&� E5(...
:آ�
//Remove Slashes... $Name = str_replace("'", "", $Name);
�} �� i��#� @$51�P 8/- L&�9 i��# �, �$5 P��K� �� �1� �- (5���, 0!8K...
:آ�
//Convert Email Address to Lower Case $Email = strtolower($Email);
�} !$�,7 ��K�� @$�� �9 (51�-$�/� �b4 �� �,$�9 P7 0�� 0!$� 5 �4 �) ... �8S,5���� � c_�- ��$� $� PO � ^
7�� (
:�آ
//Check For Valid Email Address Expression if(!preg_match("/^[.A-z0-9_-]+[@][A-z0-9_-]+([.][A-z0-9_-]+)+[A-z]{2,4}$/", $Email)) die("Invalid Email Address!");
|�} !$�,7 7 �9�� �9 (51��7� $� A/2 ?��9 �$�� �,$�9 �9 5,���3j E� ?8� ?�5�4 � ...
:آ�
//Check Exist... $Sql = "SELECT COUNT(*) FROM `users` WHERE `email` = '$Email'"; //Connect to database...
www.RightClick.ir ��
connect(); $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); if(mysql_result($Result, 0) > 0 ) die("This Email Address already Exist!");
||} 5� � 89 ���7T�- � 87�9 �!�, �,$�9 �- (��4��, ��� �� ���5��9 ��S' �$ ���3 0
:آ�
//Create A Random Security Code... $RandomNum = rand(0, 9999); $SecCode = md5($RandomNum);
|�} $�-5��� � >
:آ�
//Calculate The Today Date... $Today = date("Ymd");
|� } 0/� 8� �,$�958 :
:آ�
//Insert New User... $Sql = "INSERT INTO `users` (`email`, `name`, `active`, `join_date`, `sec_code`) VALUES ('$Email', '$Name', '0', '$Today', '$SecCode')"; $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); print("Registration Complete Successfully!");
�� P �9 89 Register.php :
:آ�
<? include("config.php"); //Check The Form is Submitted!? if(!isset($_POST['Name'])) exit(); //Read Data From Form... $Name = $_POST['Name']; $Email = $_POST['Email']; //Trim the Strings... $Name = trim($Name); $Email = trim($Email);
www.RightClick.ir ��
//Check Empty Email Addr... if(empty($Email)) die("Please Enter your Email Address!"); //Set The special HTML Characters 2 HTML Codes $Name = htmlspecialchars($Name); //Remove Slashes... $Name = str_replace("'", "", $Name); //Convert Email Address to Lower Case $Email = strtolower($Email); //Check For Valid Email Address Expression if(!preg_match("/^[.A-z0-9_-]+[@][A-z0-9_-]+([.][A-z0-9_-]+)+[A-z]{2,4}$/", $Email)) die("Invalid Email Address!"); //Check Exist... $Sql = "SELECT COUNT(*) FROM `users` WHERE `email` = '$Email'"; //Connect to database... connect(); $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); if(mysql_result($Result, 0) > 0 ) die("This Email Address already Exist!"); //Create A Random Security Code... $RandomNum = rand(0, 9999); $SecCode = md5($RandomNum); //Calculate The Today Date... $Today = date("Ymd"); //Insert New User... $Sql = "INSERT INTO `users` (`email`, `name`, `active`, `join_date`, `sec_code`) VALUES ('$Email', '$Name', '0', '$Today', '$SecCode')"; $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); print("Registration Complete Successfully!"); ?>
C ���!�� 3��7S! 7 �_�- ?��! �9 (�K� �8, ^ ...� �,5�� (� ��, �:� ���� C754 ��� �� � �c, �� c_�-�, ^ c� ?$�� ��.
W,�_�- �- 8��8, ^ ...
� �$� $� 8S, 01�2 $��� ��!$� ?�51�P YT�2 $� �,$�9 �,5�� L HTML �5��� ���9 ��S' � �/5�Q �� 0 c5 g
�51����3 z�, P�( ��9.
www.RightClick.ir ��
3 03�! � �4�/)��� 01�2: (
��! UV, ��� �)��� 01�2( ��/4� �$ � �4 �/3 03�! ��� � �� 7�9 �(.
�9 0!� ��� $�, �:� �5�! C� �$ �� ��� � �� 7, ����! 8��� ��/2 71� $� ���� ��! C5�ST�Z �$ 0 �14�58.
��� � ��! ��S'��,$�9 H��# ��Q �� �,$�9 5� g51�!$�, �$ P7 ��K�(.
� P/2 ���� $5L 8� �,$�95�3�! 8�$� �$ ��� � ( Table \ Insert ��95( . ��#����V���4 0/� ~� �, ( �,$�c9
�51��7$� �$ 5�Q �� � 8�9 0'�5� �� g51��14 ��S' �$ ��3 H��# P58.
/, �8�,�����- �9 (� php $�Z& mail �9 ��!$��(...
��,�� ��!$� 51��- P� php * ?�$ ����$ U�0!� � :
t} �3�� +,�- �� ?���!�7 mail 3 �9��7��#�$ .
m} �� ?���!� SMTP �950!� f�' +,�- �� �- PK. ?�$�3 �.
)��,�� 5��� � C �3�� +,�- ��7 mail ?���!�7�9 ����'� ?�$ H�3 �9 8S, (5 (5��, Y-� @A9 �� � ��!$�51� �c, P
(�7�4 5��(.(
�Q�- �� ?���!� ,� +mail:
:آ�
mail("[email protected]" , "Mail Subject", "Salam khubi?");
f�' 89 $� �9 [email protected] �51�$� lV� P5?8��9 0'� 0!�.
Mail Subject M� �����51�T�!$� P7.
Salam khubi? (� M� C� 51�0!� � P.
�5-$� $� +,�- C7 84���, �9 �8�9 ��!$� P$�8" True �,7 $� � 84���: ]�� �5N$� C False .
��K4:� �, 514 +,�- C74��- �V.- (��� l�� �9 (51�0!� �, P :�!$ ?84�� 0!� ?85�4 �.
d�# H�35�%�4� �, 89 e3 ���' 5P Register.php 7 �6'��5� �9 (51��- P�5��� 85��, �$ 0��14 ��!$� �,$�9 58.
:آ�
//<!-- Start of Mail Body $MailBody = ' Salam dooste aziz, Az in ke dar khabar nameye ma ozv shodehid kheyli mamnoonim. lotfan baraye faal shodan acount khod bar rooye link zir click nemayeed:
www.RightClick.ir ��
http://www.MySite.com/Newsletter/Active.php?Email='. $Email .'&SecCode='. $SecCode .' Ba tashakor, Movafagh bashid.'; // End of Mail Body--> mail($Email , "Active your acount", $MailBody);
�, d�# H�35�' x��! (5P Active.php 8� d�, ��� U�/� �9.
�, ��& H�3 DataBase $�� $�95( :
:آ�
include("config.php");
�- ��&�T �& � L���� 675���4 �0!��3 $� P[ �9 ( GET P1� 7 Lc& ��� E* ��9 � c�K�/, (� c�� T �c9 (� Lc�
��!$�5 �4 �)5�S7& �1� ��675 �$ �9 ���V�5 ?$�� �$ (5�4 �(
:آ�
//Check The Link is Correct if(!isset($_GET['Email']) || !isset($_GET['SecCode'])) exit();
��" d�# H�35����$� �� �9 ��'�: ��- �$ (��� ��� �75 ��565( ��9 $�9 ����, �., �- 0#�$ �9:
:آ�
//Set The variables... $Email = $_GET['Email']; $SecCode = $_GET['SecCode'];
d�# SQL ���9 ��S' �, ��,� Acount �$7�4 5��( :
:آ�
//Update The Acount ... $Sql = "UPDATE `users` SET `active` = '1' WHERE `email` = '$Email' AND `sec_code` = '$SecCode' ";
www.RightClick.ir ��
� �, ��/-$�5�� ,� E)�Q ��5S,�- g7�3 A/2 �9 ����4 �� �((:
:آ�
//Connect to database... connect();
����� SQL :
:آ�
//Execute The SQL... $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql);
'�S 78� +,�- 58 :
mysql_affected_rows�5�$�� $� +,�- C��1� � �9 ��� N�75?��� $� �9 �- �� �� c��� �5 c ��c)7 Pc[ 8c��9
Insert, Update, Delete) (�� �$�9$ ��8S-75�- �9 ��� �, �$ 84� ?��9��4���W .� �95� � �)���9 ?���!� ��5(:
:آ�
//Check Affected Rows... if(mysql_affected_rows() == 1) die("Your acount successfully activated!"); else die("No acounts activated!");
� � H�35��� � P �9 89 C :
:آ�
<? //Active.php include("config.php"); //Check The Link is Correct if(!isset($_GET['Email']) || !isset($_GET['SecCode'])) exit(); //Set The variables... $Email = $_GET['Email']; $SecCode = $_GET['SecCode']; //Update The Acount ... $Sql = "UPDATE `users` SET `active` = '1' WHERE `email` = '$Email' AND `sec_code` = '$SecCode'
www.RightClick.ir ��
"; //Connect to database... connect(); //Execute The SQL... $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); //Check Affected Rows... if(mysql_affected_rows() == 1) die("Your acount successfully activated!"); else die("No acounts activated!"); ?>
��, 8��,�! � g'� �8.
www.RightClick.ir �
/3 03�! � �4�)��! 01�2: (
\���!�� �A! * �$ � �4�/3 03�! ��� � ��! 01�2 ��� ��W��� ��K�(.
��� � 01�2 Login 8 58 UV, �, �5�5 ��)4� �$ 0�85(.
�8�,�5�$ $�� ����8� admin ��K�( ...
:آ�
CREATE TABLE `admin` ( `user` varchar(32) NOT NULL default '', `pass` varchar(32) NOT NULL default '', PRIMARY KEY (`user`) ) TYPE=MyISAM;
� H�35 �,$�9 �, ��,� ��8� C)��� ( �$�� ��� �, �9 0!� � !� (���.� ��c!$� �c �4 �/3 � (� c�K� �$ ��c�� � (
8 5�5 0��K�(.
��,�0�- �- �� AS'� phpMyAdmin 5��- �,$�9 �4�� � insert ��K� �$ U �4�, 8S, (7�4 5��(.
:آ�
INSERT INTO `admin` VALUES ('a', '202cb962ac59075b964b07152d234b70');
�, d�# H�35�� 03�! x��! ( Login :
* C � ��%�.�(�K 5��, �4�:�8� $8T�' �� admin �9 0!$���' � (5�� P�8 ��OV 5�- �$ ���, ��� 565(.
�'5P login.html :
�5�' C5 ��.4 � �, �$ ��$� ��' P����� � ?8���� �5��:
:آ�
<form method="POST" action="login.php"> <p>User name: <input type="text" name="UserName" > <p> Password: <input type="password" name="Password" > <p> <input type="submit" name="BtnSubmit" value="Login"> </form>
�'5P login.php:
�5�' C5S- $�9 P�� ��)4� �$ �,$�9 $�/��� C�?8.
�1� �� ��� N���� �� ��&����V��9 ?���!� (���84� ?�$ �, ��,� +,�- E* (� session �$ 4�3��'7 ��K�(.
:آ�
session_start();
www.RightClick.ir ��
�,$�9 ��4 8S,��� �$ �$��* � ��$� � �W��5�- � (� �� �-��� ���565(:
:آ�
$User = $_POST['UserName']; $Pass = $_POST['Password'];
� ��& 6 $ N$� �, �$ $�/� �1�9�X*�4 0.:�, 5�- �� DataBase 3j� ?���K�& E* (�6��� �9 �,$�97
:��5 $� 6 $ �, N$� ��1� �, (� �$ (��$54��, �- (�Z (!$�, �$ ��� 0",�7 �9�(.
:آ�
$Pass = md5($Pass);
$�WT� ��/T�5�� (��� 5�W�T� 8���� (� 7� 5, C�� �!� ��. ... �- ��/T���� � �4�, � ���3 8cS, �9 �$6, c� �� 0c��4 8
�5$�WT� C5-$� �, (�7�9 14 ?���!� 8� ��: d�,��K���, �� ���$ �, �K�, 8� ��K� � (5 $�cWT� �5 (� $� Cc �$��� �c,
�� ?���!� md5 � ... 7��! 5� � �- (�, 0���.����, ����� .
d�# Query * �, ��,� � �$ ��8� $� �,$�9 ���9 �8���5��/, �- (���r1� A� �9 (�C �,$�9� ?$�� ���� 5�4 � ...
:آ�
$sql = "SELECT `pass` FROM `admin` WHERE `user` = '$User'";
�, d�# �5,��� $��2�, ��/-$� E��K�( :
:آ�
include('../config.php'); connect();
�' ���5P config.php �' ��1�5�7�- �9 0�� � P/2 P#�� 5���4 ��- +,�- ����, (��, ��/-$� DataBase.
���� d�#� query :
:آ�
$Result = mysql_query($sql);
��� d�#!$�, 7� 5 ��!$� �$��* �9 C5��$�9 ��)4� � �4 �� :d �, ��,� �C:
:آ�
if(mysql_num_rows($Result) == 1 && mysql_result($Result, 0) == $Pass) { $_SESSION['UserName'] = $User; $ClientString = $_SERVER['HTTP_USER_AGENT'] .
www.RightClick.ir ��
$_SERVER['REMOTE_ADDR']; $_SESSION['ClientStr'] = md5($ClientString); header("Location: admin.php"); } else { die('The specified username and/or password is incorrect!'); }
_�-�^: �-�Q�� N$�/� 7�: ��� �!$�, �9 (7A� �9 ��� query � 5�4 L� ����� �) c5 � d�c# 0c��� �c:� �c4
�9 ��� ��� 01�2�W��$��* (��� �9 �'�: ��'�� $� ���� �$��* �, (5,��� E5K7 0�� 5�4 �.
��, 0!$� ��� �:� d�# ��� �48, �$��7�� 5(:
�-��,$�9 ��4 UT�� e3 ��- �$ � 5� session $5�V���& ( �-�� N�� 5 �� �$� �, �W�?$�V.
��! � ��� e3 $�! \�:$�� N�OV. ��(�� � P �� ...?��1� �, �$ IP �- �$ �,$�9� 5� session $5�V���, � (�
�5�� ��19 �9 C W,�� � � ?��, 0��, �$ ��� �., ��. md5 ��9 895( .�- �9�8 N�� 5�5L& �$ ��� 0 ��K� �c- (
�97�, �4��4 session /�"-7 login ��9.
�9 (� 8S, e3 $�5$8� � ��!��8 �� �, �$ �,$�9 � (5�50 (admin.php) ���3 8S, N���� $� �9� 03�c! (
�8�50 ��K�(.
� $�5�� P �9 89 � login.php �$7, ���8:
:آ�
<?php //Starting the session... session_start(); //Get The data from form. $User = $_POST['UserName']; $Pass = $_POST['Password']; //Hashing the password... $Pass = md5($Pass); //Checking the user and pass... $sql = "SELECT `pass` FROM `admin` WHERE `user` = '$User'"; //Connecting to db... include('../config.php'); connect(); $Result = mysql_query($sql);
www.RightClick.ir ��
if(mysql_num_rows($Result) == 1 && mysql_result($Result, 0) == $Pass) { $_SESSION['UserName'] = $User; $ClientString = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; $_SESSION['ClientStr'] = md5($ClientString); header("Location: admin.php"); } else { die('The specified username and/or password is incorrect!'); } ?>
�5��,$�9 �& 01�2 C�I �$��
:آ�
$ClientString = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; $_SESSION['ClientStr'] = md5($ClientString);
�85��� �� �B ��5� ���, Session ��1� �5 session (��B ���:��� 7/�"-M8S, ���� ��- �8� ^�_�- PO .
www.RightClick.ir ��
� �4�/3 03�!)�$�%& 01�2: (
��� � H�3��58 01�2 x��! (5�5 0)�� � �4 0/�...(
�' H�35P admin.php (� �, �$7��! 5(...
�-�� 5T �� C��� L����V 7�� 01�2 �, � 8 k��V 5�5 0�$�XW5(:
� ��& H�35� �� �� C��, �,$�9 �9 0�� 5�1�# 8 Login /, �$ ��� �4��, �- ���, ?��9� �c1� �� ��� Ec* �c�
)�! $�/���7 ��)4� �$ �,$�9 �85(. ��, �� 5+,�- �8�,� $�9 C session_start �8 �$�46�\( �, EJ! 5 c!$�, ��� �7
��K�( �,$�9 �9 Login ?��95�4 � .�� �, �$ �,$�9 �9 �4 �:� login.html �8�5 0��K�� ( �:� Login �c9 ?��9
$�9�$�84 U%, 5(...
:آ�
<? session_start(); $ClientString = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; if( !isset( $_SESSION['UserName']) || $_SESSION['ClientStr'] != md5( $ClientString)) { header( "location: login.html" ); exit(); } ?> <a href="InsertLetter.php">Insert New Letter</a>
�3� ��� �9 (�7, ��� 85T �� �, L�5� �� �5�W�- �9 ?8� ����X: ��� � �4 �� ��� 75�$ c�9 ��!$� ?$��2 �9� (
� �- �$5,��� 0/� E��K�(.
�, H�35�� x��! ( InsertLetter.php /, ���� 0/� �$ $�/3� $�Z& �9 (7�9 �(.
�- ��&�� 5(� �� C 4�)�! $�/��� ��1� E* ���, �/�S �,$�9 �9 0�� ��7��, �$ d�, �� 5K- (� C$�� ��K�(...
:آ�
session_start(); $ClientString = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; if( !isset( $_SESSION['UserName']) || $_SESSION['ClientStr'] != md5( $ClientString)) { header( "location: login.html" ); exit(); }
www.RightClick.ir ��
d�# H�35��$ � 8�5 85 ��7 :��5� ��� � (5��V, �:� �9 ���5�- (� 5 �' �� �7��, ����� ��� �9 ( ��1T� 02�
�!��3 02� �� � ���, 0!��3�84 ��.4 �$ ��� (51� �, ��1 �' � (��� C $����., ��!$� ...
L& ��� H�3��K�/, �- (���$ ��' �,$�9 �9 (��!$� � ?��95& �:� �9 �4 ��6�8, ��.4 �$ ��' ?8.4 ��!$� 5(:
:آ�
if( !isset( $_POST[ 'Title' ])) { ?> <form method="POST"> <p>Letter Title: <input type="text" name="Title" > <p>Letter Body: <textarea name="Body"></textarea> <p><input type="submit" name="BtnSubmit" value="Insert"> </form> <? }//End of If(isset)
�-�d�, e3 8�& �, �9 0�� ��K4 �- 8�&5(W, 8 :
� ���5�- C �9 C�+,�- $� ��& ��� isset �$ �19� (!� (!� � (����45K7�� EditBox (���4 �$ �� ...T��� U�5 �c�
�2� �97' �9 �701! �, ��!$� $��!��S, �.7& �� ���6���� set 14� �.)�-��$� 5� POST $5 c14 ��V7 �c�
(… �2� A[ 7�19� submit �9 �$��K4 L� (5�S7�9 �, �8 Enter �2�7�- �9 � 5K7�� EditBox ��� ��� �$ ��' (
�9 ��!$���19� ��� ( Set 14��r1� �.��$� $� C CheckBox �� 1� (�� $�Q C0�� .�:� check 8�c��, ?�$�cV4
14 ��!$��", �$� $� C.��6�� ��(� ��' �:� disabled 14 ��!$� (� ��, 8���,�C..
5� ��K4 �5�- �9 �W�?8��. ��' �- �� �.5� C �9 ���= Action ���, ��2� ���K4 lV. ���3 ��' 7� 5 $�c9 C
�$���3 (�K $�� �������� �, action b4 $� ��' �c�'�: � c� �. ... �c:� method ��4 (c� c5(� get $� �cb4
�W�?�...
�, d�# H�35", x��! (��� 89 �...
�-� else �, ��,� 1��C if ����4 d�, �9 ��, ��,� 89 ( insert �$���5��(...
T���$�9 C��9 ��K�� (5& �9 �����675��, ��' �� �9 ��- �$ ?8� ��!$� � ��� �- 8�& � ���565( :
:آ�
$Title = $_POST[ 'Title' ]; $Body = $_POST[ 'Body' ]; $Today = date("Ymd");
� �, d�#5,��� PO� E7� �(:
:آ�
//Connecting to db... include('../config.php'); connect();
www.RightClick.ir ��
5� Query ��,� Insert 7�4 5���� � ( ���� �$ �7�9 �(:
:آ�
$Sql = "INSERT INTO `letters` ( `title`, `sent`, `date`, `show`, `body`) VALUES ( '$Title', '0', '$Today', '0', '$Body')"; $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql);
d�#58� ��K4 �58:
:آ�
if( mysql_affected_rows()) { print("The Letter Inserted Sucsessfully!"); } else { print("Error: The Letter Inserting Stopped!"); }
+,�- ��, mysql_affected_rows '�S �$7 ���, �9 (�K� SQL ��75�- �, ��,� �9 c��$� N�� N�c�AQ� c� C.
�� �$�9$ ��8S-75�- �9 �$ �� �, �$ ?��9 ���2� A[ �4���W7�9 insert \ Update c5� Delete ��c)4� �c9 c�85 (
�3 �4����7 ��9 ��1K19 ... �95U4�14 � d�, �$�/���8.
�� P �9 89 insert � �$5(���X: ��-��, �:
:آ�
<? session_start(); $ClientString = $_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']; if( !isset( $_SESSION['UserName']) || $_SESSION['ClientStr'] != md5( $ClientString)) { header( "location: login.html" ); exit(); } if( !isset( $_POST[ 'Title' ])) { ?> <form method="POST"> <p>Letter Title: <input type="text" name="Title" > <p> Letter Body: <textarea name="Body"></textarea> <p>
www.RightClick.ir ��
<input type="submit" name="BtnSubmit" value="Insert"> </form> <? }//End of If(isset) else{ //Insert The Letter... $Title = $_POST[ 'Title' ]; $Body = $_POST[ 'Body' ]; $Today = date("Ymd"); //Connecting to db... include('../config.php'); connect(); $Sql = "INSERT INTO `letters` ( `title`, `sent`, `date`, `show`, `body`) VALUES ( '$Title', '0', '$Today', '0', '$Body')"; $Result = mysql_query($Sql) or die(mysql_error() . "<br>SQL: " . $Sql); if( mysql_affected_rows()) { print("The Letter Inserted Sucsessfully!"); } else { print("Error: The Letter Inserting Stopped!"); } }//End of Else If... ?>
�$� $� 8S, N���� $� � ��!$�51�S1� ��!� P7 z�, ��K�� � (5 � ���c3 �c4��, $�cZ& �,$�9 �9 C5 c1��� �$ U�
T� � 0���9 iX#.
www.RightClick.ir ��
$�- �� ?���!�5�: 0��! � >5��5 $� =PHP
���!�� �A! \
�-�� 5 z�/ C7$�- �� ?���!� �$� $� ���3 5�: 0��! � >5��5= (Greenwich Time) �-��� ?���* � PHP
(�9 0/�.
��,$�9:
t} �1�74��- ��, 8 �! ���,$�95� ��3 05�8, �$ ��K � C��� �� �9 8�4� � �1- 8���, �9 �7$�- 50��! � > �$ �� �c,
8���, ����� �� ��1�.
m} 0��! d�1S Server � 0��! �, �� set 4�8���.
��, H�3�� 5' $�9 C�8� Date � Time $� �$ DataBase a�4 �� ��- Int W,��58.
+,�- time $� php $�� �b�T� N$� �, �$ 5� �8� L�^ (Integer) �, �:5��5 �, =7�4���: ...� �9 c5 �8c� C
4�� P ���2� \��0�� ��! � ?� \��$ \0��! \�".
�Q�?���!� :
:آ�
<?php $Now = time(); print ( $Now); ?>
N���_�- +,�- C5� �$� $� ��.�,:
http://ir.php.net/manual/en/function.time.php
���37:
:آ�
1205692465
��, d�# H�3�3j �$�- ?�5$� 0��! � > DataBase 1���$ �8� C 3j� ?�7�9 �(.
* U484�3 d�#
��,��: �, ��& U484�3 5��5�, ��� 0�� =58 �,��� 0��! iA�3� ��675 �9 7��3 �5�9 �'�_� U%, (� ( c5 ��� �
�9 (9�( .� �5C �, �$ iA�3�54�� �, 8�8/- �5�9 P�( .��, A[ �� 5 iA�3� �9 ���u,n +\?$�� 0��! �5$�Q C5�:
:آ�
<?php
www.RightClick.ir ��
$TheTime = time(); $TimeZone = 3.5; $TheTime += $TimeZone * 3600; print ( $TheTime); ?>
�9 d�# $�-5 N$� �, �$ 0��! � >5� �8� L��$�� 0!� �, ^5�K� �, �4�� (7 �9 7��3 �5( �145 U7� 5( .
��,�� 5+,�- �� $�9 C gmdate ?���!�7�9 �(:
:آ�
<?php $TheTime = time(); $TimeZone = 3.5; $TheTime += $TimeZone * 3600; $StrTime = gmdate( "Y/m/d - g:i A", $TheTime); print( $StrTime); ?>
N���_�- +,�- C5� �$� $� ��.�,:
http://ir.php.net/manual/en/function.gmdate.php
� ��� �� �$�*5& ��1� P[ +,�- C�65��$� �, �9 ��+,�- date 7� 5( . ���U �9 (� time 0��.
��� �$��85?$�V, ��-�$� �, �T�&�9 ��� � C ...
www.RightClick.ir �
@A9 ��� �Template
\���!�� �A! �Q �$� $� ���, ��!��3 ���!�� �� �- 8�&� @A9 �� ?���!� � $�9 Template _�-�-��7 �8c, . �c9
- ��/T���� 5�$� $� e"' 0�* C �Q�_�- ����!� � ^7�� .
/, �$ @A9 89 ������8:
�5 �� �$ @A9 C5� Counter ��� 7J9 74�1T�.
:آ�
<?php class Template { var $tags = array(); var $required_tags = array(); var $blocks = array(); var $tpl = ''; var $parsed_tpl = ''; function Template( $templatefile = '' ) { if( !empty( $templatefile ) ) { if( !file_exists( $templatefile ) ) { print 'Could not find the template file <i>'. $templatefile ."</i>!\n"; return FALSE; } $this->load_file( $templatefile ); } return TRUE; } /*-----------------------------------------------------------------*/ function load_template( $template ) { $this->tpl .= $template; } /*-----------------------------------------------------------------*/ function load_file( $file ) { if( empty( $file ) ) { return FALSE; } $template = @implode( '', @file( $file ) ); if( $template == FALSE ) { print 'Could not read the template file!'; return FALSE;
www.RightClick.ir ��
} $this->tpl .= $template; } /*-----------------------------------------------------------------*/ function assign( $input, $value = '', $required = FALSE ) { if( is_array( $input ) ) { foreach( $input as $tag => $value ) { if(empty( $tag ) ) { print 'Tag name ist empty!'; return FALSE; } if( $required == TRUE ) { $this->required_tags[$tag] = $value; } else { $this->tags[$tag] = $value; } } } elseif( is_string( $input ) ) { if( empty( $input ) ) { print 'Tag name ist empty!'; return FALSE; } else { if( $required == TRUE ) { $this->required_tags[$input] = $value; } else { $this->tags[$input] = $value; } } } else { return FALSE; } return TRUE; } /*-----------------------------------------------------------------*/
www.RightClick.ir ��
function add_block($block_name, $block_array) { if( !is_string($block_name) || empty($block_name)) { print 'Block name is not a string or is empty!'; return FALSE; } if( !is_array($block_array)) { print 'Block array is not an array!'; return FALSE; } $this->blocks[$block_name][] = $block_array; } /*-----------------------------------------------------------------*/ function parse() { if( empty( $this->tpl ) ) { return; } # blocks $tmp_blocknames = array(); foreach( $this->blocks as $block_name => $block_arrays ) { if( $anzahl = preg_match_all( '/<!-- BEGIN BLOCK '. preg_quote( $block_name, '/' ) .' -->(.*)<!-- END BLOCK '. preg_quote( $block_name, '/' ) .' -->/sU', $this->tpl, $matches ) ) { for( $i = 0; $i < $anzahl; $i++ ) { $block_plus_definition = $matches[0][$i]; $block = $matches[1][$i]; if( is_int( strpos( $block, '<!-- IF' ) ) ) { $parse_control_structures = TRUE; } $parsed_block = ''; foreach( $block_arrays as $block_array ) { $tmp = $block; if( isset( $parse_control_structures ) ) { $tmp = $this->_parse_control_structures( $tmp, array_merge( $block_array, $this->tags, $this->required_tags ) ); } foreach( $block_array as $tag_name => $tag_value ) {
www.RightClick.ir ��
$tmp = str_replace( '{'.$tag_name.'}', $tag_value, $tmp ); } $parsed_block .= $tmp; } $this->tpl = str_replace( $block_plus_definition, $parsed_block, $this->tpl ); $tmp_blocknames[] = $block_name; unset( $parse_control_structures ); } } } if( count( $this->blocks ) > 0 ) { $this->tpl = preg_replace( "/<!-- (BEGIN|END) BLOCK (". implode( '|', $tmp_blocknames ) .") -->/", '', $this->tpl ); } # unbenutze blِcke entfernen $this->tpl = preg_replace( "/<!-- BEGIN BLOCK ([a-zA-Z0-9_-]+) -->.*<!-- END BLOCK \\1 -->( |\r|\n)?/msU", '', $this->tpl ); # single tags foreach( $this->required_tags as $tag_name => $tag_value ) { if( !is_int( strpos( $this->tpl, $tag_name ) ) ) { print 'Could not find tag <i>'.$tag_name.'</i> in the template file!'; return FALSE; } else { $this->tpl = str_replace( '{'.$tag_name.'}', $tag_value, $this->tpl ); } } foreach( $this->tags as $tag_name => $tag_value ) { $this->tpl = str_replace( '{'.$tag_name.'}', $tag_value, $this->tpl ); } # if & else $this->tpl = $this->_parse_control_structures( $this->tpl, array_merge( $this->tags, $this->required_tags ), $this->blocks ); $this->parsed_tpl = $this->tpl; $this->tpl = ''; } /*-----------------------------------------------------------------*/ function print_template()
www.RightClick.ir ��
{ if( !empty( $this->tpl ) ) { $this->parse(); } print $this->parsed_tpl; } /*-----------------------------------------------------------------*/ function get_tpl_as_var() { if( !empty( $this->tpl ) ) { $this->parse(); } return $this->parsed_tpl; } /*-----------------------------------------------------------------*/ function free() { $this->tpl = ''; $this->parsed_tpl = ''; $this->tags = array(); $this->required_tags = array(); $this->blocks = array(); } /*-----------------------------------------------------------------*/ function _parse_control_structures( $tpl, $vars, $blocks = array() ) { if( $matchnumber = preg_match_all( '/<!-- IF (!?)((BLOCK )?)([_a-zA-Z0-9\-]+) -->(.*)((<!-- ELSEIF !\(\\1\\2\\4\) -->)(.*))?<!-- ENDIF \\1\\2\\4 -->/msU', $tpl, $matches ) ) { for( $i = 0; $i < $matchnumber; $i++ ) { //print( $matches[8 ][$i] . '<br />'); if( !empty( $matches[2][$i] ) ) { $code = 'if( '.$matches[1][$i].'isset($blocks[\''.$matches[4][$i].'\']) )'."\n"; } else { $code = 'if( '.$matches[1][$i].'( isset($vars[\''.$matches[4][$i].'\']) ) )'."\n"; } $code .= '{ $tpl = str_replace( $matches[0][$i], $this->_parse_control_structures( $matches[5][$i], $vars, $blocks ), $tpl ); }'."\n"; $code .= ' else '."\n"; $code .= '{ $tpl = str_replace( $matches[0][$i], !empty($matches[7][$i]) ? $this->_parse_control_structures( $matches[8][$i], $vars, $blocks ) : \'\', $tpl ); }';
www.RightClick.ir ��
eval( $code ); } } return $tpl; } } ?>
Q ��� H�3������!� :
��,�� 5 $�9 C5 ��[ ��(46
�9 h�'��- �$ d�, 89 8� 5�' �5��4 �, P Template.php 3j���9 ?�5 � (5�' �5 �c, P ��c4 index.php $�� c5 �c9 (
�� � �4�,� � 0�� ��15� Folder ��4 �, Tpls $��5 �1- �9 (7 �c- �� �c� YT�2� AcS' \�c4�� c5 ��c4 �c, YcT�2 �
body.html $��5(.
��� ��:- ��� 5�' N�5P index.php :
:آ�
<?php include('Template.php'); $MyTpl = new Template(); $MyTpl -> load_file( 'Tpls/body.html' ); $MyTpl -> print_template(); ?>
���� �� body.html :
:آ�
<html> <head></head> <body> <p align="left"> Name: <font color="#0000FF"> <b> Ahmad </b> </font> </p> </body> </html>
www.RightClick.ir ��
_�-���� ��: ^:
P9 $�5�' �5P template ��, �$7�9 �( �4�� ��14 5 U7� 5(.
body.html �95?��! �� � HTML 0��.
�-� index.php �' �9 ��� e35��# P�@A9 Template �$ include ��95(.
8S, e35� Object 8�5�� 8 �5�S- �$ @A9 C5��9 k5��4 �, ( MyTpl :
:آ�
$MyTpl = new Template();
�' 8S, e35�$ YT�2 P Load ��95(:
:آ�
$MyTpl -> load_file( 'Tpls/body.html' );
�9 02��84��* � ��4 �9 8 �'54 (% A� YT�2 P�& 0�7���, .��, C ��#�$ 7�$ �84��* HTML (�'�:.
e3 ��9 v�& �$ YT�2 P9 8S,5(:
:آ�
$MyTpl -> print_template();
� H�35�, ��� ��: �� C58S, ��: x��! (...
�� YT�2 � �$ 7��! 589 �9 ( HTML 89 �� �$ PHP �9 �8��1- �� $�9 � (����, �-6 .T�7�, 54��, 8�( �-� YcT�2
�-��� N��5�9 ��)�(.
�-�� 5& @A9 C���675�- �9 �89 HTML ��,� �� ?��� �, YT�2 �,�T�- � 8c9 $� ?8c� 8 PHP �c�56W5 c C7
, 84��� C {} $��27: �84� . �9 �� �A,� YT�2 P[ &��675� P[ 584$�� C <**> \ <##> \[] , ...
��[ ...��� 5N� body.html:
:آ�
<html> <head></head> <body> <p align="left"> Name: <font color="#0000FF"> <b> {TheVarName} </b> </font> </p> </body> </html>
www.RightClick.ir ��
� $�5�)� TheVarName $� �9� �� {}89 $� 0!� ��'�: $��2 php T�- ?��� �,��� ?8� 856W5 C7�� .�9 ���-� 8
� �95L&�9 � �$6, i��# �, @A9 C 0!� @��#.
89index.php :
:آ�
<?php include('Template.php'); $MyTpl = new Template(); $MyTpl -> load_file( 'Tpls/body.html' ); if( 1 > 2 ) { $Name = 'Ahamad'; } else { $Name = 'Mohsen'; } $MyTpl -> assign( 'TheVarName' , $Name ); $MyTpl -> print_template(); ?>
�9 $�Q ��1� H�37, ��� 858� e3 �5$�� 85(:
:آ�
$MyTpl -> assign( 'TheVarName' , $Name );
� ��� �8 �,5C Method �-�YT�2 Load �c9 �� �� ?8� {TheVarName} � c5 ��� �c, �$ ��� 8 c5�� N� c��
Name ��56W5C 7��9 .
�� �- 8�& �:������ �� (74�- �� (5C Method $�, 8�& �$ Call �9�T� (7 5 � ��� � 0�c� (� �- ?��! ?�$ �5 �c9 �c�
��$���$� 58, U%, �5� (5$�Q C�:
��� 5N� body.html :
:آ�
<html> <head></head> <body> <p align="left"> First name:
www.RightClick.ir ��
<font color="#0000FF"> <b> {FrstName} </b> </font> </p> <p align="left"> Last name: <font color="#0000FF"> <b> {LstName} </b> </font> </p> </body> </html>
��� 5N� index.php :
:آ�
<?php include('Template.php'); $MyTpl = new Template(); $MyTpl -> load_file( 'Tpls/body.html' ); $FName = 'Maryam'; $LName = 'Hamedi'; $NamesArray = array( 'FrstName' => $FName, 'LstName' => $LName); $MyTpl -> assign( $NamesArray ); $MyTpl -> print_template(); ?>
��, d�1S ��#�$ 7�$� 5"�� �$ ���- �1���$� � Method �S-5k 7�9 � �, � (51- PK� �� �- 67�4 c5��( . ��c,�
�5�- �9 C��� ��� ��� 5Q�2 ��7�K4 �( 5�S7� 5$�Q C�:
:آ�
$FName = 'Maryam'; $LName = 'Hamedi'; $MyTpl -> assign( array( 'FrstName' => $FName, 'LstName' => $LName
www.RightClick.ir ��
)); //End of assign template vars -->
��: 8S,- IF YT�2 $�...
�S,7 ��2� 73 ���5��� �, ���- �, (5Z7�� 01�2 75���/T�2 �� �145�.4 ?��� U .��[ :
YT�2 89:
:آ�
<html> <head></head> <body> <p align="left"> First name: <font color="#0000FF"> <b> {FrstName} </b> </font> </p> <!-- IF LstNameCond --> <p align="left"> Last name: <font color="#0000FF"> <b> {LstName} </b> </font> </p> <!-- ENDIF LstNameCond --> </body> </html>
�-�YT�2 89 �, <!-- IF LstNameCond --> � <!-- ENDIF LstNameCond --> �9 02���9 8 5 ��� L
, �$� ��78��9 LstNameCond ���VT� �����7��, �0�� ��� .89 H�3 php :
:آ�
$MyTpl -> assign( array( 'FrstName' => $FName, 'LstName' => $LName, 'LstNameCond' => 1 ) ); //End of assign template vars -->
www.RightClick.ir �
d�, ��� g/Q ��� 5 N���� IF �145 ?��� U784�� .�9 ���-��� �, �9 8� �8� t&�� �� 65�W� c 7 8c��, 8c4��-
�#7 { 5� false��, � � \��14 �8� 5'�9 U��- �9 ��T �0� assign ���/4. � P[ 5C:
:آ�
$MyTpl -> assign( array( 'FrstName' => $FName, 'LstName' => $LName, //'LstNameCond' => 1 ) ); //End of assign template vars -->
8S, ��:}89 $��K- HTML ...
��1% (�9 L'5� 01�2 C5 � �9 ���, �)�7���3 � (5�, �$ ?��� ��8S- � YT�25� ���K5�9 v�& (� ��( .��,�� 5 $�9 C
� 89 �,5�9 ���- ��8:
YT�2 89:
:آ�
<html> <head></head> <body> <p align="left"> #- Name </p> <!-- BEGIN BLOCK MyBlock --> <p align="left"> {Row}- <b> {Name} </b> </p> <!-- END BLOCK MyBlock --> </body> </html>
�-�� 5C (� 89 <!-- BEGIN BLOCK MyBlock --> � <!-- END BLOCK MyBlock --> (.c& �,
7 ?$�3 ...& ��7, �� C5�� C Tag $��K- ���,7P[ �� ��, �9 �� �A,���14 5 ��c3 (c!� d�c1S �c� 0�c* U
��!5 �$ �A,� ?8��� E7�$�j . MyBlock � ��45����VT� �9 0�� 01�2 C.
www.RightClick.ir � �
89 php :
:آ�
<?php include('Template.php'); $MyTpl = new Template(); $MyTpl -> load_file( 'Tpls/body.html' ); $Names = array( 'Ali', 'Morteza', 'Javad' , 'Maryam', 'Ehsan' , 'Fatemeh' , 'Ahmad'); $TotalRecords = count( $Names); for( $Index = 0 ; $Index != $TotalRecords ; $Index++ ) { $MyTpl -> add_block('MyBlock', array( 'Row' => $Index + 1, 'Name' => $Names[ $Index ], ) ); //End of assign template vars --> } $MyTpl -> print_template(); ?>
��,�� 5* �9 C�r��* �.4 ?8� DataBase .K4 e!� �$��8 .h�' �9��� ?��� 8��- � ��$� 5� Names ��8S- � 0��
Record �- (� �� ��� TotalRecords 0�� .��� �,��, ?��� $��K- �� 5 8c� 8 add_block 46c, �8c �$� � (
1���9 $�Q C 7 ,���8, ��O�3� U%, �$ �� ?��� 85(.
���- P,�2 N�K4:
t} � �4���( "�� ���89 �1� HTML T�-��K4 v�& �$ ?8� 8� ( ...�� A[ 5��V, 8�5��, (���1 �4�/3 5 ��c��� YT�2 �
��,�� � (5�, �$ C58 Mail �9�( .��,�� 5 $�9 C5� Method �5���� �W ���� �9 ?$���T�- �, �$ ?8� 8 �7�4���: :
:آ�
$HtmlCode = $MyTpl -> get_tpl_as_var();
m} �, � ��V, �9 ��8S- ���5 (74�- �YT�2 ( Load �9�( .5�S78� load_file �$74�- ��, ( ��c, ��8S- ��� YcT�2
���k��V Call �9�� ���$ P[ �� YT�2 ��1- \(�$��2 (� �! 0.* 7: �84�.
��,$�9:��, ��� ��75 ?���!� 7 �1� A[ �9 �� 5� Header � Footer $�� 0,��5 ��c ec!� 01�c2 ec"' � 8
h��71� P[ \�� �C1)4� �� C .��[ :
www.RightClick.ir � �
:آ�
<?php include('Template.php'); $MyTpl = new Template(); $MyTpl -> load_file( 'Tpls/Header.html' ); ... switch ( $Action) { case 'Login': $Page = 'Login.html'; break; case 'Logout': $Page = 'Logout.html'; break; case 'Contacts': $Page = 'Contacts.html'; break; case 'ContactsSent': $Page = 'ContactsSent.html'; break; default $Page = 'Index.html'; } $MyTpl -> load_file( 'Tpls/' . $Page ); //Load the Body of page ... $MyTpl -> load_file( 'Tpls/Footer.html' ); $MyTpl -> print_template(); ?>
�- e"'�� 501�2 C �,5�9 02� 8�� ��& �9 85 (� �! 0.* N�� C7� 5�- 8���� 89 � HTML Q�27 �c9 �.4
�� �� �-� HTML, Head , Body � ... ��89 ��u���, ����� ���� �- .
� ¡�� ��...� �� 58S, �, C, (4��, ���S' ��. (��,. ��$� �,�"'� �8��,�! � 0���, � �1- 76� 5��6.
?8� �'�_� N�K4:
8% �:/�) (�9 �K' 7 ��� 5��$ ��'$ ���+ +,�c- �, free � $� c5C TemplateEngine c_�-� Cc �c9 \8c��8, ^
_�-� �$ U�7��., P �9 ��� � �9 (�� ...
+,�- free �2� �$7P3�� �� Class 6, �85� \87�$ �1� reset 7 8�9 ) �1�� b�-��� ¢A, � N�1� � ?8c� �'�_�
..., ��� C7��$ (�, �5& �1� ?$�,�� 8�$�8" �$ 6 ��7�9 � 8 ...S- �����- ��'�: YT�2 C ...
www.RightClick.ir � �
SQL Injection �� �, ��,�" � ...
\���!�� �A!
���, ?��� ��2 �9 $�Q ��1�7 � $� ���3 ��� SQL Injection ) $6-5g SQL 5� Query( (�9 0/�...
�9 $�Q ��1�74�� �8 Query 5, �Z!�� L�� � �4�, C DataBase 0�� ...
�r1� �� C74�� ���, �9 8�C���� �4�,�� �� Dynamic �,58 Query ��$� �, ���- �, �$ ���) ��� (�- �,$�9�� �
8,5( ...
�9 h�'� � 85��' � Login $��5��, � (�� 89 �SZ2 �� �,$�9 ��$� 5?���!� � 7�9 �(:
:آ�
<?php $Username = $_POST['Username']; $Password = $_POST['Password']; $SQL = "SELECT * FROM `users` WHERE `u_name` = '$Username' AND `u_pass` = '$Password'"; $Rslt = mysql_query( $SQL); if( mysql_num_rows( $Rslt) > 0) { print('welcome to your profile...'); } else { die('The specified username and/or password is invalid!'); } ?>
?8��. H�37�9 �& �1� ���� �, �9 8��, �,$�9 � �/-� 6 ���9 �$�� user � pass ���37�4�- Login � �c�9
��, ?�/��� �:�\14 7�4�- ...
H�35� �,$�9 �� ��� ��Z7 �� 5� username �9 Single Quotation P[ 0�� ��- jo'hn c ���� � �$7
/, �- ��9� �9 ��� �4��� ��5 ?�/, ?���!� ��$ C5 �4 � ...H�3 1%' �� 8S,���$� �8�� �, �$ �� 5 �$�� PK� C7��9 :
:آ�
username: a password: ' or '1'='1
/, H�3���( SQL � $� PK� �& �,���:
www.RightClick.ir � �
:آ�
SELECT * FROM `users` WHERE `u_name` = 'a' AND `u_pass` = '' or '1'='1'
�4 H�3��) Query �$ ��-��374�� �� 85 P2�8# �:� �W5�! ��� �,$�9 L5�#�$ �, ���, 07 7 4�c- �( Login
�9�(.
� h�' �, d�#5�K� �9 C username �$7�4�� ...
:آ�
username: admin'-- password: 123
H�3 SQL :
:آ�
SELECT * FROM `users` WHERE `u_name` = 'admin'--' AND `u_pass` = '123'
�9 $�Q ��1�74�� �8 $� MySQL M-- 0 A� Comment �� 0 ...
�� 0 A� ��/T��� 5�W� P[ */ ... /* � #$� (� Mysql 8����...
5�S7+2�� $� Query � �, � 5 $� PK� C7�� :
:آ�
SELECT * FROM `users` WHERE `u_name` = 'admin'
� H�35�9 (� C 8,5%�� � Login "'� �,� ��)4� 07�� .
& �1� ��/T�� �, 65L Login 14 (�37�� �K� �K�,7�� ?��� � $��3�! �, ��,� N��AQ� P9 �4�- � DataBase
, $� �$ � �?$� ... � �,5PK� C:
��K4: � �, ��/T�5�K� C7?8� ����4 �9 MySQL 14 �Z37T� ?� 7 SQL server � ... �Z37�� . ..
:آ�
username: ' having 1=1-- password: 123
89 SQL :
:آ�
SELECT * FROM `users` WHERE `u_name` = '' having 1=1--' AND `u_pass` = '123'
*���� �Z375�9 SQL server �?8\� 5��:
:آ�
[Microsoft][ODBC SQL Server Driver][SQL Server]Column 'user.u_name' is invalid in the select list because it is not contained in an aggregate function and there is no GROUP BY clause.
www.RightClick.ir � �
��� �� �97(!� �� Table T�� ��' C��$�� 0!� �, �$ ��8� 8�...
1�� �9 $�Q C�/����� �K� 8 Error 3 ����7 ?�%, 7?�, ...
1� �,�-�- C� Y7 �� $�9 ���� 5� �W�A[ ��9 (� :
:آ�
username: '; DROP TABLE `users` -- password: 123 SELECT * FROM `users` WHERE `u_name` = ''; DROP TABLE `users` -- AND `u_pass` = '123'
H�3 7, ���� �9 854 H�3 A� C�0�...
�� ?���!� UNION :
:آ�
username: ' UNION select max(`u_name`) from `users` -- password: 123 SELECT * FROM `users` WHERE `u_name` = '' UNION select max(`u_name`) from `users` -- AND `u_pass` = '123'
�Z375� �, $��! �9 �� ?85�� :
:آ�
#1222 - The used SELECT statements have a different number of columns
' ��8S- � H�3�8� ��� SQL 14 �$ � �4�,74�� �1� �, (�T� C� ���6c'� �c, �$ ��c ��3 $�9 P c5' L� � 8c�5 $� �cW
UNION � ����85(:
:آ�
username: ' UNION select max(`u_name`),0 from `users` -- password: 123 SELECT * FROM `users` WHERE `u_name` = '' UNION select max(`u_name`),0 from `users` -- AND `u_pass` = '123' #1222 - The used SELECT statements have a different number of columns
�Z3 ��1� (� ��,��/2 7 �$� ?8 ...�5� �$ $�9 C5 � ��� $82 C�85' ��8S- �- (�, 0!� �, �$ �� 8��$�5(.
�r1�� C� �� ?���!� �,5 ��, C�4���T�1�� (7��& Insert, Delete, ... (� �$ 8, ��)4�5(...
��' e"' C1_ $� Login 4 �9��� �� 0�75� �, �9 5,�����9 $�9 E �� � �., +2�� ��1# �$� �4�� Login !��#� 0
,���.�?$�� ...
& ?$�& d�# H�3�� ...
�, ���5x��! ( Login, ��,� 89 \� Login �, �$ �5�- PK� C�� �7� 5(:
www.RightClick.ir � �
:آ�
<?php $Username = $_POST['Username']; $Password = md5( $_POST['Password']); $Username = strtolower( $Username); $Username = preg_replace("([^a-z0-9_]*)", '', $Username); $SQL = "SELECT `u_pass` FROM `users` WHERE `u_name` = '$Username' LIMIT 0,1"; $Rslt = mysql_query( $SQL); if( mysql_num_rows( $Rslt) == 1 && $Password == mysql_result( $Rslt , 0)) { print('welcome to your profile...'); } else { die('The specified username and/or password is invalid!'); } ?>
�9 d�� Password �1�# �$ Hash �9�$�WT� �9 85�� (����V 7 � $�5 � C� ?$�� ���� �� ... �c, ��8� (� ��, ��/T�
���9 �$5 L5�� $�, 8�& � md5 .4�& �, �K�, 8���6�� 5�W�$�- P[ 5��� >5 05 ��c' �c, �O�� 89 �� UQ�c�V
�9��- 8 ,��#7Q�2 ��2 7 �., .. .� A[ 5$�Q C�:
:آ�
$HashedPass = md5( strrev(md5( $Password) . $RegisterDate));
�A35���$ � �$�� $� C � ... �# �97� ?���* �� �- � �9 7�4 5���., h�� (� 8.
8S, ��K4 3 �9��7� �1% 5�,$�9 ��4 �9 ����4�1� e"' 75 �9 ���, 7��3 �5� � (5�� ��9�$�9 �W� _�'�7���/4 ��- :
:آ�
$Username = preg_replace("([^a-z0-9_]*)", '', $Username);
+2� ��/T� �9 (� �,$�9 ��4 0/� Username � �� �$5' C� �$ �����K� U%, � (�W�& �& �� �9 ( c�6 �c�75 c 7 �c4�-
��9 ?���!�.
�Q 8S, ��K4�C���4 SQL 0�� �� :
:آ�
SELECT `u_pass` FROM `users` WHERE `u_name` = '$Username' LIMIT 0,1
�9 $�Q ��1�7, ���8 e"' Password � �� �,$�95,���, E�.9 ���� ?8� ?8)�- ��/T���� � �4�, �S2�� 7& ��6� �5 �W
�� �9 0�� (� 74�3 �( ... (
www.RightClick.ir � �
��� �, (� 8S, SQL �9 02��e"' �9 8 username �$ !$�, �$� 7 $��2 7r1� ?� ���, C LIMIT 0,1 02� (�
�9� e"' �9 85, �$ �$�9$ ����� 7.9 �(.
3 ��K4��7� (% 5�9 0!�)� Password L& � ��3 �$7�9 ��4�� � ( 0!� �, SQL 147$�J! 5( :
:آ�
if( mysql_num_rows( $Rslt) == 1 && $Password == mysql_result( $Rslt , 0))
5�S7, �K� PK� �� �, �:� 84��� SQL � \�46, $�� (� �$5�� C 14 �$7�46, $�� �4�- ...
� N�K45� �W���, �9 0�� (� ����� � �5 ?���!� �W7� ��� � �� 5�� ��9�$�9 �9 ���'�_� 7�Q �� �$ 5 �� ?���!� g
+,�- �5��$� �� ���9 iX# �� �� �(:
:آ�
function EscapeString( $str , $Conn = 0) { if(function_exists('mysql_real_escape_string') && $Conn) { return mysql_real_escape_string( $str, $Conn ); } else { return mysql_escape_string( $str ); } }
�, ��K4�� (% $�5�W �5��, �9 ���� 5,����-�� ��1� user ���,5 \(5K7 c ec"' 7 �c4�- SELECT � ?8c, ��c)4� �$
�5�W�e"' SELECT, UPDATE, INSERT, LOCK TABLE S2� � \?8, ��)4� �4��, �$7 �9 7 ���3�(
Query �9 ���� �$ �84�3 e"'��, ( user T��7� �, 5,���E Connect 7� ��9 \( & �c4��, �cK� �:� c�6� (c� �$
$6-5�- �9 ��9 g��- � N��AQ� ��� �5��3 \��9 ��) DBMS r1� ?�����$�9 C� ?84 �$ ... �c, C1_ $� user �c��
�5,���!��!� E7�� �9�4 �Z3 7��& DROP TABLE, ALTER , ... 84 �$5(.
5� (% ��K4 L5� �W5' $� A[ �9 ���8� ��75�9 int � @�!� �, � 8����5' C� ��)4� �)��� 8��85��$� C� GET 5�
POST L& �$ �9�& ��1� �1�# �9 8�6��, �9 ���, 5?$��2 �:� A[ ���, 8 int +,�- �� �$ ��� ���, intval �9 �$�8
:آ�
$NewsID = intval( $_GET[ 'ID' ]); $SQL = "SELECT * FROM `news` WHERE `ID` = $NewsID LIMIT 0,1";
�, ��K4 ��� �3� (% $�5$�XW4 �9 ��5�9 87���Z3 �� �4�, /, �$ �1�� 8�)�#7AQ� �4 � �4�, ��,� � $��! N�� c5�7 �$
V (�7�9 �3 8��7\�,�3 1� ��&� N��AQ� ���K� �, �9 8���� ���Z3 C� �8 ...��,�� 5� �� 8S, $�9 C5 Pc9 �c9 C
�!��3 � 8� ��3�! ?���*��$ ��� 8 publish �9�d�, 8� 5K7�' �� 5�� P75�- �9 ��1� �'5�� P� �c �4�, include
7� +,�- �� 5$ �� �, �546, �8 PK� C�8:
:آ�
error_reporting( 0);
��$� �,�"'� �8��,�! � 0���, �6� �1� �1� 5��6.
www.RightClick.ir � �
C5A4� ���'� 8B
@�/�: C A4� ���'� ��8S- �B (�3�! 8B �5 �$ C5 ?8� ��.4.
UT�8� ?�5� PF� �, E�,��5� $�:
:آ�
CREATE TABLE online( session char(100) NOT NULL, time int(11) NOT NULL, UNIQUE(session), )
3�5� PF� �, (� 8B ��0!� :
:آ�
<html dir=rtl> <body style="font-family:tahoma;font-size:8pt"> <? session_start(); $session=session_id(); $time=time(); $time_c=$time-600; $tbl_name="online"; mysql_connect("localhost","root","") or die("در �9,- Jورا��� �ل � "); mysql_select_db("new"); $q="INSERT INTO $tbl_name(session,time) VALUES('$session','$time')"; mysql_query($q); $q1=mysql_query("SELECT * FROM $tbl_name"); $num=mysql_num_rows($q1); echo "4�L�; ا�5اد :$num �>�"; mysql_query("DELETE FROM $tbl_name WHERE time<$time_c"); ?>
��5� (� �$�B ��Q �B session ��8S- (� 8S, � ��F� 0/� (��,��5� ��8� $� �$ ���'� 7 �1- ��� session 0/� ���
?$�1.� �$ ?8�.
www.RightClick.ir � �
05�! 7'�S ���!�� �,
01�2 ?8��B 85���, U5�6'� $� $�V, �$� �, ��%��$ �� 7F5'�S 7 � �c, ���c!� �c5� $� �cB 0c!� 8cB php �$ ���
(���X: :
:آ�
<? $body = 'Catalog of Our Site'; function send_mail_to_friend($mail_to,$mail_from) //Send Catalog of Site... { global $body; $mail_subject = "My Site Catalog Mail Subject"; if(mail($mail_to, $mail_subject, $body, "From: <$mail_from>n"."MIME-Version: 1.0n"."Content-type: text/html; charset=utf-8")) { return true; } return false; } //End of send_mail_to_friend Function if(isset($_POST['send_mail'])) { $mail_to = isset($_POST['to']) ? htmlspecialchars($_POST['to']) : ''; $mail_from = isset($_POST['from']) ? htmlspecialchars($_POST['from']) : ''; if(send_mail_to_friend($mail_to,$mail_from)) { print("Your Mail is Send!"); } else { print("Error While Sendin Mail!"); } exit(); } //This Code Downloaded From www.RightClick.ir ?> <head> <meta http-equiv="Content-Language" content="fa"> </head> <body> <form method="POST"> <p><span lang="en-us">Your Email : </span><input type="text" name="from" size="20"></p> <p><span lang="en-us">Your Friend Email :</span><input type="text" name="to" size="20"></p> <p><input type="submit" value="Submit" name="send_mail"></p> </form> </body> </html>
www.RightClick.ir ��
^�_�- :
$� 8B C5� 84��* �, � 8��!��3 �B 7 �4 �� �, �� ;5 php 8��B ?��3j.
75��6�& (���/, ��# (��5�4 7 �)B ��� ��!$� ?8��B 0'�5$� lV� ���, 8����3 7 �B.
H�3 Front Page 3 05�! �� ��� ��- � 8��B 0!$� ��� ��- ��.2 �� ;5 � 8��B ��, �$� �� N�4�F �
8��B 7'�S �$ ��� .���, 8F�4�5 N$� �, 8����4 7!$�' �:� 7�!�$.
d�# ��� e3 $�
:آ�
$body = 'Catalog of Our Site';
N$�/� ��� �, Catalog of Our Site �$ 8��3�! �B �� �� @$�! 8� ��1- �W5� � C58, $��2.
���- 8�4�- 7 (� �$ �5� ��� N$�/� C1_ $�Y!�� ����* �- C58, ��., v�& :
My Site Catalog Mail Subject Your Mail is Send! Error While Sending Mail!
www.RightClick.ir ���
01�2 ;5 ��3 05�! ���,"� �, ��/-$� "(5���,
���!�� �A!
;5 �, ���4 �1� �, �1� 05�! ��:8��B 85���, ��/-$� ���, �B 8��B 714 �F' �5� �c, 7�#�$ �, 8�4���, �%4� �B 0!� 01�2
8���, ����� ��/-$� �1�...I
(��B 7 0!$� �$ 01�2 C5� (� �, H�3 :
(W� �B �8B C5� ��& �1� �� ��� �, php �� �c $��! �B (5�� CG1Z 85�, ?$�� P�15� ��!$� �, ���4 � U��� php
�� (�4��- 7 � � 8�F� 74�/��.* mail Server (��B ?���!� .
:آ�
<?php $admin_email = "YourEmail"; if(isset($_POST['submit_msg'])) { if (empty($HTTP_POST_VARS['name_msg'])){ die('<font face="Tahoma" color="#003399" style="font-size: 9pt"> م �7د را�� �>MN ;('<font/>.��8��1 وارد }; if (empty($HTTP_POST_VARS['email_msg'])){ die('<font face="Tahoma" color="#003399" style="font-size: 9pt"> �7د �ا�81 �>MN ;('<font/>.��8��1 را وارد }; if (empty($HTTP_POST_VARS['msg_body'])){ die('<font face="Tahoma" color="#003399" style="font-size: 9pt"> �80م �7د را �>MN ;('<font/>.��8��1 وارد }; $name_msg = htmlspecialchars($HTTP_POST_VARS['name_msg']); $name_msg = str_replace("&","&",$name_msg); $name_msg = str_replace(" ي","ي ",$name_msg); $msg_body = htmlspecialchars($HTTP_POST_VARS['msg_body']); $msg_body = str_replace("&","&",$msg_body); $msg_body = str_replace(" ي","ي ",$msg_body); $msg_body = nl2br($msg_body); // check empty for url... if (!empty($HTTP_POST_VARS['url_msg'])) { $url_msg = str_replace('http://','',$_POST['url_msg']); $name_msg = "<a target=_blank href=http://".htmlspecialchars($url_msg).">".$name_msg."</a>"; } if(!strpos($_POST['email_msg'],"@")) { print("<font color=#ff0000 face=tahoma >� ���6ا ا�81� ورودي �� 9 !"); die("<br><br>Example : [email protected] </font>");
www.RightClick.ir ���
}; $from = htmlspecialchars($HTTP_POST_VARS['email_msg']); // start of Email Body... $body = '<html><head><title>.:| Contact |:.</title><base target="_blank"></head> <body text="#000000"> <p align="right" dir="rtl"><font face="Tahoma" size="2">مL� � دو�Q�QR 6مSار��ل ��1د T9�80 �1� اي� �>� U� 6ا�.</font></p> <p align="right" dir="rtl"><font face="Tahoma" size="2">م�� : '.$name_msg.'</font></p> <p align="right" dir="rtl"><font face="Tahoma" size="2">�80م : </font></p> <p align="right" dir="rtl"><font face="Tahoma" size="2" color="#003399">'.$msg_body.'</font></p> <p align="center" dir="rtl"> </p> <p align="center" dir="rtl"><font face="Tahoma" style="font-size: 9pt">� رزوي; 5�968 �اي ��1</font></p> <p align="center" dir="rtl"> <font face="Tahoma" color="#003399" style="font-size: 9pt"> <a href="http://www.rightclick.ir/">6را� U8�V</a></font></p> </body> </html>'; //End of Email Body ... if(!mail($admin_email,'New Contact',$body,"From: <$from>\n"."MIME-Version: 1.0\n"."Content-type: text/html; charset=utf-8")) { print("The Mail Could not be send."); }else { print('<font face="Tahoma" color="#003399" style="font-size: 9pt"> � �1� �80م5�968 �اي ���9 ���6 ار��ل ��.</font>'); } }//End of set Submit... else { ?> <html> <head> <title>Contact Us ...</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Language" content="fa"> <style> .TEXT{ font-family:Tahoma; font-size:9pt; } </style> </head> <body> <form name="msg_form" method="POST" > <div align="center">
www.RightClick.ir ���
<table border="0" width="359" cellpadding="2"> <tr> <td width="242" dir="rtl"><font face="Tahoma"><span style="font-size: 9pt"> <input name="name_msg" size="22" class="TEXT" dir="rtl" tabindex="1" maxlength="35" lang="fa" style="float: right"></span></font></td> <td dir="rtl"> <p dir="rtl" align="center"><font face="Tahoma"><span style="font-size: 9pt">م�� �1�<font color="#FF0000"> <span lang="en-us">*</span></font></span></font></p></td> </tr> <tr> <td width="242" dir="rtl"> <p align="right"><font face="Tahoma"><span style="font-size: 9pt"> <input type="text" name="url_msg" size="22" dir="ltr" tabindex="2" maxlength="30" class="TEXT"></span></font></td> <td dir="rtl"> <p dir="ltr" align="center"><span lang="en-us"> <font face="Tahoma" style="font-size: 9pt">Web</font></span></td> </tr> <tr> <td width="242" dir="rtl"><font face="Tahoma"><span style="font-size: 9pt"> <input name="email_msg" size="22" dir="ltr" tabindex="3" maxlength="40" class="TEXT" style="float: right"></span></font></td> <td dir="rtl"><p dir="ltr" align="center"> <font face="Tahoma"><span style="font-size: 9pt"><font color="#FF0000"> <span lang="en-us">*</span> </font></span></font> <font face="Tahoma" style="font-size: 9pt"><span lang="en-us">Email</span></font></p> </td> </tr> <tr> <td width="242" dir="rtl"> <p align="right"><font face="Tahoma"><span style="font-size: 9pt"> <textarea rows="5" name="msg_body" cols="33" dir="rtl" class="TEXT" tabindex="4" lang="fa"></textarea></span></font></td> <td dir="rtl"> <p align="center"><font face="Tahoma"><span style="font-size: 9pt"> -�1�d<font color="#FF0000"><span lang="en �80م us">*</span></font></span></font></td> </tr> </table> </div> <p dir="rtl" align="center"> <input type="reset" value="reset" name="reset_btn" ><input type="submit" value="Submit" name="submit_msg" tabindex="5" ></p></form> <?php }//End of Else... ?> </body> </html>
www.RightClick.ir ���
+,�- �� $�B C5� ���, mail ?��! �� 7F5 �B (��B 7 ?���!� ��%��$ C5�- ��!$� $� P�15� php 0!�.
�Q�$� �$ N��AQ� �B 0!� PF� C5� �, 8B C5� $�B YT�25! �58 ���, � ?��14 0'�5$� �,$�B �� ��' ; ��c!$� 05�
8�B 7 .
8��B ���- N$�/� ��� �, ��� e3 $� 8B C5� $� �B YourEmail � ��� ����4 05�! �58 P�15� 7��5�, �c, �$ P5�'
84��* �, \ 8��!��3 �B 7 �4 �� php 8��B ?��3j 8��!��3 �B 75���� $� �.
www.RightClick.ir ���
EF� ���*� � �4�, ��� �)?��! 7��3(
�8�/ ���'� ���, ?��! 7��3 ��� � �5.
�B (��5��, � �4�, �5 (����V� (��B ���*� �$ �� ��F� ��� ���!� �, ).�5 ��/T� ?��! 7��3 7��3 � �4�,(
(!� �, 7F5 (5$�� P5�' �� �, ���4 $�B C5� ���, upload.php (!� �, ��W5� � upload-a.php :
P5�' upload.php ?�5� PF� �,:
:آ�
<html dir=rtl> <form action=upload.php method="post" enctype="multipart/form-data"> <input type=file name=up><br> <input type=submit value=UPLOAD> </form> </html>
��F4: 8B �� 01�2 C5� �, ���, 85�, �1�#\8��B 02�!
:آ�
enctype="multipart/form-data"
��� P5�':
:آ�
<html dir=rtl> <? $path=$HTTP_POST_FILES['up']['name']; if($path!='none'){ if(copy($HTTP_POST_FILES['up']['tmp_name'],$path)){ echo "د���1 ;0� ���5 ��<br>"; echo "?ا�:".$HTTP_POST_FILES['up']['name']. "<br>"; echo "ع��:".$HTTP_POST_FILES['up']['type']. "<br>"; echo "Sا��از:".$HTTP_POST_FILES['up']['size']. "<br>"; echo "<img src='$path' width=150 height=150>"; } }else{ die("رو �ب آ4 ��5�Yا��"); } ?>
N���_�-:
:آ�
$path=$HTTP_POST_FILES['up']['name'];
?8� k5�S- U�* �� ����� ��3 php *� (5��V� �B 7�5�' ��4 � 8B C5� ���!� �, �B 0��0!8, �$ (��B ��� (5$��� .
��� �:� �W� �B ?8� ?���!� ?��! ��� �5 �� 8S, ��#� $�)����� path( CB ���*� �$ P5�' ��/4 7T�3.
+,�- ���!� �, copy() P5�' ?$�� 01�2 �� �B ?�c�3j 0�c� �-��J �B ��$ �B ��4 ��1� �, (�5��V� �B ���� $� �$
(��B.
www.RightClick.ir ���
��F4: ����� path �$0��X: �.� (� �5� PF� �, .
:آ�
$path="upload/".$HTTP_POST_FILES['up']['name'];
$� �� ��F� �B f�' C5� �, $8T�' upload �.� ?��3j.
��F4:
:آ�
$HTTP_POST_FILES['up']['name'] $HTTP_POST_FILES['up']['type'] $HTTP_POST_FILES['up']['size']
����� C5����1� ��.��B PF� (� ��).k5�S- U�* �� ��� ����� $� ?8� php C���(
?��! ��� �5 �, A[ 8��F, 8�4��� (� �W5� ���$�B �1� 85$�6, 05��8� P5�' ?��84� ���,.
�5�� �9 ��5� ��� � (�9 �'�_� C (� �$ ��K4 php 4 ��� �, (�4�- 7 8S, �,
:آ�
$HTTP_POST_FILES
��
:آ�
$_FILES
(��9 ?���!� (�.
www.RightClick.ir ���
�� ���G!��� H��� � ���,$�9 :
GD &� I 0�
5K7�4�V,��9 �� ��� php ?���� � �, �9 0����$ ?8��9 $�9 U�' � EK� � ( ...& �4�V,��9� �...I � ���1) � ��
* �� +,��-��- 0�4�J �9 P[ ��3 �$� $� ?8� ����4 U�T� ��,� 7 ...
��,�� �4�14 5 (� C�4��7�- �� �, ��/-$� ��' �1� ��! C5� � 89 ��� 0��7�$ c!$�,7 c�9 7 �/� c�7 �c9 URL 8c9
� ���7 5�' �5P php T�- �)4�� �9 0��� 8��..
��� � +,�- ��84$)7�4�� (:
�Q���84$ +,�- �� ?���!� :
:آ�
$a = rand(0 , 50);
�-��� �� a �� 7'��O- $�8" ;5{ �- n{?��W� $��2 .
���-: { � n{85�, �1�# int 8���, .(� +,�- 7���3 int 0��.
4 0J5�F!� ���� 7* R� 7* e!� ��., �� �, �B �$�� ���� �8B �B (4�8, (���3 7 I0��
?�)�* ��1� �$�b� I8�8, �$ 0J5�F!� ���� N�T� �B �$�� ���� �8B � 8�� 7 7 ��* � ��� 7 ��, �B 7F&�B �.
8B �B ��5� N$�b� �:� C�/, php 8S, � �., ���� 75�� �- Alert ;��B �, 8S, � 8�8, ��$ ���B Ok ��c�� 8B ��",
�4 �., ... $��!� �, 74��� 7T� print � ?��!C5� �5 �- �B php �- 8S, �8�/, �$ java Script 7�B ��, �$:
t:
:آ�
print('<script language="javascript"> alert("Salam"); </script>');
� :
:آ�
... ?> <script language="javascript"> alert("Salam"); </script> <?php ...
www.RightClick.ir ���
T�8B �:� ��/ e!� 0J5�F!� ���� php ��c ����� �B �.� ���� 0J5�F!� ���� 8B 7�2� 7�B ?���!� php ��c1-
$��!� �5� ��� 8B �B ��5� �$�b� ���, ?8� print ��.� ���� (� �W- ��� � �$ ��� N��3 �B C5� �W exit 7�B.
89����� �� �, ����, �9 �$�� ���� � 5 �� L�- R� 7 N$�O, �$ �� �� �51� C �3� I ���!�' P c5 Lc19 �c, L
!���� � (��7 � �1� 5! 89 L�1��7��, �����!�' �51�� $� PK. � � (�3�! P5 �c� 8c9 �9 0�� C� c- R� 7 �$ ��
1"�� N$�O,���.4 � �4 $� ( 7 N$�O, �4�� � 8�� 514 �� L7�, $�K& ��!�' 5I (�9 8
��,�� 5�- �$ �� 89 C�� 51�4 P ��.7 �K' �9 ?� ��4�� ��K text �, � 8����5+2� 8 W, U%, ��!$��� �9 (5�� html
8���� .� ��� �, ��,� $8� ����!�' �,5��)4� �$ $�9 C �85( :
�-�+,�- mail 5� �, �$�%& �� �:$� �5�9 i�_� PK� C�8 :
:آ�
mail($mail_to, $mail_subject, $mail_body, "From: <$mail_from>n"."MIME-Version: 1.0n"."Content-type: text/html; charset=utf-8")
5�S7 � 895 U%, ?8 �� d�, 01�2 $� �9 �7 ��c�� �c9 �4�1%' � ��c HTML ��� ��cK4� � 0�c� UTF-8
0��:
:آ�
"MIME-Version: 1.0n"."Content-type: text/html; charset=utf-8"
� ��K4� �:��1� � &�� 65� �W��� �, 0�� � utf-8 �$ ��� ��K4�7�4 5��T� 87 �:� 7��3 �5� 851 c�P c!$�'7
�!�,��1�# 8 utf-8 ���, ...��/T� Arabic (windows-1256) (��T� ���, �4��7 H���� P75 P[ c5 0c!$� ���
147 �8, U4�.4 C4�- 5�S7* ���1� ��._�. utf-8 0��.
$�Q �&� � �� �.+,�- SMTP ��9 ?���!� III
SMTP �3 +,�-74 ���V, N��3 �:� 0�75��, 5�73 ��73 � ?$�� �!�$� ��7 ��K. ...
S,��- � �� @A9 � �7� $� 5 � C� �9 ?8� ����4 ���4���� �� (5�� �9 ?���!�� ( ...5 ���c9 U��c- ���3 �9 H�3 +/� �
'�S 0%, �$7 �(�K:
� �4�, Contact us �95L4�) � �4�, 7� Open Source $8cT�' $� � Cc9 ���4�� �$ 0!� includes c5�' � c5 P
��4 �, 0�� smtp.php � �4�, �� �9 phpbb $�� ��� � (�'�:� �9 7 � U1�!��35��5 (� ����, $�9 � ���9 U.
��#�$ ...
�-� � �4�, ��1� �4��7 /,��7���9 $�K& �9 .
:آ�
<?php /*************************************************************************** * RightClick CMS var 2.0 * -------------------------- * begin : Monday, July 29, 2006
www.RightClick.ir ���
* copyright : (C) 2006 The RightClick $Team = "www.rightclick.ir"; * email : [email protected] * * $Id: RightClick CMS var 2.0 2006/07/29 13:20:00 $ * ***************************************************************************/ //Configuration... $Config = array( 'SmtpHost' => 'localhost', 'SmtpUsername' => 'user', 'SmtpPassword' => 'pass' ); function server_parse($socket, $response, $line = __LINE__) { while (substr($server_response, 3, 1) != ' ') { if (!($server_response = fgets($socket, 256))) { die ("Couldn't get mail server response codes". $line. __FILE__); } } if (!(substr($server_response, 0, 3) == $response)) { die("Ran into problems sending Mail. Response: $server_response". $line. __FILE__); } } // Replacement or substitute for PHP's mail command function smtpmail($mail_to, $SenderMail, $subject, $message, $headers = '') { global $Config; // Fix any bare linefeeds in the message to make it RFC821 Compliant. $message = preg_replace("#(?<!r)n#si", " ", $message); if ($headers != '') { if (is_array($headers)) { if (sizeof($headers) > 1) { $headers = join("n", $headers); } else { $headers = $headers[0]; } }
www.RightClick.ir ��
$headers = chop($headers); // Make sure there are no bare linefeeds in the headers $headers = preg_replace('#(?<!r)n#si', " ", $headers); // Ok this is rather confusing all things considered, // but we have to grab bcc and cc headers and treat them differently // Something we really didn't take into consideration originally $header_array = explode(" ", $headers); @reset($header_array); $headers = ''; while(list(, $header) = each($header_array)) { if (preg_match('#^cc:#si', $header)) { $cc = preg_replace('#^cc:(.*)#si', '1', $header); } else if (preg_match('#^bcc:#si', $header)) { $bcc = preg_replace('#^bcc:(.*)#si', '1', $header); $header = ''; } $headers .= ($header != '') ? $header . " " : ''; } $headers = chop($headers); $cc = '';//explode(', ', $cc); $bcc = '';//explode(', ', $bcc); } if (trim($subject) == '') { die ("No email Subject specified". __LINE__ . __FILE__); } if (trim($message) == '') { die ("Email message was blank". __LINE__. __FILE__); } // Ok we have error checked as much as we can to this point let's get on // it already. if( !$socket = @fsockopen($Config['SmtpHost'], 25, $errno, $errstr, 20) ) { die ("Could not connect to smtp host : $errno : $errstr". __LINE__ . __FILE__); } // Wait for reply server_parse($socket, "220", __LINE__); // Do we want to use AUTH?, send RFC2554 EHLO, else send RFC821 HELO // This improved as provided by SirSir to accomodate if( !empty( $Config['SmtpUsername']) && !empty($Config['SmtpPassword']) )
www.RightClick.ir ���
{ fputs($socket, "EHLO " . $Config['SmtpHost'] . " "); server_parse($socket, "250", __LINE__); fputs($socket, "AUTH LOGIN "); server_parse($socket, "334", __LINE__); fputs($socket, base64_encode($Config['SmtpUsername']) . " "); server_parse($socket, "334", __LINE__); fputs($socket, base64_encode($Config['SmtpPassword']) . " "); server_parse($socket, "235", __LINE__); } else { fputs($socket, "HELO " . $Config['SmtpHost'] . " "); server_parse($socket, "250", __LINE__); } // From this point onward most server response codes should be 250 // Specify who the mail is from.... fputs($socket, "MAIL FROM: <" . $SenderMail . "> "); server_parse($socket, "250", __LINE__); // Specify each user to send to and build to header. $to_header = ''; // Add an additional bit of error checking to the To field. $mail_to = (trim($mail_to) == '') ? 'Undisclosed-recipients:;' : trim($mail_to); if (preg_match('#[^ ]+@[^ ]+#', $mail_to)) { fputs($socket, "RCPT TO: <$mail_to> "); server_parse($socket, "250", __LINE__); } // Ok now we tell the server we are ready to start sending data fputs($socket, "DATA "); // This is the last response code we look for until the end of the message. server_parse($socket, "354", __LINE__); // Send the Subject Line... fputs($socket, "Subject: $subject "); // Now the To Header. fputs($socket, "To: $mail_to "); // Now any custom headers.... fputs($socket, "$headers "); // Ok now we are ready for the message... fputs($socket, "$message "); // Ok the all the ingredients are mixed in let's cook this puppy...
www.RightClick.ir ���
fputs($socket, ". "); server_parse($socket, "250", __LINE__); // Now tell the server we are done and close the socket... fputs($socket, "QUIT "); fclose($socket); return true; } ?>
/,�C �-�89 8� ��$� $� �9 d�,51� 8��! C5 8� 8���3 ?���!� 0)��, ��/T�� �1� 5�T�&�9 � �- c�� �c, �c9 ���� ��
�%�-75���, ?���!� P,�2 (5��4 �, 0�� +,�- � smtpmail $�9 �9 ��)4� �$ ��!$��'�9 e"' ?8�, �� �� 8S5��" �9 C5�
Config �$ Set ��95� 85+,�- C ��$� �, �$�4�3��' ��� 7�9 �8.
��B $�B �.� 7* R� 7* $� �� 7B�B �, �$�Q �& I
��,�� 59�9 ��)7+,�- �� �� set_cookie ?���!���. :
:آ�
setcookie ("name", "value"); //Ex: setcookie ("Color", "#FF0000");
�5C ��$� +,�-��� �� 5� �W�, N�4�K � �9 ?$�� (� ���.�9�9 �� ?���!� $� �$ 7$� �� �3�� � $��$�- A[ ?$�XW5 >
�b"4��9�9 7 �� \�9�9 �, ��,� C7� \�3j ����! ?��� ...
:آ�
setcookie ("name", "value", "expiration", "path", "domain", "secure"); //Ex: setcookie ("Color", "#FF0000", time() + 3600); setcookie ("Color", "#FF0000", time() + 3600, "/user/"); setcookie ("Color", "#FF0000", time() + 3600, "", "", "1"); setcookie("Color", "#FF0000", time() + 10000000, "", "", "");
��,�U484�3 :
:آ�
//Ex: print($_COOKIE['Color']);
��, ��iX# :
:آ�
//Delete: setcookie("UserName","");
www.RightClick.ir ���
setcookie("UserName","",time()-60);
;5 @$�� �.� �$�Q �& rss �, 7* R� 7* �$ �� N�5��� � (��B �$�� 7* R� 7* P3�� �$ I ?8, ��"�4� E�,��5� ��$
� � ��8� C9 h�'5�� :
:آ�
CREATE TABLE `bairro` ( `hash` int(11) NOT NULL default '0', `descr` varchar(15) NOT NULL default '', PRIMARY KEY (`hash`) ) TYPE=MyISAM;
5� �'5P Xml $�� (�5� (5$�Q C�:
:آ�
<?xml version="1.0" encoding="iso-8859-1"?> <data> <table name="bairro" primary_key="hash"> <row> <field name="hash">1</field> <field name="descr">Centro</field> </row> </table> </data>
5* @A9 ���#�$ �, �9 ���9 �87� 5 ��)4� �$ $�9 C�?8 ... �5?8� ����X: �4�14 89 @A9 ��� �:
:آ�
<?php class xmlToDB { var $parser; var $cn; var $table; var $recordset = array(); var $content; var $value; var $field; function xmlToDB() { $this->parser = xml_parser_create(); xml_set_object($this->parser,$this); xml_set_element_handler($this->parser,"tag_open","tag_close"); xml_set_character_data_handler($this->parser,"cdata"); $this->cn = @mysql_pconnect(XOOPS_DB_HOST,XOOPS_DB_USER,XOOPS_DB_PASS) or trigger_error('Erro ao conectar ao servidor de dados',E_USER_ERROR); @mysql_select_db(XOOPS_DB_NAME,$this->cn) or trigger_error('Erro ao selecionar o banco de dados',E_USER_ERROR);
www.RightClick.ir ���
} function parse($data) { @xml_parse($this->parser, $data) or die(sprintf("Erro de XML: %s na linha %d", xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser))); } function tag_open($parser, $tag, $attributes) { $parser; switch ($tag) { case 'DATA': break; case 'TABLE': { $this->table = $attributes['NAME']; mysql_unbuffered_query("TRUNCATE $this->table"); $this->recordset = array(); //[todo]primary key n?o usada } break; case 'ROW': break; case 'FIELD': { $this->content = (isset($attributes['CONTENT'])) ? $attributes['CONTENT'] : ''; $this->field = $attributes['NAME']; } } } function cdata($parser, $cdata) { $parser; switch ($this->content) { case 'base64': { $this->value = base64_decode($cdata); } break; default: { $this->value = $cdata; } } } function tag_close($parser, $tag) { $parser; switch ($tag) { case 'DATA': break; case 'TABLE': break; case 'ROW': { $sql = "INSERT INTO $this->table"; $iC=0; foreach ($this->recordset as $tcaption => $tvalue) { if ($iC==0) $sql .= "nSET "; else $sql .= ", "; $sql .= "`$tcaption` = '"; $sql .= mysql_real_escape_string($tvalue,$this->cn); $sql .= "'"; $iC++; } mysql_unbuffered_query($sql,$this->cn); } break; case 'FIELD': { $this->recordset[$this->field] = $this->value;
www.RightClick.ir ���
} } } } //Example for use class $file = 'MySample.xml';//Xml File //require('mainfile.php'); //require('config.php'); define('XOOPS_DB_HOST', 'localhost'); define('XOOPS_DB_USER', 'root'); define('XOOPS_DB_PASS', ''); define('XOOPS_DB_NAME', 'testDb'); $xsparse = new xmlToDB(); $fnum = @fopen($file,'r') or exit();//trigger_error('Erro ao abrir o XML',E_USER_ERROR); while (($data = fread($fnum,4194304))) { $xsparse->parse($data); } fclose($fnum); ?>
��F�14 N$�J � �$ 7!$�' ?$�� 7�F. ;5 e"' �2� !!!
5!$�, �7/, C9 ��' ��K4� �:� C5P XML 5�' �5P php � �- �9� DB 0c/�� �- �$ �c�K c�� 8c, �� �c� 5 8
��9$�9...
:آ�
<?xml version="1.0" encoding="iso-8859-1"?>
�8% : �&�$�� ��B �8�* 7T�8� $� �8��' ��4 �.� I
(�46� @8# :
:آ�
mysql_result(mysql_query("select * from `".$table_prefix."themes`"),1,3);
�4 � ?$�1� 8��' �uI8�1%' �.� �$�� �& �$ ��%��' ��8S- � ��B �8�* �.� �$�� �& �$ ��8� ;5 I �� k5�$ �4!! !
:آ�
$ResultRs = mysql_query("SELECT * FROM `".$table_prefix."themes`");
www.RightClick.ir ���
$FieldName = mysql_field_name($ResultRs, 2);//Name sevomin field. $TotalFields = mysql_num_fields($ResultRs);//Teedade Field ha.
��, 89� $� U�' 7'��O- UV* PHP � JavaScript :
:آ�
<? $my_array[] = "swf/swf%20(0).swf"; $my_array[] = "swf/swf%20(1).swf"; $my_array[] = "swf/swf%20(2).swf"; $my_array[] = "swf/swf%20(3).swf"; $my_array[] = "swf/swf%20(4).swf"; $my_array[] = "swf/swf%20(5).swf"; $my_array[] = "swf/swf%20(6).swf"; $my_array[] = "swf/swf%20(7).swf"; $my_array[] = "swf/swf%20(8).swf"; $my_array[] = "SWF Address ... "; $swf_addr = $my_array[rand(1,count($my_array))-1]; ?> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=6,0,29,0" width="441" height="332"> <param name="movie" value="<? print $swf_addr; ?>"> <param name="quality" value="high"> <embed src="<? print $swf_addr; ?>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="441" height="332"></embed> </object>
75�1���$ :8�4��- 7 8����3 7 �B ��8S- �� �, d�, 8B $� ��
:آ�
$my_array[] = "";
8��B ?���!� . C.�-�B $�" " (��5��� �$ U�' P5�' @$�� .�� 7c ��V5$ �5�$� ���! ;5 $� �� @$�� C5� �� ��8B
7F5 7'��O- �8� ;5 8�T�- �, EJ! ��� �� @$�� C5� ��(5$�� 7 $� U5�14 �, � (��B 7 H�V�4� �$ .
8B (� C5� � 0J5�F!� ������� :
:آ�
<script language='JavaScript' type='text/javascript'> var num_swf = 5 day = new Date() seed = day.getTime()
www.RightClick.ir ���
ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*num_swf + 1,10) switch (ran)//***************** 1 ********************** { case 1 : swf_addr = "swf/swf%20(0).swf";break; case 2 : swf_addr = "swf/swf%20(2).swf";break; case 3 : swf_addr = "swf/swf%20(3).swf";break; case 4 : swf_addr = "swf/swf%20(4).swf";break; case 5 : swf_addr = "swf/swf%20(5).swf";break; } document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="441" height="332">'); document.write('<param name="movie" value="'+ swf_addr +'"><param name="quality" value="high">'); document.write('<embed src="'+ swf_addr +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="441" height="332"></embed></object>'); </script>
$� �8�,� 7��5�, ��1B �5 ��.�, ��8S- �, 8B C5� �����- ���, $�8" ��� e3 var num_swf = 5 7c �B ���8S- �, �$
8��B h�� 8�5��3.
�, �B 7�1�2 $� EJ!
//***************** 1 **********************
lV. 8��B 7 �'�_� N$� C5� �, e3 ;5 ?8� :
:آ�
case 5 : swf_addr = "SWF ADDRESS";break;
e3 C5� $� �B SWF ADDRESS �8� � 0!� � U�' P5�' @$��n ��c,� @$�� Cc5� �B 0!� C5� ?8��� ��.4
U�' C�1)�* �, 0!� � .
��, �4�W&�! 5��3 0 ��$� ���9 0!$� �I (
C9 h�'5$�� ��8� �5 ��c4 �, ( Article ' �c- 8c�& �� ' �c9 ?$�� 8c�� ��� ��� 8c� id ��� a�c4 �c9 0�c� int �
AutoIncrement 0�� ...�r1�� C5' ����, 8��$�- 5�, 0/� > ��4 SendDate �$� c5 � ( c5' �� � 8c�5 ��c4 �c, �cW
ArchiveDate $��5* $�Q �, �9 (�h�. T�3��.
:آ�
SELECT * FROM `Article` WHERE `ArchiveDate` = ''
(� ?� �� �! H�3 Query �5 ���� �$ ���K7 :
www.RightClick.ir ���
:آ�
UPDATE `Article` SET `ArchiveDate` = '$ThisMonth' WHERE `ArchiveDate` != '' AND `SendDate` < '$Today'
ThisMonth �� ���$�- �9 0�� 5$�� ?� >�� ?$�� �$ Today $�-5?$�� �$ ��� � > .
��,��$� �84�3 ��:
:آ�
SELECT `ArchiveDate` FROM `Article` WHERE `ArchiveDate` != '' GROUP BY `ArchiveDate` ORDER BY `ArchiveDate` DESC
�- ?��!5��$ C7 �, �9 C C�j7 !$�8.
I (5$�XW, Y�Z � ��� �� ����4 ���, �4�W&
:آ�
<? $Str = 'Salam halet khoobeh?'; $OutPutStr = substr($Str, 0, 5); $OutPutStr .= '...'; $MoreLink = '<a href="?Action=ShowNews&NewsID=5">More...</a>'; print($OutPutStr . '<br />' . $MoreLink); ?>
(� 7K��T ��� A[ �9 7W, � 7�5��, � �4�, ���, 85�, N��3 ?��! 7 �9 NewsID �9n �$ ��� �c1� 0�� ��.c4
� ?8, ...
:��� � ���9 U9 N�$��!�U9 �� ���I 0��&
CB ?���!� $��!� C5� �� ���F4 UB ���, ...
:آ�
header("Pragma: no-cache"); header("Cache-Control:no-cache");
$��!� C5� �� ���B UB ���, �...
:آ�
header("Pragma: cache");
www.RightClick.ir ���
0 A� @+,��- 0.* $���,$�9 �& �I �$��
@ ��4 �� P/2 7�2���Z3 0!��3 � �., ��,�$ 0�K� �, +,�- �9 7-$� $� ��� +,�- �5 714 ��9 v�& �$ ���3
?$�j .7r�� ��� (� $�$� �:� 7�S5.
:آ�
@mysql_connect("localhost");
:آ�
mysql_connect("localhost");
& �5 � ?8� 05�! �$�� 7!$�� �& �� �,$�B �B (�1%, �.� �$�� L��! ��P �� (���! �:$�� P[ U-�4�F � ip
� ..�$�� 0!8, �$I
���$� @$�� ���,:
:آ�
$_SERVER['HTTP_REFERER']
ip :
:آ�
$_SERVER['REMOTE_ADDR']
� �:$�� � P �� (���! ...
:آ�
$_SERVER['HTTP_USER_AGENT']
C9 ���� �$ 89 �K- C5� ��", �85� ���,:
:آ�
foreach( $_SERVER as $i => $v) { print( "$i => $v <br />"); }
8��9 7 ?8��. 7�K� C5� �/5�"- 7���3 �5 \�,$�9 (���! �, ���, \89 �K- C5� ����� �� 8S,:
:آ�
COMSPEC => C:\WINDOWS\system32\cmd.exe DOCUMENT_ROOT => c:/wamp/www HTTP_ACCEPT => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/ vnd.ms-powerpoint, application/msword, */* HTTP_ACCEPT_ENCODING => gzip, deflate
www.RightClick.ir ��
HTTP_ACCEPT_LANGUAGE => fa HTTP_CONNECTION => Keep-Alive HTTP_COOKIE => phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22 autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22 userid%22%3Bs%3A1%3A%222%22%3B%7D; bblastvisit=1206256268; bblastactivity=0; PHPSESSID=5e17b7bde6a9d7782ff8781f2fdd173d HTTP_HOST => 127.0.0.1 HTTP_UA_CPU => x86 HTTP_USER_AGENT => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322) PATH => C:\Program Files\PC Connectivity Solution\;C:\Inprise\vbroker\bin;C:\Program Files\Borland\Delphi7\Bin;C:\Program Files\Borland\Delphi7\Projects\Bpl\;C:\WINDOWS\system32;C:\WINDOWS; C:\WINDOWS\System32\Wbem REMOTE_ADDR => 127.0.0.1 REMOTE_PORT => 2790 SCRIPT_FILENAME => c:/wamp/www/pathinfo1.php SERVER_ADDR => 127.0.0.1 SERVER_ADMIN => webmaster@localhost SERVER_NAME => 127.0.0.1 SERVER_PORT => 80 SERVER_SIGNATURE => Apache/1.3.33 Server at 127.0.0.1 Port 80 SERVER_SOFTWARE => Apache/1.3.33 (Win32) PHP/5.1.1 SystemRoot => C:\WINDOWS WINDIR => C:\WINDOWS GATEWAY_INTERFACE => CGI/1.1 SERVER_PROTOCOL => HTTP/1.1 REQUEST_METHOD => GET QUERY_STRING => REQUEST_URI => /pathinfo1.php SCRIPT_NAME => /pathinfo1.php PATH_TRANSLATED => c:/wamp/www/pathinfo1.php PHP_SELF => /pathinfo1.php REQUEST_TIME => 1206631035 argv => Array argc => 0
6 $ (�5$�WT�\���9 0.:��, P,�2 :
base64_decode() base64_encode()
6 $ (�5$�WT�\���9 0.:��, P,�2 ��] :
md5
+,��- C5� �$� $� ^�_�- :
imagestring � imagejpeg � imagedestroy
imagestring �B 0!� EF� ��$ �, C� C���4 �� ���1:$� 7 0!� �5� N$� �, �B ?��::
:آ�
imagestring ( resource $image, int $font, int $x, int $y, string $string, int $color )
www.RightClick.ir ���
imagejpeg �! � 0!� ���* �5 �:$�� ��$ �, �5�O- 7���3 �� 7 ��1:$� �- 0!� �5� PF� �, �, ?��::
:آ�
imagejpeg ( resource $image, string $filename , int $quality )
��$ �, �$ �� 7��3 �:� ���* �, �$ �� @$�� 7�B ?��3j �� $filename � CB �$�� quality �5�O- 0��B �� �B
0!�.
imagedestroy Y�� � � C5� �B 0!� �5�O- 03�! ����� C�3�! ��,�4 �� 7 �$ �8� 7T�3 ���...
:آ�
imagedestroy ( resource $image )
P5�' ���4�� � C� ���4��:
��5� (�K� ?���!� C� ���4�� ���, �9 �$8� :
:آ�
$FileName="myfile.txt"; header('Content-Type: text/x-delimtext; name="'. $FileName .'"'); header('Content-disposition: attachment; filename="'. $FileName .'"'); print('Salam');
� ��5� (�K� ?���!� P5�' ���4�� ���, �9 �$8�:
:آ�
$size = filesize($FilePath . $FileName) ; header("Content-Type: application/force-download; name=\"". $FileName ."\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: ". $size .""); header("Content-Disposition: attachment; filename=\"". $FileName ."\""); header("Expires: 0"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); echo (readfile($FilePath . $FileName));
N��AQ� �� �� 8�& U5�14 � �)��� C�3�! :
:آ�
<?php if(isset($_GET['Page'])) $Start = $_GET['Page']; else
www.RightClick.ir ���
$Start = 0; ShowData($Start); function ShowData($Base = 0) { $DbConn = mysql_connect("localhost", "root", "" ) or die(mysql_error()); mysql_select_db("test",$DbConn) or die("Can Not Select DataBase Because: ". mysql_error()); $sql = "SELECT * FROM `salam` LIMIT ". intval($Base) .", 10"; //Connect To DB... $ResultRs = mysql_query($sql) or die(mysql_error(). "<br />SQL: ". $sql); $TotalResults = mysql_num_rows($ResultRs); if($TotalResults <= 0) die("åí� ãæÑÏí íÇÝÊ äÔÏ"); $OutPut = ''; for($i = 0; $i != $TotalResults; $i++ ) { //<!-- Start of Print Results... $Textname = mysql_result($ResultRs, $i, 0); $Textjob = mysql_result($ResultRs, $i, 1); $Textadres= mysql_result($ResultRs, $i, 2); $Texttelphon= mysql_result($ResultRs, $i, 3); $OutPut .=($Textname ." - ". $Textjob ." - ".$Textadres." - ".$Texttelphon."<br /><br /><br /><br />"); } print($OutPut . "<p style='text-align:center'>" . ShowPageLinks($Base)); } function ShowPageLinks($Base) { $DbConn = mysql_connect("localhost", "root", "" ) or die(mysql_error()); mysql_select_db("test",$DbConn) or die("Can Not Select DataBase Because: ". mysql_error()); $SQL = "SELECT COUNT(*) FROM `salam`"; //Connect To DB... $ResultRs = mysql_query ($SQL) or die (mysql_error() ."<br />SQL: ". $SQL); $TotalResults = mysql_result($ResultRs,0); $TotalLinks = $TotalResults / 10; $TotalLinks = $TotalResults % 10 ? intval($TotalLinks) + 1 : intval($TotalLinks);
www.RightClick.ir ���
$ThisPage = intval($Base / 10); $ThisPage++; $page_nav_lnk = ''; if($TotalLinks > 1) { $page_nav_lnk .= 'Page Num: '; for($Index = 1 ; $Index <= $TotalLinks ; $Index++) { if($Index == $ThisPage) { $page_nav_lnk .= '<b>'. $Index .'</b> '; continue; } $BaseStart = ($Index - 1) * 10; $page_nav_lnk .= '<a href="?Page='. $BaseStart .'">'. $Index .'</a> '; } } return $page_nav_lnk; } ?>
�W5� 89 �4�14 (� C5����, �� �� 8�& �N��AQ� ���9 :
:آ�
<? $res = mysql_query("SELECT * from tbl_name WHERE id='fild name' "); $nnr=mysql_num_rows($res); $page=@$_GET['page']; if(!$page) $q = "SELECT * from tbl_name WHERE id='fild name' order by lid DESC limit 0,10"; else { $from=($page-1)*10; $q = "SELECT * from tbl_name WHERE id='fild name' order by lid DESC limit $from,10 "; } $result=mysql_query($q); $num=mysql_num_rows($result); ?> �Z>[ :<? $i=1; $tr=$nnr; $tp=$tr/10; $tp=$tp+1; while ($i<$tp) { print " [<a href=\"page.php?page=$i\"> $i </a>] "; $i++; } ?>
www.RightClick.ir ���
���-: 1- �7 � 5 �� C1)4� �� �� ��� � � YT�Z C��! 5 0www.RightClick.ir 0c!� ?8� ��'�: ...) �� 7�cS,
YT�Z C5� 05�! �58 �, ?�A� \ e!�- L��9 05�$ 05�! ����� 0!� ?8� ����4 ¤c �K.c- ��6c56� ¤ �1- �� �9 M
(�5�14(
4�5 ?8�� :/�) 7$8�K!� �
�51� P :[email protected]
$�� +1�� N��AQ� :�,�,�2� (!�275/4 7
�51� P: [email protected]
�!5 0: wWw.RightClick.Irrrr
�$��'5C ��! |���
�*5��