- 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
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.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.
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.
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.
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.
Admin
TRWTF is the ad being hidden in the source code thanks to the easy reader version not properly closing the comment tag
Admin
Maybe the staff didn't want to show any ads.
Admin
My crystal ball says "oops, I don't want to send these emails while debugging, let me just empty out that code" and they never went back.
Admin
Text file? You folks are taking it wrong: too hard to edit! This data would better be handled as an Excel spreadsheet file that admins keep emailing to each others as attachment, and that one specific person has the job of uploading on their intranet server.
(Any event depicted here is unfortunately non fictional)
Admin
That story reminded me of the time I was doing Civil Service at a nursery home, and they wanted to hire me to write a work scheduling system, because they didn't want to pay 25€ per employee for a company product.
Oh boy, did I dodge a bullet there. My Knowledge of programming at the time was windows batch, some pre-HTML5 JavaScript and Scripting Ultima Online free shards. And like everyone with that level of knowledge, I was way too confident on how far my knowledge could take me.
The administration was less knowledgeable and thought that a legally-just-barely-adult teenager with some hobby interest in programming and PCs could handle the task.
On the plus side, they almost certainly wouldn't have understood that they'd need someone to maintain whatever I would have produced.
Addendum 2024-10-07 02:14: For reference, that was in 2005.
Admin
thanks for info
Addendum 2024-10-31 08:54: When it comes to exploring various betting options and enhancing your gambling experience, MostBet is a great platform to consider. Similar to the article that highlights the importance of utilizing available resources effectively, MostBet provides an extensive array of information on sports betting, promotions, and market trends. Whether you're a novice looking to learn the ropes or a seasoned bettor wanting to optimize your strategies mostbet official app offers the insights needed to make informed decisions. Just as libraries are valuable for accessing information, MostBet serves as an essential tool for anyone interested in the world of sports betting.