- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
$name
is a truly awful name for a variable containing a dictionary (idgaf what the proper name is for this structure in PHP) containing a mapping from names to email addresses.Edit Admin
I did a contract for a public university a couple of decades ago that had implemented single sign-on by passing the username and password in the clear in the url parameters to the next app. Anything is possible with people don't understand how code works.
A nicer idea here might have been to change the file to be plain text (with robust import checking) so they could edit it themselves.
Edit Admin
That would have been the "correct" way. A database would be overkill, but a text file that's read in with one line per person some kind of Name:email value? That's easy enough that even a librarian could do it.
Edit Admin
In all fairness, they would have needed a "programmer" as well to change DB entries. He would have needed to make or append an administrative site to actually be use friendly - until they needed again a "programmer" to reset their admin passwords because all of them locked themselves out :-)
Admin
Maybe the staff didn't want any emails.
Edit Admin
Came here to say something similar. I don't feel that the WTF here is really that much of a WTF. Apart from the fact that the list is written in PHP, this is a nice lightweight solution to the problem. If it were a table in a database, either people would need to acquaint themselves with SQL and an appropriate SQL client, or a maintenance page needs to be written and that assumes that the server has a database back end already.
This solution offers some nice advantages: no pesky database server, easy to edit with a text editor (not MS Word!), easy to add to source control (although I suspect these people didn't have that).
Admin
+1 Man, I could have used that code...
Admin
Just give them something like PHPMyAdmin with a user that has access to only the staff table. They can insert and delete users from there really easily then.
Just implement a trigger on the table so changes get mirrored to a log you can revert, just in case some screws up and deletes everything.
Admin
I would suggest, even if this was stored in a text file, that it be maintained through a maintenance page. Asking non-technical users to edit a text file has some challenges of its own, because when people can enter free-form data with no guard rails you will get all sorts of garbage added to your file. We all thinks it's easy to manually edit a text file, but that does not hold true for everyone, and you need a way to back out when they mangle something.
Admin
I bet the person who extracted the table into an included file (leaving the empty constructor) was very proud of that improvement.
Edit Admin
TRWTF is the ad being hidden in the source code thanks to the easy reader version not properly closing the comment tag