<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:series="http://unfoldingneurons.com/"
><channel><title>Larry Ullman &#187; MySQL</title> <atom:link href="http://www.larryullman.com/category/mysql/feed/" rel="self" type="application/rss+xml" /><link>http://www.larryullman.com</link> <description>Translating Geek Into English</description> <lastBuildDate>Mon, 21 May 2012 11:03:07 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Yii and Me (aka, the Yii Book)</title><link>http://www.larryullman.com/2012/04/23/yii-and-me-aka-the-yii-book/</link> <comments>http://www.larryullman.com/2012/04/23/yii-and-me-aka-the-yii-book/#comments</comments> <pubDate>Mon, 23 Apr 2012 11:18:49 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[book]]></category> <category><![CDATA[yii]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3187</guid> <description><![CDATA[Thanks largely to the success of my Learning the Yii Framework series, people are often asking me about my plans to write a book on Yii. Writing a book on Yii is something that I&#8217;ve been meaning to do for some time, but have been way too busy for the past couple of years to [...]]]></description> <content:encoded><![CDATA[<p>Thanks largely to the success of my <a
href="http://www.larryullman.com/series/learning-the-yii-framework/">Learning the Yii Framework</a> series, people are often asking me about my plans to write a book on <a
href="http://www.yiiframework.com">Yii</a>. Writing a book on Yii is something that I&#8217;ve been meaning to do for some time, but have been way too busy for the past couple of years to make it happen. Every so often I post something about the phantom Yii book, and so here&#8217;s another. This time, it&#8217;s pretty good news&#8230;</p><p>As for my schedule, I&#8217;m now writing the third edition of my &#8220;<a
href="http://www.larryullman.com/2012/04/09/php-5-advanced-visual-quickpro-guide-3rd-edition-table-of-contents/">PHP 5 Advanced: Visual QuickPro Guide</a>&#8221; book. That project will take the next couple of months, through June. I&#8217;m hoping it will be entirely done (rewrites and all) in early July. I think I&#8217;ll have a decent-sized Web project to do in the fall, but other than that, I have no deadlines and obligations for the latter half of 2012. Little things will no doubt come along, but this kind of free time is unusual for me. (And, strangely, isn&#8217;t frightening at the moment, although free time come January could be a problem!) So, reasonably speaking, I will be able to work on the Yii book full time as of August 2012. This should coincide nicely with the hopeful release of Yii 2.0 over the summer. Speaking of which&#8230;</p><p>I&#8217;ve been chatting with Qiang Xue, the creator of Yii, and he has graciously offered to act as the personal tech editor for the book. This is a great honor to me, and will be a wonderful asset in making sure the book is as technically accurate as possible. In return, I&#8217;m going to help with some of the official Yii documentation (it&#8217;s the least I can do). And the good news keeps rolling in, as <a
href="http://rmcreative.ru/">Alex Makarov</a>, author of the popular <a
href="http://yiicookbook.org/">Yii 1.1 Application Development Cookbook</a> (Packt Publishing), has generously offered his assistance, too. These are invaluable pieces that are coming together nicely here.</p><p>In terms of publishing, my current plan is&#8230;</p><ul><li>To self-publish an ebook only. I will release it in mobi, epub, and PDF formats, without any annoying Digital Rights Management (DRM).</li><li>Possibly no DRM.</li><li>Probably no DRM.</li><li>The price would be about $15 (USD).</li><li>People would be able to buy the book in advance, and get each chapter as I write it. Revised chapters would be free updates.</li><li>People would be able to buy just a single chapter and get revisions of that chapter as free updates.</li></ul><p>I&#8217;m assuming that I&#8217;ll create a separate Web site for the book, as I&#8217;m also planning on making some of the book&#8217;s content freely available in HTML format. This does mean that along with writing the book, I&#8217;ll have to create the Web site and the above functionality, but such are the costs of doing things yourself. And I happen to know of a framework that makes Web development a lot faster&#8230;</p><p>I&#8217;ll continue posting updates here and on <a
href="http://www.twitter.com">Twitter</a> (by the way, I&#8217;m on Twitter <a
href="https://twitter.com/#!/LarryUllman">@LarryUllman</a>) as I have them. Yii postings may be sporadic for the next couple of months as I focus on the PHP Advanced book, but rest assured the Yii book is happening.</p><p>All thoughts, feedback, input, and offers of money are most welcome!</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/04/23/yii-and-me-aka-the-yii-book/feed/</wfw:commentRss> <slash:comments>40</slash:comments> </item> <item><title>Properly Salting Passwords, The Case Against Pepper</title><link>http://www.larryullman.com/2012/04/20/properly-salting-passwords-the-case-against-pepper/</link> <comments>http://www.larryullman.com/2012/04/20/properly-salting-passwords-the-case-against-pepper/#comments</comments> <pubDate>Fri, 20 Apr 2012 11:36:26 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3185</guid> <description><![CDATA[Anthony Ferrara, creator of the PHP PasswordLib library, just recently posted a discussion of using salts and pepper to improve the security of a stored password. Mostly, the article is a discussion of why a pepper is unnecessary (and if you don&#8217;t know what a &#8220;pepper&#8221; is, just read the article), but the posting also does [...]]]></description> <content:encoded><![CDATA[<p>Anthony Ferrara, creator of the PHP <a
href="https://github.com/ircmaxell/PHP-PasswordLib">PasswordLib</a> library, just recently <a
href="http://blog.ircmaxell.com/2012/04/properly-salting-passwords-case-against.html">posted a discussion of using salts and pepper</a> to improve the security of a stored password. Mostly, the article is a discussion of why a pepper is unnecessary (and if you don&#8217;t know what a &#8220;pepper&#8221; is, just read the article), but the posting also does a good job of explaining the purpose of a salt, and why the salt does not need to be a secret. The posting is relatively short, and is something I think everyone can benefit from reading.</p><p>The posting ends with the most important security fact:</p><blockquote><p>Remember, the most dangerous kind of security is a false sense of it. Thinking you&#8217;ve made your application more secure, when in fact you&#8217;ve weakened it, is the worst thing you could possibly do.</p></blockquote> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/04/20/properly-salting-passwords-the-case-against-pepper/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>&#8220;PHP 5 Advanced: Visual QuickPro Guide (3rd Edition&#8221; Table of Contents</title><link>http://www.larryullman.com/2012/04/09/php-5-advanced-visual-quickpro-guide-3rd-edition-table-of-contents/</link> <comments>http://www.larryullman.com/2012/04/09/php-5-advanced-visual-quickpro-guide-3rd-edition-table-of-contents/#comments</comments> <pubDate>Mon, 09 Apr 2012 11:01:26 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[oop]]></category> <category><![CDATA[phpvqp3]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3168</guid> <description><![CDATA[I&#8217;m just about to begin writing the third edition of my &#8220;&#8221;. This new edition is tentatively titled &#8220;Advanced PHP and Object-Oriented Programming: Visual QuickPro Guide&#8221;, which better reflects the book&#8217;s focus. The book is written for intermediate PHP and Web developers, and covers a range of topics to further extend what you know into more [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;m just about to begin writing the third edition of my &#8220;<a
href="http://www.larryullman.com/books/php-5-advanced-visual-quickpro-guide-2nd-edition/">PHP 5 Advanced: Visual QuickPro Guide</a>&#8220;. This new edition is tentatively titled &#8220;Advanced PHP and Object-Oriented Programming: Visual QuickPro Guide&#8221;, which better reflects the book&#8217;s focus. The book is written for intermediate PHP and Web developers, and covers a range of topics to further extend what you know into more real-world, complex situations.<span
id="more-3168"></span></p><p>The previous edition had 14 chapters, plus two that were made available as free PDFs (one on image generation, the other on PDF generation). The current plan for this edition is to cut four chapters, add four entirely new chapters, and the add and remove some chapter sections here and there. The book will also have a &#8220;Review and Pursue&#8221; section at the end of each chapter, with review questions and pursue prompts.</p><p>My goals for this edition of the book were (in no particular order):</p><ul><li>Emphasize and expand the OOP sections</li><li>Add more content geared towards creating larger, more elaborate, professional Web applications</li><li>Add new content based upon changes in technologies since the last edition (specifically changes in PHP from version 5.2 to 5.4)</li><li>Update outdated content (including replacing old approaches with entirely new ones)</li><li>Removing no longer critical content</li><li>Removing content now discussed in other books of mine</li></ul><p>For example, new PHP features that will be covered include <a
href="http://php.net/manual/en/language.oop5.typehinting.php">type hinting</a>, the <a
href="http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.nowdoc">Nowdoc</a> syntax, and <a
href="http://www.php.net/manual/en/language.oop5.traits.php">traits</a>. New Web application information include discussions of Apache&#8217;s mod_rewrite and <a
href="http://www.phpdoc.org/">phpDocumentor</a>, and a chapter on debugging tools, unit testing, and improving performance. The expanded OOP material includes a chapter on design patterns and a new chapter that creates a whole example using OOP.</p><p>With all that in mind, the initial Table of Contents is posted below. New content is in <span
style="color: #339966;">green</span>. Chapters I&#8217;ve cut (not reflected below) include one on security techniques (now well covered by my other books), another on e-commerce (I&#8217;ve since written a<a
href="http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/">whole book</a> on that), the PEAR chapter (replaced by one on the <a
href="http://framework.zend.com">Zend Framework</a>), and the Ajax chapter (well covered in many of my other books).</p><p>If you have any thoughts or suggestions, I&#8217;d love to hear them. Thanks!</p><ul><li>Chapter 1: Advanced PHP Techniques<ul><li>Multidimensional Arrays</li><li>Advanced Function Definitions</li><li><span
style="color: #339966;">Type Hinting</span></li><li><span
style="color: #339966;">Anonymous Functions</span></li><li>The Heredoc and <span
style="color: #339966;">Nowdoc</span> Syntax</li><li>Using printf() and sprintf()</li></ul></li><li>Chapter 2: Developing Web Applications<ul><li>Modularizing a Web Site</li><li><span
style="color: #339966;">Improved SEO with mod_rewrite</span></li><li>Affecting the Browser Cache</li><li><span
style="color: #339966;">Better Documentation with phpDocumentor</span></li></ul></li><li>Chapter 3: Advanced Database Concepts<ul><li>Storing Sessions in a Database</li><li>Working with U.S. Zip Codes</li><li>Creating Stored Functions</li><li>Displaying Results Horizontally</li><li><span
style="color: #339966;">Storing Binary Data</span></li><li><span
style="color: #339966;">Using PDO</span></li></ul></li><li><span
style="color: #339966;">Chapter 4: Debugging, Testing, and Performance</span><ul><li><span
style="color: #339966;">Debugging Tools</span></li><li><span
style="color: #339966;">Unit Testing</span></li><li><span
style="color: #339966;">Profiling Scripts</span></li><li><span
style="color: #339966;">Improving Performance</span></li><li><span
style="color: #339966;">Implementing Server Caches</span></li></ul></li><li>Chapter 5: Basic Object-Oriented Programming<ul><li>OOP Theory</li><li>Defining a Class</li><li>Creating an Object</li><li>The $this Attribute</li><li>Creating Constructors</li><li>Creating Destructors</li><li>Autoloading Classes</li></ul></li><li>Chapter 6: Advanced OOP<ul><li>Advanced Theories</li><li>Inheriting Classes</li><li>Inheriting Constructors and Destructors</li><li>Overriding Methods</li><li>Access Control</li><li>Using the Scope Resolution Operator</li><li>Creating Static Members</li><li>Abstract Classes and Methods</li><li><span
style="color: #339966;">Creating Namespaces</span></li><li><span
style="color: #339966;">Using Traits</span></li></ul></li><li><span
style="color: #339966;">Chapter 7: Design Patterns</span><ul><li><span
style="color: #339966;">What are Design Patterns?</span></li><li><span
style="color: #339966;">[[Discussion of Specific Patterns TBD]]</span></li></ul></li><li>Chapter 8: Real-World OOP<ul><li>Catching Exceptions</li><li>Extending the Exception Class</li><li><span
style="color: #339966;">Implementing MVC</span></li><li><span
style="color: #339966;">Using the Standard PHP Library</span></li><li><span
style="color: #339966;">OOP-based E-commerce</span></li></ul></li><li><span
style="color: #339966;">Chapter 9: Example&#8211;CMS with OOP</span></li><li>Chapter 10: Networking with PHP<ul><li>Accessing Other Web Sites</li><li>Working with Sockets</li><li>Performing IP Geolocation</li><li>Using cURL</li><li><span
style="color: #339966;">Creating Web Services</span></li></ul></li><li>Chapter 11: PHP and the Server<ul><li>Compressing Files</li><li>Establishing a cron</li><li>Scheduling Tasks on Windows</li><li><span
style="color: #339966;">Using PHP’s Built-In Server</span></li></ul></li><li>Chapter 12: PHP’s Command-Line Interface<ul><li>Testing Your Installation</li><li>Executing Bits of Code</li><li>Creating a Command-Line Script</li><li>Running a Command-Line Script</li><li>Working with Command-Line Arguments</li><li>Taking Input</li></ul></li><li>Chapter 13: XML and PHP<ul><li>What Is XML?</li><li>XML Syntax</li><li>Attributes, Empty Elements, and Entities</li><li>Document Type Definitions</li><li>Parsing XML</li><li>Creating an RSS Feed</li><li><span
style="color: #339966;">XML Error Handling</span></li></ul></li><li><span
style="color: #339966;">Chapter 14: Using the Zend Framework</span><ul><li><span
style="color: #339966;">Installation</span></li><li><span
style="color: #339966;">Creating and Validating Forms</span></li><li><span
style="color: #339966;">Adding Captcha</span></li><li><span
style="color: #339966;">Implementing Authentication</span></li><li><span
style="color: #339966;">Using Zend_Mail</span></li></ul></li></ul> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/04/09/php-5-advanced-visual-quickpro-guide-3rd-edition-table-of-contents/feed/</wfw:commentRss> <slash:comments>28</slash:comments> </item> <item><title>Under the Hood of Yii&#8217;s Component Architecture</title><link>http://www.larryullman.com/2012/03/16/under-the-hood-of-yiis-component-architecture/</link> <comments>http://www.larryullman.com/2012/03/16/under-the-hood-of-yiis-component-architecture/#comments</comments> <pubDate>Fri, 16 Mar 2012 14:13:51 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[mvc]]></category> <category><![CDATA[yii]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3055</guid> <description><![CDATA[If you haven&#8217;t yet seen it, Steven O&#8217;Brien wrote an in-depth series of articles on the Yii framework&#8217;s component architecture, posted at phpmaster. In the series, O&#8217;Brien looks at the CComponent base class in detail. Every class in Yii is an extension of CComponent, so understanding what it brings to the table can be quite [...]]]></description> <content:encoded><![CDATA[<p>If you haven&#8217;t yet seen it, <a
href="http://steve-obrien.com/">Steven O&#8217;Brien</a> wrote an in-depth series of articles on the Yii framework&#8217;s component architecture, posted at <a
href="http://phpmaster.com">phpmaster</a>. In the series, O&#8217;Brien looks at the <a
href="http://www.yiiframework.com/doc/api/1.1/CComponent">CComponent</a> base class in detail. Every class in Yii is an extension of <strong>CComponent</strong>, so understanding what it brings to the table can be quite useful to the Yii developer. <a
href="http://phpmaster.com/yii-under-the-hood-1/">Part 1</a> looks at the classes key properties and methods. <a
href="http://phpmaster.com/yii-under-the-hood-2/">Part 2</a> discusses events. And <a
href="http://phpmaster.com/under-the-hood-of-yii’s-component-architecture-part-3/">part 3</a> explains the behaviors. If you&#8217;re using Yii, it&#8217;s worth reading these to better understand what&#8217;s going on at the fundamental level.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/03/16/under-the-hood-of-yiis-component-architecture/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Using PayPal&#8217;s WebSite Payments Pro with &#8220;Effortless E-Commerce with PHP and MySQL&#8221;</title><link>http://www.larryullman.com/2012/03/07/using-paypals-website-payments-pro-with-effortless-e-commerce-with-php-and-mysql/</link> <comments>http://www.larryullman.com/2012/03/07/using-paypals-website-payments-pro-with-effortless-e-commerce-with-php-and-mysql/#comments</comments> <pubDate>Wed, 07 Mar 2012 15:25:15 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[e-commerce]]></category> <category><![CDATA[ecom]]></category> <category><![CDATA[paypal]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3132</guid> <description><![CDATA[In Part 3 of my &#8220;&#8221; book, I use Authorize.net to process payments for a site that sells physical goods. Authorize.net accepts credit cards and can be directly integrated into your site, so that the customer never leaves (unlike, for example, PayPal&#8217;s Website Payments Standard, used in Part 2 of the book, which goes through [...]]]></description> <content:encoded><![CDATA[<p>In Part 3 of my &#8220;<a
href="http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/">Effortless E-Commerce with PHP and MySQL</a>&#8221; book, I use <a
href="http://www.authorize.net/">Authorize.net</a> to process payments for a site that sells physical goods. Authorize.net accepts credit cards and can be directly integrated into your site, so that the customer never leaves (unlike, for example, PayPal&#8217;s Website Payments Standard, used in Part 2 of the book, which goes through PayPal&#8217;s site). The code in the book was written in a very modular style, with the intent that you can use the components you need, and swap others in and out. A reader specifically wanted to know how you would use PayPal&#8217;s Website Payments Pro instead of Authorize.net, and that&#8217;s what I&#8217;ll explain here.<span
id="more-3132"></span></p><p>PayPal&#8217;s Website Payments Pro provides two APIs for processing payments: <em>Direct Payment</em> and <em>Express Checkout</em>. Both allow you to accept debit and credit cards (the specific cards will differ slightly from one region to the next), while Express Checkout also allows users to pay with their PayPal account. In both cases, the customer never leaves your site, unlike when using PayPal&#8217;s Website Payments Standard. PayPal does require you to use both APIs in order to use Website Payments Pro. To keep this post from getting too long, I&#8217;ll only address the Direct Payment, which most easily correlates to the Authorize.net code in the book. If you need help with the Express Checkout aspect, let me know.</p><p>To understand how to use Website Payments Pro instead of Authorize.net for the second example, let&#8217;s first look at how Authorize.net is used. The customer begins the checkout process on <strong>checkout.php</strong>. This script takes and validates the user&#8217;s shipping information. Upon successful validation, the user is redirected to <strong>billing.php</strong>, which takes and validates the billing information, including the credit card. Upon successful validation, the payment is processed by including two scripts: <strong>gateway_setup.php</strong> and <strong>gateway_process.php</strong>. For extra security, these two files are stored in a private folder outside of the Web root directory.</p><p>Within<strong> gateway_setup.php</strong>, a bunch of parameters are set within an array named <strong>$data</strong>:</p><pre class="brush: php; title: ; notranslate">&lt;?php
$data = array();
$data['x_type'] = 'AUTH_ONLY';
$data['x_card_num'] = $cc_number;
$data['x_exp_date'] = $cc_exp;
// etc. </pre><p>Then the <strong>gateway_process.php</strong> script adds some more details to the array:</p><pre class="brush: php; title: ; notranslate">// Your account info:
$data['x_login'] = '75sqQ96qHEP8';
$data['x_tran_key'] = '7r83Sb4HUd58Tz5p';
// etc. </pre><p>Finally, <strong>gateway_process.php</strong> converts that data into a useable format for the <a
href="http://curl.haxx.se/">cURL</a> request, performs the cURL request, and reads the response into the <strong>$response</strong> variable. Finally, this variable is converted into an array:</p><pre class="brush: php; title: ; notranslate">$response_array = explode($data[&quot;x_delim_char&quot;],$response);</pre><p>That&#8217;s the end of the <strong>gateway_process.php</strong> script. The script that invokes it—<strong>billing.php—</strong>will then use <strong>$response_array</strong> to take the next logical steps.</p><p>In order to switch the payment gateway in use, you must replace the code in <strong>gateway_setup.php</strong> and <strong>gateway_process.php</strong>. This is much easier than you might think. For PayPal&#8217;s Website Payments Pro, you&#8217;ll need to change the code in those two files so that instead of creating, for example, <strong>$data['x_card_num']</strong>, it creates <strong>$data['ACCT']</strong>. The proper values and their meanings can be found in the <a
href="https://www.x.com/developers/paypal/documentation-tools/api/dodirectpayment-api-operation-nvp">PayPal documentation</a>.  This means that <strong>gateway_setup.php</strong> would contain:</p><pre class="brush: php; title: ; notranslate">&lt;?php
$data['PAYMENTACTION'] = 'Authorization';

// Billing info:
$data['ACCT'] = $cc_number;
$data['EXPDATE'] = $cc_exp;
$data['CREDITCARDTYPE'] = $cc_type;
$data['CVV2'] = $cc_cvv;
$data['FIRSTNAME'] = $cc_first_name;
$data['LASTNAME'] = $cc_last_name;
$data['STREET'] = $cc_address;
$data['STATE'] = $cc_state;
$data['CITY'] = $cc_city;
$data['ZIP'] = $cc_zip;
$data['COUNTRY'] = 'US'; // Or other, if accepting international orders.
$data['IPADDRESS'] = $_SERVER['REMOTE_ADDR'];</pre><p>As in the book, these orders are being authorized first and captured later. The actual transfer of funds takes place in a second step, when the order ships. For simplicity sake, you could change the <strong>PAYMENTACTION</strong> to <em>Sale</em>, assuming that would be appropriate (and legal) in your situation. PayPal also wants you to pass along the customer&#8217;s IP address, for fraud prevention purposes. And you&#8217;ll need to get the credit card type from the user, which isn&#8217;t requested in the book&#8217;s original code.</p><p>Next, <strong>gateway_process.php</strong> needs your own information:</p><pre class="brush: php; title: ; notranslate">// Your account info:
$data['SIGNATURE'] = 'your API signature';
$data['USER'] = 'your API username';
$data['PWD'] = 'your API password';</pre><p>This information will be determined when you sign up for Website Payments Pro with your PayPal business account.<br
/> Next, there&#8217;s the payment gateway stuff:</p><pre class="brush: php; title: ; notranslate">// PayPal Website Payments Pro Stuff:
$data['VERSION'] = '85.0';

// Transaction stuff:
$data['METHOD'] = 'DoDirectPayment';</pre><p>And then there&#8217;s the order information:</p><pre class="brush: php; title: ; notranslate">// Order info:
$data['AMT'] = $order_total;
$data['CURRENCYCODE'] = 'USD';
$data['INVNUM'] = $order_id;
$data['CUSTOM'] = $customer_id;</pre><p>The <strong>CUSTOM</strong> option lets you send your own data along, in this case the customer ID (although the customer ID could also be retrieved later via the transaction ID).</p><p>(Note: Dividing the data into these two files may seem odd, but it&#8217;s done so that the administrative side can easily use the same <strong>gateway_process.php</strong> script, after running a <strong>gateway_setup_admin.php</strong> script. If you need help with the admin process, to capture a prior authorization, let me know.)</p><p>Also, the <strong>GATEWAY_API_URL</strong> constant in <strong>gateway_process.php</strong> needs to be changed to PayPal&#8217;s proper URL: <em>https://api-3t.sandbox.paypal.com/nvp</em> for testing, <em>https://api-3t.paypal.com/nvp</em> for live purposes.</p><p>After identifying all the values, the <strong>gateway_process.php</strong> script converts that data into a string of URL-encoded name-value pairs. That does not need to be changed, nor does the cURL request made at the end of that script.</p><p>In response to the request, PayPal will return a string which contains more name-value pairs: <em>TIMESTAMP=X&amp;ACK=Success&amp;VERSION=85&amp;&#8230;</em> This must be broken into an array:</p><pre class="brush: php; title: ; notranslate">$a = explode('&amp;', $response);
$response_array = array();
foreach ($a as $item) {
 list($key, $value) = explode('=', $item);
 $response_array[$key] = $value;
}</pre><p>This code is a bit different and more complex than the Authorize.net code, as Authorize.net only returns a string broken up by the pipe character (|). But at this point, &lt;strong&gt;$response_array&lt;/strong&gt; is usable. Unfortunately, &lt;strong&gt;billing.php&lt;/strong&gt; will need to be modified, because that script assumes a numerically indexed array. First, you&#8217;ll need to change the call to the stored procedure:</p><pre class="brush: php; title: ; notranslate">$r = mysqli_query($dbc, &quot;CALL add_transaction($order_id, '{$data['PAYMENTACTION']}', $response_array['AMT'], $response_array['ACK'], '$response_array['PAYMENTADVICECODE']', $response_array['TRANSACTIONID'], '$response')&quot;);</pre><p>After that code, different reactions occur based upon the success of the transaction. To check that, use <strong>$response_array['ACK']</strong>, which should have a value of <em>Success</em>. Other values include <em>SuccessWithWarning</em>, <em>Failure</em>, and <em>FailureWithWarning</em>. The response array will store the actual reasons in order elements in those situations. The unique transaction ID will be stored in <strong>$response_array['TRANSACTIONID']</strong>. This would be needed for the capture phase, if using that route. Again, if you need help with updating the admin pieces, let me know.</p><p>So that&#8217;s the gist of how you would use PayPal&#8217;s Website Payments Pro instead of Authorize.net for direct payment with the second e-commerce example in the book. As already mentioned, PayPal does insist that you create an Express Checkout process, too. It&#8217;s actually slightly simpler than this code because the user&#8217;s billing and shipping information is already stored in PayPal. To integrate this option, you&#8217;d add PayPal&#8217;s Express Checkout button to your <strong>cart.php</strong> page, and that would take the user to a different page on your site, where he or she enters his or her PayPal email address and password. This is then sent to PayPal for authorization, along with the order particulars. For more, see PayPal&#8217;s documentation.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/03/07/using-paypals-website-payments-pro-with-effortless-e-commerce-with-php-and-mysql/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>MAMP without MAMP</title><link>http://www.larryullman.com/2012/02/24/mamp-without-mamp/</link> <comments>http://www.larryullman.com/2012/02/24/mamp-without-mamp/#comments</comments> <pubDate>Fri, 24 Feb 2012 15:25:17 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[Mac OS X]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[mamp]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3091</guid> <description><![CDATA[For a couple of years now, I&#8217;ve used, and advocated using, the MAMP application as the easiest way to run a Web server on a Mac. Currently, the best argument for MAMP is that it doesn&#8217;t affect the built-in Apache. This also means that changes to the built-in Apache (via Mac OS X software updates) don&#8217;t impact your [...]]]></description> <content:encoded><![CDATA[<p>For a couple of years now, I&#8217;ve used, and advocated using, the <a
href="http://mamp.info/en/index.html">MAMP application</a> as the easiest way to run a Web server on a Mac. Currently, the best argument for MAMP is that it doesn&#8217;t affect the built-in Apache. This also means that changes to the built-in Apache (via Mac OS X software updates) don&#8217;t impact your setup, as can happen if you modify and configure how the built-in Apache runs. Although MAMP itself is free, in time I went ahead and purchased MAMP Pro. MAMP Pro is just a better interface to the MAMP stack, in particular providing an easy way to establish <a
href="http://httpd.apache.org/docs/2.4/vhosts/">virtual hosts</a>, which I use extensively (i.e., I create a new virtual host for each client or personal project). But I think it&#8217;s now time to start doing MAMP—Mac OS X, Apache, MySQL, and PHP—without MAMP, the application. Let&#8217;s look at the history and the options here to understand why it may be time for a switch.<span
id="more-3091"></span></p><p>I&#8217;ve been using Apple computers for thirty years now: I first learned how to program with Basic on an Apple IIe. My first Mac computer was purchased in 1994, a Color Classic. This was a few years before I begin my life as a programmer and Web developer. As a Mac user, and as a Web developer, I was so thrilled when Apple made the big switch in 2001 to Mac OS X, which is by far the most user-friendly version of Unix (Mac OS X uses a version of FreeBSD as its core). With Mac OS X, the same software running on Web servers also runs equally well on my home computer (and many of my clients run Mac servers, too). The specific software is the <em>*AMP stack</em>: Apache, MySQL, and PHP.</p><p>For the first several years, I always used the built-in Apache that came with the operating system, and then installed MySQL and PHP separately (Marc at <a
href="http://www.entropy.ch/home/">Entropy.ch</a> provided the best PHP installer). Then, a couple of years ago, Mac OS X began using a 64-bit version of Apache by default. This requires a 64-bit version of PHP, which requires 64-bit versions of all the associated libraries. Which wasn&#8217;t happening. Many PHP developers were stymied by Apple&#8217;s switch to a 64-bit Apache. One solution was to have the Mac run the 32-bit version of Apache instead of the 64-bit, which required some command-line tinkering. Fortunately, there was a better alternative: <a
href="http://mamp.info/en/index.html">MAMP</a>, which is also free.</p><p>The MAMP application installs Apache, MySQL, PHP, phpMyAdmin, and a couple of other niceties, separate from your built-in software. MAMP then slaps on a simple interface for starting and stopping them all, and adds a wee bit of possible configuration. Because of the issues with the built-in 64-bit Apache, I began using MAMP, and even started recommending it in my books. In time, I went ahead and purchased MAMP Pro, which provides an even better interface for controlling the same MAMP stack of applications. With MAMP Pro, you can easily create virtual hosts, set up an outgoing mail server, apply DNS, and more. Mostly, I purchased MAMP Pro because I had been using MAMP long enough that I thought it time I support the application. And that&#8217;s when I started second-guessing MAMP&#8230;</p><p>First, the paid version of MAMP comes with no more documentation or support than the free version, which is pretty much just wrong. For example, I had to enter my administrative password every time I started <em>or stopped</em> MAMP, which shouldn&#8217;t be necessary (and is annoying). I searched online, tried a couple of things: to no avail. MAMP Pro now allegedly comes with email support but no support was forthcoming when I first stated with MAMP Pro. In short, I realized that MAMP Pro isn&#8217;t giving you much for the $60 (USD) it costs, but I had already purchased MAMP Pro and had been using it for years, so I could live with that decision.</p><p>Another problem with MAMP is that it&#8217;s a bit of a pain to upgrade and they do released updates frequently enough to make it a factor. You have to copy out the database directory, install the new version, and then move the database directory back. I would think MAMP could come up with a better system, because the risk of wiping out all of your databases (and sites, if you place those within the MAMP directory) is far too high.</p><p>The next hiccup with MAMP is that they recently released version 2, which was a paid upgrade. MAMP 2 provides a couple of new features, but not a lot, and costs half the price of the original to upgrade. That may not be a lot compared to, say, upgrading an Adobe product, but remember that MAMP is just a package and an interface to a slew of free software. I&#8217;ve been holding off on upgrading, and then&#8230;</p><p>The final straw was that I needed to use a version of PHP with a couple of extra modules enabled. When I went searching online, I came across a number of excellent ways to install PHP on my Mac that don&#8217;t cost any money. Those are&#8230;</p><ul><li><a
href="http://www.ampps.com/">AMPPS</a> is a stack of Apache, MySQL, PHP, Perl, and Python. It runs on both Windows and Mac OS X, and is free. It&#8217;s not foolproof to install but documentation and support are available. The AMPPS control panel makes it very easy to configure Apache, PHP, and MySQL (e.g., change the version of PHP or what modules are loaded). And AMPPS comes with the ability to install many different software packages, such as WordPress.</li><li><a
href="http://realityloop.com/blog/2011/04/26/setting-apache-mysql-and-php-os-x-without-using-mamp">Brian Gilbert posted an article</a> at RealityLoop that explains how to install MySQL and PHP (PHP built from the source code) In a second article, Gilbert explains <a
href="http://realityloop.com/blog/2011/06/05/os-x-ditching-mamp-pro-part-2-gmail-email-relay">how to setup Gmail as an SMTP server</a>.</li><li>Finally, what I&#8217;ll personally start using the most is a <a
href="http://php-osx.liip.ch/">new PHP package for Macs</a>, based upon the classic entropy.ch one. It worked flawlessly for me, and is well designed. It uses the built-in Apache, and doesn&#8217;t include MySQL, however, so you&#8217;ll have to install that separately (which is easily done). But this package is easier to install than building PHP from source. (For more information on this package, <a
href="http://blog.liip.ch/archive/2011/04/13/php-5-3-for-os-x-10-6-one-line-installer.html">see this blog post</a>.)</li></ul><p>I&#8217;ll also add that if you, like me, really make use of virtual hosts, but don&#8217;t want the hassle of setting them up manually, you can consider <a
href="http://clickontyler.com/virtualhostx/">VirtualHostX</a>. It costs $30 (USD), but that&#8217;s still half the price of MAMP Pro. Personally, I&#8217;m just inclined to create virtual hosts manually anymore.</p><p>So there you have a <del>quick</del> long discussion of using Apache, MySQL, and PHP on your Mac. Mostly I feel that MAMP created an excellent, free product, that was a major asset to the Mac community for years. But the commercial product lacked many attributes that commercial applications should have. It&#8217;s been years now, and MAMP has yet to make the MAMP Pro application as professional as it should be. And so, it&#8217;s time for a switch, I think.</p><p>If any other Mac Web developers out there have any thoughts on the subject, I&#8217;d love to hear them.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/24/mamp-without-mamp/feed/</wfw:commentRss> <slash:comments>21</slash:comments> </item> <item><title>Top 100 E-Commerce Tips</title><link>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/</link> <comments>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/#comments</comments> <pubDate>Fri, 03 Feb 2012 15:31:35 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[e-commerce]]></category> <category><![CDATA[ecom]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2982</guid> <description><![CDATA[I just recently came across this somewhat old post titled Top 100 E-commerce Tips from WebmasterWorld. Despite the fact that the article was published over four years ago, and it&#8217;s based upon a slightly older forum thread, there&#8217;s still a lot of material in the article worth reading if you do any e-commerce. Even though [...]]]></description> <content:encoded><![CDATA[<p>I just recently came across this somewhat old post titled <a
href="http://www.soloseo.com/blog/2007/06/18/top-100-e-commerce-tips-webmasterworld/">Top 100 E-commerce Tips from WebmasterWorld</a>. Despite the fact that the article was published over four years ago, and it&#8217;s based upon a slightly older forum thread, there&#8217;s still a lot of material in the article worth reading if you do any e-commerce. Even though there are a full 100 tips here, they&#8217;re short—most are just a single sentence—and quite valid. Admittedly, I disagree with a couple, and feel like a few could be tossed out, but there are many good points made, and many reminders of things that perhaps you&#8217;ve forgotten to emphasize on your most recent e-commerce. project.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Examples from &#8220;Building a Web Site with Ajax: Visual QuickProject&#8221;</title><link>http://www.larryullman.com/2011/12/27/examples-from-building-a-web-site-with-ajax-visual-quickproject/</link> <comments>http://www.larryullman.com/2011/12/27/examples-from-building-a-web-site-with-ajax-visual-quickproject/#comments</comments> <pubDate>Tue, 27 Dec 2011 22:18:56 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[ajax]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2936</guid> <description><![CDATA[Although I don&#8217;t normally do this, per a reader request, I&#8217;ve made the book&#8217;s examples available to be seen and used here. The book has three primary examples, each in an Ajax and non-Ajax form. The pages are: dept_form.html This page returns all of the employees in a selected department. add_employee.html This page uses Ajax [...]]]></description> <content:encoded><![CDATA[<p>Although I don&#8217;t normally do this, per a reader request, I&#8217;ve made the book&#8217;s examples available to be seen and used here. The book has three primary examples, each in an Ajax and non-Ajax form. The pages are:</p><dl><dt><a
href="http://demo.larryullman.com/ajax/examples/dept_form.html">dept_form.html</a></dt><dd>This page returns all of the employees in a selected department.</dd><dt><a
href="http://demo.larryullman.com/ajax/examples/add_employee.html">add_employee.html</a></dt><dd>This page uses Ajax to add an employee to the database (note: the version running on this site does not actually execute the INSERT query that updates the database.)</dd><dt><a
href="http://demo.larryullman.com/ajax/examples/search_form.html">search_form.html</a></dt><dd>This page provides a simple search to retrieve employees by last name.</dd></dl><p>There&#8217;s no navigation within or among the pages. You&#8217;ll need to click Back to return to this page to see another example. To run one of the examples without Ajax (to see what that&#8217;d be like for visitors that can&#8217;t use the Ajax version), disable JavaScript in your Web browser.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2011/12/27/examples-from-building-a-web-site-with-ajax-visual-quickproject/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Security &amp; Privacy Made Simpler</title><link>http://www.larryullman.com/2011/12/24/security-privacy-made-simpler/</link> <comments>http://www.larryullman.com/2011/12/24/security-privacy-made-simpler/#comments</comments> <pubDate>Sat, 24 Dec 2011 15:42:04 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[e-commerce]]></category> <category><![CDATA[ecom]]></category> <category><![CDATA[ecommerce]]></category> <category><![CDATA[privacy]]></category> <category><![CDATA[security]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2931</guid> <description><![CDATA[When I was writing my book, I naturally did a bunch of research, particularly with regards to the various laws that apply. Understanding the programming behind an e-commerce site is relatively simple; understanding all the applicable laws and implications of doing e-commerce is complex. One of the sites I found to be quite useful was the U.S. [...]]]></description> <content:encoded><![CDATA[<p>When I was writing my <em></em><a
href="http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/">Effortless E-Commerce with PHP and MySQL</a> book, I naturally did a bunch of research, particularly with regards to the various laws that apply. Understanding the programming behind an e-commerce site is relatively simple; understanding all the applicable laws and implications of doing e-commerce is complex. One of the sites I found to be quite useful was the U.S. <a
href="http://www.bbb.org">Better Business Bureau</a> (BBB).</p><p>I&#8217;m currently going through some items in my &#8220;to read&#8221; folder, and am reading, or perhaps re-reading, the Better Business Bureau&#8217;s PDF titled &#8220;<a
href="http://www.bbb.org/us/corporate-engagement/security/">Security &amp; Privacy &#8211; Made Simpler</a>&#8220;. If you do any e-commerce, or even just Web development, it&#8217;s worth reading. It&#8217;s a 22-page document that discusses almost every facet of e-commerce, such as:</p><ul><li>Developing a security and privacy plan</li><li>Creating and communicating your security and privacy policies</li><li>Good employee screening and policies</li><li>Common hack/theft strategies</li><li>General Internet security</li><li>Proper handling of customer data</li><li>Payment processing</li><li>What to do in the event of a data breach</li><li>A preview of international e-commerce considerations</li></ul><p>The document also has many resources listed in these and other categories. You can download the PDF from that page, but there are also related FAQs and more on the BBB&#8217;s site.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2011/12/24/security-privacy-made-simpler/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Finding Book Bonus Content</title><link>http://www.larryullman.com/2011/12/20/finding-book-bonus-content/</link> <comments>http://www.larryullman.com/2011/12/20/finding-book-bonus-content/#comments</comments> <pubDate>Tue, 20 Dec 2011 19:27:36 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[C and C++]]></category> <category><![CDATA[Flex]]></category> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Ruby]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[jsdd]]></category> <category><![CDATA[phpmysql4]]></category> <category><![CDATA[phpvqs4]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2925</guid> <description><![CDATA[For many of my books, bonus content is made available through the publisher. Sometimes this is material that was intended for the book but had to be cut, such as an appendix or a chapter, and sometimes the material is a true bonus, such as a video screencast. Because it&#8217;s not clear for everyone how [...]]]></description> <content:encoded><![CDATA[<p>For many of my books, bonus content is made available through the publisher. Sometimes this is material that was intended for the book but had to be cut, such as an appendix or a chapter, and sometimes the material is a true bonus, such as a video screencast. Because it&#8217;s not clear for everyone how to access this bonus material, I thought I&#8217;d quickly post instructions here.</p><ol><li>Head to <a
href="http://www.peachpit.com">Peachpit.com</a> (almost all of my books are published by Peachpit Press)</li><li>Click on <a
href="https://memberservices.informit.com/my_account/login.aspx?partner=52">Account Sign In</a> at the top of the page.</li><li>If you don&#8217;t already have an account with Peachpit.com, click the <a
href="https://memberservices.informit.com/my_account/register.aspx">Create a new one&#8230;</a> link to register.</li><li>After you have registered, login.</li><li>On your account page (after logging in), click <em>Registered Products</em>.</li><li>On the Registered Products tab, click <em>Register Another Product</em>.</li><li>Follow the instructions to register the book.</li><li>Return to the Registered Products page.</li><li>For the book in question, click the <em>Access Bonus Content</em> link. That will take you to a page with all the bonus content for a given book.</li></ol><p>Besides being able to access bonus content, there are other benefits to registering at Peachpit&#8217;s site. And while you&#8217;re there, you can also check out <a
href="http://www.peachpit.com/authors/bio.aspx?a=2a14d669-06f6-48cf-a5b8-907169808b9f">my author page</a>, which lists the books I&#8217;ve written for Peachpit, the articles I&#8217;ve published there, and the blog postings I&#8217;ve published there. Both the articles and blog postings are viewable without registration or logging in.</p><p>I hope that helps anyone having trouble finding the material they&#8217;re looking for.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2011/12/20/finding-book-bonus-content/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Served from: www.larryullman.com @ 2012-05-21 13:47:08 by W3 Total Cache -->
