News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joshua Thijssen:
Symfony2 logging out
October 10, 2014 @ 10:51:03

In this new post to his site Joshua Thijssen talks about something that's usually considered a common task and might be overlooked when it comes to security: logging out (specifically in Symfony-based applications).

One of the "golden rules" of symfony2 is to never hardcode urls or paths inside your code or templates. And letting symfony deal with the generation of your urls and paths makes your life a lot easier as a developer. But one of the things I see regularly is that people are still hardcoding their logout urls like using "/logout". But logging out is actually a bit more complex than it might seem, and using a simple /logout might work for most cases, but there are better ways to deal with this.

To give some context, he starts with an overview of the Security component of the Symfony framework, mentioning how it can be configured with different "secure" areas and how they handle the user authentication. He includes an example configuration of one of these "firewalls" in a YAML document with three different sections: "dev", "superadminstuff" and "main". He explains what each of these sections are configuring and how they will react when the user visits them. He talks some about the "logout: true" handling and what kind of defaults are also included when it's called. He suggests that, instead of a hard-coded "logout" URL in your application, you make use of the "logout_url" and "logout_path" functions to create the link for you, making it consistent across the application and easier to configure.

0 comments voice your opinion now!
symfony logout security user login component link

Link: https://www.adayinthelifeof.nl/2014/10/06/symfony2-logging-out/

Cal Evans:
"Delivery Initiated" A word on having empathy for the users of your software
October 08, 2014 @ 09:24:37

In his latest post Cal Evans reminds us, as software developers, that our jobs aren't always about making the things we create about the best code or most tech. It's also about having empathy for users of the software you're building.

I learned something very important in all of [the troubles I had with traveling to Amsterdam], I learned that we as software developers and designers need to have a great deal of empathy for the people using what we build. It is not enough to put yourself in your user's shoes, you have to put yourself in their mindset. You have to design every user interaction with an understanding of not only who is using your software, but why they are using it.

He focuses the rest of the post on his experience post-delay, trying to get an update on where in the world his luggage might be via a URL given to him by the lost luggage group. He comments on the terseness of the message he was given on the page ("Delivery Initiated") but points out that it's not overly user-friendly and really doesn't give much information. He suggests that the developers of the tool didn't actually think about end users, just that they should share a status and that's all.

It is not enough to create personas and figure out who is using your software. You need to understand why they are using it, and what their mindset will be when they are using it. You need to have empathy for your users.
0 comments voice your opinion now!
user empathy system opinion travel luggage delivery

Link: http://blog.calevans.com/2014/10/07/delivery-initated-a-word-on-having-empathy-for-the-users-of-your-software/

The Code of a Ninja:
Salt, Hash and Store Passwords Securely with Phpass
June 16, 2014 @ 11:15:37

In this post to the CodeOfANinjs.com site, they walk you through password hashing, salting and storage using the PHPAss tool from OpenWall. The post itself is a bit older, but the content still provides a good example to teach the basics.

I think the main reason why we have to hash passwords is to prevent passwords from being stolen or compromised. You see, even if someone steal your database, they will never read your actual or cleartext password. I know that some PHP frameworks or CMS already provide this functionality, but I believe that it is important for us to know how its implementation can be made.

The tutorial shows you how to use the library and how to store the result in a simple "users" table in a MySQL database. The examples hash the password given from a simple form and use prepared statements (via PDO) to save it to the database. All PHP, HTML and CSS code you'll need - including the login form that checks the username/password - is included. There's also a few screenshots showing what the resulting forms and data should look like.

0 comments voice your opinion now!
phpass tutorial hash salt password storage mysql user

Link: http://www.codeofaninja.com/2013/03/php-hash-password.html

Evert Pot:
MySQL 5.6 BOOL behavior when using PDO and prepared statements
December 05, 2013 @ 10:37:42

Evert Pot was seeing some weird issues with his MySQL BOOL usage via PDO when he upgraded to one of the latest versions (5.6). Thankfully, he's shared his solution to the problem as well as the symptoms he was seeing when it was causing problems.

I recently updated my workstation to run MySQL 5.6.13. It didn't take very long for things to start breaking, and since I couldn't find any other information about this on the web, I figured this may be useful to someone else. The main error that started popping up was: "Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'my_bool' at row 1' in test.php" This exception happens under the condition that you use PDO, prepared statements and booleans.

He includes a small sample script to reproduce the issue and points out the issue - the default casting of prepared values to strings in prepared statements with PDO bound parameters. He shows two "relatively easy solutions" to the problem - either using integers instead of the true/false PHP boolean or specifying a type with the bindValue call.

0 comments voice your opinion now!
mysql upgrade boolean field pdo prepared statement

Link: http://evertpot.com/mysql-bool-behavior-and-php/

Tech.pro:
How to Create an RSS Feed Using PHP and PDO
December 04, 2013 @ 11:52:53

On the tech.pro site there's a recent tutorial posted showing you a basic way to create an RSS feed using data coming from a database accessed via PDO.

Using an RSS feed on your website is a great way of letting your visitors, search engines or directories get a hand on your content. RSS feeds are common practice on most blog and CMS platforms including Wordpress, Joomla and evenly the newly released Ghost. If you're using a CMS or similar platform, the likelihood is that you don't need to implement an RSS feed yourself. [...] Below you've got the step-by-step process to create anything from the simple, standard-compliant RSS feed - up to the more advanced.

The tutorial shows you how to pull the data from a simple database table (SQL not provided, but pretty easy to figure out(, including example PDO connections for several database types. This data is then manually appended into an XML string to build out the RSS feed correctly. They also talk about implementing the Dublin Core metadata as a way for providing more information about the feed and its contents (including an image and category details).

0 comments voice your opinion now!
rss feed introduction tutorial pdo xml dublincore

Link: http://tech.pro/tutorial/1722/how-to-create-an-rss-feed-using-php-and-pdo

Aura Blog:
A Peek At Aura v2 -- Aura.Sql and ExtendedPdo
October 22, 2013 @ 10:04:51

On the Aura blog Paul Jones has posted a look ahead for the framework, looking specifically at what's coming in version 2 for the Aura.Sql and ExtendedPdo functionality.

In the lessons learned post, I talked about how Aura was born of the idea that we could extract independent decoupled packages from Solar, and how in doing so, we discovered that some of those extracted packages themsleves could be further split into independent pieces.

He gives the example of Aura.Sql compared to the Solar_Sql (from the Solar framework) and how certain things that they thought needed to be coupled actually didn't. In version 2 of the Aura.Sql component, they're taking this same approach and abstracting out things that don't actually need to be in the base class. This breaks it up into three packages - Aura.Sql-v2, Aura.Sql_Query and Aura.Sql_Schema. He gets into more detail in the rest of the post as to what the new Aura.Sql (v2) will still handle.

0 comments voice your opinion now!
aura framework aurasql extendedpdo pdo database version2

Link: http://auraphp.com/blog/2013/10/21/aura-sql-v2-extended-pdo/

Nomad PHP:
November 2013 - Ed Finkler, "More Code, More Problems"
August 30, 2013 @ 10:38:38

The Nomad PHP (virtual) user group has announced their speaker for the November 2013 meeting - Ed Finkler talking about the problems that come with having "more code" in your applications.

In this talk I'll extend the concepts to other languages we work with in web development, establishing these core principles: Learn languages, not frameworks, build small things, less code is better than more, and create and use simple, readable code We'll cover how following these principles makes you a better developer, and makes the job of maintaining and verifying your code much easier.

The meeting is on November 14th and you'll have to sign up if you'd like to attend. There's a $10 USD cost for a ticket and you can purchase them right up until the event.

0 comments voice your opinion now!
edfinkler nomadphp november virtual user group

Link: http://nomadphp.com/2013/08/29/november-2013/

Reddit.com:
Tools to test a REST API?
August 16, 2013 @ 12:53:17

On Reddit.com today there's a post asking for suggestions of tools to test a REST API from the outside (like a user, not unit testing).

Does anybody know of any tools to test a rest API from the POV fo a client? Behat and Cucumber seems to be cool, but are these the right tool to benchmark directly through http?

There's a wide range of suggestions including:

0 comments voice your opinion now!
testing tool suggestion rest api user http

Link: http://www.reddit.com/r/PHP/comments/1kg515/tools_to_test_a_rest_api

Simon Champion:
PHP Upgrade Broke My Data Importer
June 27, 2013 @ 12:13:45

In his latest post Simon Champion recounts some of the issues he had when upgrading to PHP 5.4, what's usually a smooth transition from PHP 5.3. His specific problem came in a difference between the previous mysql_query call and the more-correct PDO usage.

Our office is in the thoes of a large-scale upgrade of the servers in our data center. The new version of Debian (version 7, or "Wheezy") has been officially released, having been in beta for the last few millenia, and our Ops team are slowly installing it across all our servers. This is great news, as it means we get to upgrade to PHP 5.4. Woohoo! New shininess. [...] We were ready. The upgrade should have been a breeze. But it wasn't.

He talks about his process of digging through the code trying to figure out why a call to import a CSV file into MySQL was failing. Their Data Importer component started failing with an error from MySQL about the "LOAD INFILE" not being allowed for use. He shares a "work around" that's not ideal (using exec) that manually imports the file into the database. He does point out that it could be something Debian-specific as they don't upgrade the version, just apply security patches retroactively.

We're making an effort to stick to modern PHP coding standards, so we're using PDO throughout, which makes is all the more galling. [...] Given that we do have a work-around now and everything is back up and running, I'm going to have to let this one drop; I don't have the time to try chasing it any more. But I hope this blog post will prove useful to anyone else having the same issue.
0 comments voice your opinion now!
upgrade data importer mysql infile load pdo mysqlquery

Link: http://spudley.com/blog/php-upgrade-broke-my-data-importer

Sameer Borate:
Simple user authentication in Laravel 4
June 17, 2013 @ 14:22:01

Sameer Borate has a new post today showing how you can do simple user authentication in a Laravel 4-based application using the built-in Auth functionality.

With the recent release of Laravel 4, PHP developers have at their disposal one of the finest frameworks for application development. As with all new frameworks, it is always good to write some quick code to get a feel for the underlying architecture. The following post shows a simple authentication application using Laravel.

He walks you through the creation of the simple "users" table, the configuration the Auth class will need to connect and authenticate and the form for the login. He also shows the steps for the actual authentication process as well as the code for the routes to make it all work. Additionally, he shows how to restrict pages to only those with the "admin" level access via an auth filter. You can download the example code here.

0 comments voice your opinion now!
user authentication laravel4 tutorial database auth admin

Link: http://www.codediesel.com/frameworks/simple-user-authentication-in-laravel-4


Community Events





Don't see your event here?
Let us know!


package laravel list voicesoftheelephpant tips library symfony series api community podcast install release framework bugfix interview opinion language introduction deployment

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework