Sunday, January 31, 2010

Programming PHP & MySQL Integrating the Web Server and Database Server

Programming PHP & MySQL
Blending between Web Server and Database Server

At first PHP stands for Personal Home Page tools, a
tool (the tool) to monitor the visitors of a website. PHP was first developed by
Rasmus Lerdofr. The term PHP refers then more Prepocesor Hypertext.
PHP and then further developed to build web applications, support
database (ie MySQL / Oracle) and processing a variety of forms. To be able to run PHP
needed a system that has been configured properly. This system includes a web
server (ie Apache Web Server), tools (PHP) and database (MySQL). All three are
a form of open source that can run multi-platform (Windows or Linux / Unix).

1. Installing Apache Web Server, PHP and MySQL with XAMPP
You can use the program to install XAMPP PHP system. Programs
This has provided a PHP installation package that includes Apache Web Server, PHP
and MySQL. Run XAMPP 1.5.1 installation as follows.
When the process of setting up has been completed, will come the question of whether you will
install XAMPP server (Apache, MySQL and FileZilla) as a service. Click OK and
continue to complete the installation.
Continue the installation until the following display appears:
Open a browser (eg, Internet Explorer / Mozilla Firefox / Opera), the
type in the URL address of http://localhost/phpmyadmin/. If the display appears as
seen in the following figure, meaning the installation of PHP works.
You can select the language (language) on the right menu. Note that
phpMyAdmin has supported Indonesian, but you should still
using the English language option. Display phpMyAdmin also has 3
different kinds of display. Please select how you like the choice
menu Theme / Styles.

2. Creation Database
First, we will create a database, the database name shoutbox. After
open the browser and the display appears as shown above (http://localhost/phpMyAdmin/),
Create new database dikolom shoutbox type and click the create button. Will appear
view as follows.

In creating a database of more than one word, do not
use the sign "-" (dashes) or "" (space). You can use the sign "_" (line
below) to separate the two words.
A database can contain several tables that contain supporting information web,
such as student information, faculty, book, etc.. After creating database tables create
testimonials by typing in the Create new table on database shoutbox with
number of fields 7, and then click go. Fields is a constituent element of the database.
Field includes id, name, email, web, ip_client, date, comment. Enter
name of each field variable and its type and maximum length of characters.
- Type INT means that the field can only be filled in the numbers, while VARCHAR (variable
character) contains the characters / letters.
- Length / Values means the maximum number of characters that can be filled. On Null column,
Null means optional (may not optional).
- DateTime is the date format (year-month-date) and time (hours: minutes: seconds) that
serves to store data date & time.
- While not null means that the column must not be empty. Then the column
extra select auto_increment. Save the data that has been filled by clicking on the save
the bottom of the table or if you feel that the number of lines required field
less, you can add it again by filling in the number of columns in the Add ...
field (s) and click the Go button. The following table making the display results.

3. Creating Database Connection script
Database so that we have made can be connected to the web page, then
need to make a connection to the database. Open Dreamweaver select PHP applications on
Create New menu.
Here is a script to connect to the database.

4. Save PHP files
Next you need to save the file to a folder on the web
C: \ Program Files \ xampp \ htdocs \ shoutbox. Select the File menu or the à Save
keyboard shortcut keys Ctrl S.
If you have not created a folder shoutbox, ilahkan create a new folder in
C: \ Program Files \ xampp \ htdocs \ by clicking on the Create New Folder icon. Give name
folder shoutbox. Please go to the folder by double
click (mouse) or press the ENTER key (keyboard) on the folder icons shoutbox.
Then on the field File name: config.php file type, press Save.

5. Test Connection
Please open the browser and the browser address bar type localhost / shoutbox,
press ENTER. Display will look as follows. Click on the config.php file.
How do the results look? Does look like the following picture?
If yes, then you have not succeeded in making the connection. Please go back and check.
If the display is empty / blank, it indicates that you have successfully made
connection file. Good for you J that have been successfully

6. Create a form Shoutbox - shoutbox.php
Create a new file by choosing File menu à New (Ctrl N).
Select the General tab page à à Dynamic PHP. Click the Create button.

Here is the form Shoutbox. Here we use the POST method of sending
and action for the purpose of delivery to file input_shoutbox.php. Save the following file
shoutbox.php name.

7. Input Data Shoutbox - input_shoutbox.php
Furthermore, when the form data submitted to the shoutbox input_shoutbox.php, will
there is a process to a table of storing data in the database shoutbox testimonials. Here
is the script of input_shoutbox.php.
When the process of running data storage, will be checking whether the process
storage succeed or not. If successful, then the process will be continued next
to show_shoutbox.php. If the storage process fails, then the process
will return to shoutbox.php.

8. See Data Shoutbox - show_shoutbox.php
Data is sorted by last id (... order by id desc ...),
so that the final data will be displayed at the top position. Data will
shown also limited by the maximum number of 10 data (... limit of 0.10). Data will
taken per line by using the command while.
Here is a script to display the data in the table testimonial.

9. Creating Form Login to Admin
Well, of course, we need to control the comments coming. Sometimes
these comments we need to remove from the database because it uses the language / wording
is not allowed.
Therefore, the next step is to create a login page for
administrators, so that he can control the pesan-pesan/komentar-komentar
entered. First, we created first login to admin with the name of the file
login.php as follows.
For input type password, type filled with "password" so that what we type
will not be visible. The method used is POST and the action to
to file admin_login.php.

10. Creating Function Check Status Login
This function is used to check the status of admin login. Login status
stored in a SESSION. SESSION is a reminder of a temporary memory
in a web server. Actually, the login status can also be stored in the memory
reminders while residing in the client computer called COOKIES. Here
basic functions for checking a simple admin login is stored
function.php name.

Next we need a function call in () and function SAFE ()
to be able to check the user to log files stored in
admin_login.php.

11. Make a Page View shoutbox to Admin
Here are admin_shoutbox.php file to view data in the table testimonial.

12. Files to delete data - del_shoutbox.php
Here del_shoutbox.php files to delete the data in the table testimonial.
12. Exit from the Admin - logout.php
Here logout.php file to get out of admin pages.

APPENDIX
à TESTING WEB
1. Process à posting testimonials
Page shoutbox, file
shoutbox.php. If data
empty or writing email
wrong, then the data
submitted will not be
saved to the database.
If the data successfully
saved to the database, then
The next will be displayed
See pages shoutbox, file
show_shoutbox.php. Here
is the data view
successfully saved to the
database.

2. à Process Admin Login
Shoutbox admin login page, the file login.php. Please fill in your username and
passwords that have been determined to be able to log into the admin page
shoutbox.
If you have successfully logged in, then you will go to see the page data section
admin, here you can see all the data your testimonial. If if there is data
considered less willing to display, then you can click on the button
delete an existing comment under each data comments.
Please try deleting one of the data. See what happens. Data should
will disappear from view. In this program we created, no message
warning in case of success or the failure to process. To
displays the message, we can add it to the program with
COOKIES assistance, so our web applications will become more interactive.
We will add the messages stored by this method in COOKIES
del_shoutbox.php and admin_shoutbox.php files.

Here is the data view that has not been erased.
Here is the view that the data has been erased, but no message
warning stating that the data has been erased.

Furthermore, if you log out, then we will see the login page again.
Check it by typing the address admin_shoutbox.php to get to a page
admin control. Look at that address in the addressbar will always move into
login.php when we press ENTER.
Here is a modification file del_shoutbox.php and admin_shoutbox.php.

No comments:

Post a Comment

semarang jawa tengah indonesia service keyboard service computer komputer kendal bali setting hotspot hacking password mysql protected username jasa setting jual beli
bobol password phpmyadmin debian 5 lenny ubuntu server surabaya sumatera american inggris access point microtic MikroTik jawa barat yamaha roland casio korg technic floppy disk emulator usb www universal cara ganti broadcast editing wireless Wi-Fi handphone novel health facebook Sepeda Fixie Jual Beli Sepeda Fixie Rose Network Sepeda Fixie Murah Wimax Wimax Indonesia, Long time waktu lorong waktu facebook twitter

Followers