Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Types and causes weakness of the Website

Posted by NanoTutor | Monday, March 02, 2009 | | 0 comments »

Source : Syafii, M,. 2004. Panduan Membuat Aplikasi Database Dengan PHP5 Postgre-MySQL-Oracle.Penerbit Andi. Yogyakarta.

Deface
You may have often heard or saw a site that has content not suitable. Obvious example is a site-education institutions (ac.id) to the index page of the official website of the picture or logo has been changed. Incident, in the world of hacking, called deface. Deface is an attack technique with the image or change the content of the website for a particular purpose. In fact, there are many factors that cause all of that. According to the analysis of the author, these factors are:

1. Operating system
If you intend to buy the domain and hosting, make sure that the operating system is safe and reliable in use, such as for example a Unix operating system variants. Please note that almost all of the hosting center are using Redhat Linux.
2. Programming Error
Low awareness of the website you are easily exposed to deface. For example, the error in using the user management in MySQL, but the data show that the user is able to perform SQL delete, insert or drop. This is the common mistakes that seemed as a habit that can not be abandoned. If you compile a program that uses a web-based MySQL database then you should have a user that is able to select the command, if you are only a web show in the MySQL database server to the web. You can create new users that are only able to insert or delete command. Deface technique done with the action called SQL Injection.

Password Theft
Another thing is to be considered when creating web pages that have a user authentication system. You must create a program may be safe to include encryption. No password or data encryption so people can easily tap (Sniff) your data. Thus, the use of encryption is also very necessary.
Creating confusion in the Directory
Avoid making the directory easy to order and the name is known by other people. For example, almost all websites have a folder called images, include, or other similar folders. This of course should be anticipated so that if users try to access the way, we already have a preventive action.

Error in File Include

When you read a lot about PHP3 tutorial or an older version then to insert a file in the PHP file is to provide the Include ( "db.inc"). In fact, if the *. inc files are called directly from the browser the contents of the file will be displayed. This means that someone can see the contents of your original file. If you just paste the file does not contain the usual problems. However, if you paste the configuration file contains a database then this will be dangerous.
Permissions for the folder contents
Keep other people can not easily find out each folder that you created in the order in the structure of the website. People can do it directly by typing the name of the folder. For example, if someone typing directly in the addres bar:

http://localhost/happy-holidays/images/



you can prevent problem like this by changing the configuration for httpd.conf in the folder under Apache, with the command to change or delete Options Indexes MultiViews tags below Directory. Another way that is easier to add in the index.php file in every folder that does not have the file index.php. So if someone tries to access directly the contents of a folder in the web then index.php file will be automatically executed, and the contents of the folder we will not appear as the image above.


Read more...

Variable in PHP

Posted by NanoTutor | Wednesday, February 25, 2009 | | 0 comments »

PHP recognize the existence of variables and operators, as other programming languages. Required to declare the variable and the value of a. The operator is required to perform mathematical calculations, giving values to variables in a particular, and to compare the value of two variables.

What are the variables?
Variables used to store data temporarily and the value can change each time the program is run. Data stored in the variable will be lost after the program finished executable.

PHP Variable and Value Types
PHP variables start with 'Variable name can be a combination of alphabet letters, numbers with a maximum length of 32 characters. Variable names are case-sensitive. Variable name can only be beginning with the letter or underscore, then the characters can be letters, numbers, and underscores. To be able to use variables, need to be two things:

Declaration

Declaration of variables is introduced to the program. In writing the PHP script, often combined with a declaration initialization. Example:

$ value, $ day.

Initialisation
Variable initialization is to provide a value for the first time to a variable. Example: Value = $ 50, $ = NamaHari Monday.

PHP variables have some type of value that is:

Integer (Numbers rounded)
The integer can be written in the form of:
Decimal number, for example: $ a = 1234;
Negative decimal number, for example: $ a = -123;
Hexadecimal number, for example: $ a = 0x1A with the same number of decimal 26;
Octal numbers, for example: $ a = 0123; with the same number of decimal 83
Floating Point
Floating Point Numbers can be declared using the following syntax:
$ a = 1234;
$ b = 1.2e3;
A maximum value of the Floating Point ~ 1.8e308 is reached with the accuracy 14 decimal digits.
String
Syntax string variables can be written in 3 ways, namely: Using single quotes ( ') example:
$ str = 'Hello Nano';
Using double quotes ( ") example:
$ str = "Hallo";
Using sign heredoc (<<<)


Read more...

About HTML

Posted by NanoTutor | Tuesday, February 24, 2009 | | 1 comments »

Introduction to HTML

HTML (hypertext markup language) is a language that uses a simple command in the standard ASCII text document to provide a visual display that is integrated. HTML consists of simple commands that describe how the structure of the document, but does not do formatting. The browser will display the HTML formatting and display HTML, so adjust according to the visitor's computer screen.

HTML tag using the form <...> that a web browser how to display page elements such as text or graphics. HTML code is located between the container tags with <..tag_name> beginning and end with <..> with '/'.

HTML tags have three main units, the HTML, HEAD and BODY. HTML tags represent a function of the HTML document, tags HEAD function provides information about the document, and determine how the BODY tag contents of a document displayed by the browser.

HTML example script:
Views in the Browser:
In the BODY tag you can write a script to set the HTML view as a background color, font size, font type, font color, links to other documents, add images and so forth.
If the script with the HTML course we can create a web page that is good, and why you need to add a PHP script? PHP create HTML web pages to be dynamic. HTML combined with the PHP script will generate a dynamic web views, beautiful, and interactive. PHP and HTML will be mutual cooperation. PHP can generate HTML, and HTML can forward the information to PHP.


Read more...