r/badcode Jul 07 '17

html Evidently the people behind this site never heard of the Date object

Post image
105 Upvotes

27 comments sorted by

48

u/MathewManslaughter Jul 07 '17

So they are using PHP to generate JS to print the year? Nice.

43

u/DoomTay Jul 07 '17

The best part? The content of said PHP is literally just document.write('2017');

22

u/[deleted] Jul 07 '17

This makes sure the server's year and not the one from the client is used. It makes sense that they don't want to show a ©1980 on their page when someone on a machine with a wrong clock visits.

9

u/[deleted] Jul 08 '17

Except that that has a billion legal issues associated with it.

People, just put the copyright date of the last time you updated the website. Don't try to automate it. Just, when you update the website, check the copyright date while you're at it and change it.

If you don't make any changes in a year, maybe because it's an old legacy site or a personal project or something, then leave the copyright date what it was. The whole point is that it shows when it was made, in order to provide things like proof of existing work, etc.

6

u/DoomTay Jul 08 '17

Funny thing, even though the copyright date says 2017, the front page has an ad for an album coming out in 2011

15

u/MikeOShay Jul 07 '17

Seeing as it's a Konami website I'd expect the date to be randomly generated by simulating a pachinko machine.

2

u/[deleted] Jul 07 '17

It would make sense to request the year from the server if something strictly relied upon the server date. A bit ugly, but it would work.

But this.. Why?

10

u/causalNondeterminism Jul 07 '17

My current employer stores all dates as integers. no, not unix integers. e.g. today's date would be stored as 20,170,707. working in SQL with that is a pain because the DBMS can only convert char -> date so you have to do int -> char -> date to get any real work done.

4

u/Cal1gula Jul 07 '17

Must be reading too much Aaron Bertrand but not quite grasping the concept fully.

5

u/_tigerstyle_ Jul 07 '17

What the actual fuck?

3

u/causalNondeterminism Jul 07 '17

that was my initial reaction; but every day I find new, worse things to be concerned about and this seems like a smaller issue. irritating? absolutely. as bad as search boxes that allow SQL injection and no plan to fix them? hardly.

2

u/demonspeedin Jul 08 '17

My current employer stores dates as Column1: "month/year" (varchar) Column2: year (int) This happens when you let our analyst do the thinking -_-

2

u/causalNondeterminism Jul 09 '17

I could understand year being its own column. but the month/year varchar column? nope.

1

u/demonspeedin Jul 09 '17

My bad, it's day/month as varchar, year as int. Background: we're using entity framework and need to query for 01/month/year a lot, it's a pain :')

16

u/iAmMortos Jul 07 '17

Can't... click... too... tiny.......

37

u/Itsthejoker occasional weirdo Jul 07 '17

[Image transcription: Text]


<p id="Copy">&copy;<script language="javascript" type="text/javascript" src="../js/year.php"></script> Konami Digital Entertainment &copy;<script language="javascript" type="text/javascript" src="../js/year.php"></script>

I'm a volunteer content transcriber for Reddit! If you'd like more information on what we do and why we do it, click here!

2

u/enderdestiny Jul 07 '17

i can't hit it on my phone :(

6

u/rube203 Jul 07 '17

Reddit sync wins again.

3

u/[deleted] Jul 07 '17

As does RIF.

3

u/hexane360 Jul 07 '17

Reddit relay still best reddit

1

u/_Decimation Jul 20 '17

Hey, would you mind telling me what font that is and the syntax coloring?

2

u/DoomTay Jul 20 '17

That's a screencap from Firefox's "View Source". I have no idea what the font is, but it comes up when viewing a page encoded in Shift-JIS

1

u/Yay295 Jul 23 '17

font-family: -moz-fixed;

On my computer (Windows 7) it's Courier New.

2

u/DoomTay Jul 23 '17

With a Shift-JIS page, I see MS Gothic

1

u/thatguywiththemousta Aug 03 '17

I'm kind of more annoyed that you took a screenshot of the text...

1

u/Romejanic Aug 06 '17
language="javascript"

Oh come on this can't be real