13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

410 Chapter 18 Implementing Secure Transactions with <strong>PHP</strong> <strong>and</strong> <strong>MySQL</strong><br />

User’s<br />

Browser<br />

Internet<br />

<strong>Web</strong><br />

Server<br />

<strong>PHP</strong><br />

Engine<br />

<strong>MySQL</strong><br />

Engine<br />

Stored<br />

Pages &<br />

Scripts<br />

Data<br />

Files<br />

<strong>MySQL</strong><br />

Data<br />

Figure 18.1<br />

User information is stored or processed by these elements of a<br />

typical web application environment.<br />

The details of each transaction occurring in your system will vary, depending both on<br />

your system design <strong>and</strong> on the user data <strong>and</strong> actions that triggered the transaction.You<br />

can examine all of them in a similar way. Each transaction between a web application<br />

<strong>and</strong> a user begins with the user’s browser sending a request through the Internet to the<br />

web server. If the page is a <strong>PHP</strong> script, the web server will delegate processing of the<br />

page to the <strong>PHP</strong> engine.<br />

The <strong>PHP</strong> script might read or write data to disk. It might also use the include() or<br />

require() constructs to include other <strong>PHP</strong> or HTML files. It also sends SQL queries to<br />

the <strong>MySQL</strong> daemon <strong>and</strong> receives responses.The <strong>MySQL</strong> engine is responsible for reading<br />

<strong>and</strong> writing its own data on disk.<br />

This system has three main parts:<br />

n The user’s machine<br />

n The Internet<br />

n Your system<br />

The following sections describe security considerations for each separately, but obviously<br />

the user’s machine <strong>and</strong> the Internet are largely out of your control.<br />

The User’s Machine<br />

From your point of view, the user’s machine is running a web browser.You have no control<br />

over other factors such as how securely the machine is set up.You need to bear in<br />

mind that the machine might be very insecure or even a shared terminal at a library,<br />

school, or café.<br />

Many different browsers are available, each having slightly different capabilities. If you<br />

consider only recent versions of the most popular two browsers, most of the differences<br />

between them affect only how HTML will be rendered <strong>and</strong> displayed, but you also need<br />

to consider security or functionality issues.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!