Download presentation
Presentation is loading. Please wait.
Published byTiffany Dolan Modified over 9 years ago
1
Housing and Dining Online by Andrew Gorges
2
Outline Overview of PHP Overview of MySQL Using PHP Using MySQL PHP and MySQL together Production Application Role of Verisign
3
PHP Overview Easy learning curve Syntax very similar to C Large function library Embedded directly into HTML Interpreted, no need to compile Platform Independent Web Server Independent Free and Open Source
4
Simple PHP PHP code must be surrounded with special tags Opening tag: Opening tag: Write text to the browser with the echo command To write Hello, World! to the broswer, include the following in hello.php Hello, World ”; ?>
5
PHP Form Data Access to the HTTP POST and GET data is simple in PHP The global variables $_POST[] and $_GET[] contain the request data <?php if ($_POST["submit"]) if ($_POST["submit"]) echo " You clicked Submit! "; echo " You clicked Submit! "; else if ($_POST["cancel"]) else if ($_POST["cancel"]) echo " You clicked Cancel! "; echo " You clicked Cancel! ";?> </form>
6
PHP Sessions Sessions store their identifier in a cookie in the client’s browser Every page that uses session data must be proceeded by the session_start() function Session variables are then set and retrieved by accessing the global $_SESSION[] <?php session_start(); session_start(); if (!$_SESSION["count"]) if (!$_SESSION["count"]) $_SESSION["count"] = 0; $_SESSION["count"] = 0; if ($_GET["count"] == "yes") if ($_GET["count"] == "yes") $_SESSION["count"] = $_SESSION["count"] + 1; $_SESSION["count"] = $_SESSION["count"] + 1; echo " ".$_SESSION["count"]." "; echo " ".$_SESSION["count"]." ";?> Click here to count Click here to count
7
MySQL Overview Fast, free, stable database Syntax is similar to Oracle Many of the same features as Oracle Production version still missing subqueries, stored procedures, and triggers Frequently used in conjunction with Linux, Apache, and PHP
8
Creating a Table Making a new table is rather easy in MySQL CREATE TABLE books ( idNumber int primary key auto_increment, title varchar(30), author varchar(30) );
9
Inserting Data The insert statement is straightforward INSERT INTO books (title,author) VALUES( “Let Freedom Ring”, “Sean Hannity” );
10
Other Operations ALTER TABLE books ADD COLUMN subtitle varchar(50) AFTER title; UPDATE books SET subtitle=“Winning the War of Liberty over Liberalism” WHERE idNumber=1; SELECT * FROM books; DELETE FROM books;
11
MySQL and PHP Together <?php include("/var/db.php"); include("/var/db.php"); $dbLink = mysql_connect("localhost", $dbUser, $dbPass); $dbLink = mysql_connect("localhost", $dbUser, $dbPass); $sql = "SELECT * FROM books"; $sql = "SELECT * FROM books"; $res = mysql_db_query("test", $sql, $dbLink); $res = mysql_db_query("test", $sql, $dbLink); $row = mysql_fetch_assoc($res); $row = mysql_fetch_assoc($res); $title = $row["title"]; $title = $row["title"]; $subtitle = $row["subtitle"]; $subtitle = $row["subtitle"]; $author = $row["author"]; $author = $row["author"];?> Title Sub Title Author Title Sub Title Author $title $subtitle $author ";?> $title $subtitle $author ";?></tr></table>
12
Production Application Early Room Preference System Online Heavy use of MySQL database for room maps Uses Verisign’s PayFlowPro™ All information passes over Secure Socket Layer
13
System Architecture MySQL PHP Verisign PayFlowPro Web Browser
14
Role of Verisign Provide the Secure Server Certificate Provide PayFlow Pro™ Interface $transaction = array( 'USER' => 'ksuhousing', 'PWD' => ‘*********', 'PARTNER' => 'VeriSign', 'TRXTYPE' => 'S', 'TENDER' => 'C', 'AMT' => 25.00, 'ACCT' => $number, 'EXPDATE' => $expDate, 'COMMENT1' => 'App Payment', 'COMMENT1' => 'App Payment', 'STREET' => stripslashes($address), 'ZIP' => $zip ); //execute the transaction $response = pfpro_process($transaction);
15
Links http://www.php.net http://www.mysql.com http://www.verisign.com
16
Questions?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.