Categories

Archives

Did You Know?

When interviewing PHP developers about typical web site vulnerabilities, most of them know about SQL Injections and Cross-Site Scripting (XSS). However, it really bugs me that many of them haven't heard of Cross-Site Request Forgery (CSRF).

Recent Comments

Tags

asp audio browser bug business coalesce code crash Database db debian extension framework imap internet legions linux metaverse mysql obscurity patch PHP postgresql properties release scp Second Life second life security session social media sound sql ssh subversion tables tortoisesvn tribes ubuntu virtual world web windows zend zend framework zf

Tag: processing

Handling CSV data with PHP the Smart Way

Let's assume we have a file "users.csv", containing the following data:

"Username","Firstname","Lastname","Age"
"johndoe","John","Doe","21"
"hmiller","Hank","Miller","35"

Processing the data in PHP is rather straight forward, by simply using fgetcsv(). Let's display the user's name and age:

// open the file for reading
$f = fopen('users.csv', 'r');

// just a dummy read to get the header out of the way
fgetcsv($f);

// loop through each line
while ($data […]