Code Fail Luv?

[383 Clicks]


I Heart Code Fails...Not

This was a code fail that I'd seen initially in a search for an open-source "coming soon" page with an admin panel. It's an attractively interfaced codebase in both front and back;

Application Back Side

Application Front Side

The functionality is admittedly original as the subscriber information is handled in a matter more analogous to XML information storage than the flat-file process. Even for all its' sophistication (and it's really gem-like in this respect), the main need of the application: admin needs to survey subscriber list on designated page, fails horribly. The subscriber list fails to be output for display on the subscribers.php page where it SHOULD reside;

And even though the processing of the application works well enough so that the information captured from the front-side email input form is written to the subscribers.txt.php page;

the information isn't getting through in the admin panel AT ALL. For my forensic investigation, I relied on my server error_log file generated in the folder where the coding munge actually happened (and what I love about live server dynamics). The consistency of error caused by the authors' incorrect variable initialization ($subscribers = array();), thus;
$filecontent = file_get_contents( '../' . $config['subscribers_file'] );
$subscribers = explode("\r\n", $filecontent);
$subscribers = array_slice($subscribers, 3); // remove first 3 lines of file (php comments)
$subscribers = array_values( array_filter($subscribers) );

is not the same as;

$subscribers = file_get_contents( '../' . $config['subscribers_file'] );
$filecontent = explode("\r\n", $subscribers);
$subscribers = array_slice($filecontent, 3); // remove first 3 lines of file (php comments)
$subscribers = array_values( array_filter($filecontent) );

Resource Box


Mr Lee Davis is the owner/admin of, an instant publishing site for news, articles, information, multimedia, and infographic submissions along with exposure to profitable opportunities associated with content creation. Are you a content creator in need of a way to double your content output while halving creation time? Info can be found at the 100% UNIQUE Articles salespage