logo

dmpop

Aircraft photography, spaghetti code, half-baked thoughts

Guestbook Reads
Currently reading: Gli occhi di Venezia, Alessandro Barbero


Mejiro: A lot of effort to make URLs look nicer

All I wanted was to make URLs in Mejiro less unwieldy, so they look not like this:

https://mejiro.photo/index.php?file=photos/Travel/Palermo/20230423-130156.jpeg&album=Travel/Palermo

But like this:

https://mejiro.photo/index.php?file=photos/Travel/Palermo/20230423-130156.jpeg

This relatively straightforward task (or so I thought!) turned into several hair-pulling evening sessions. The idea was to replace the ?album= parameter with the $_SESSION global variable. I blame on me being clueless when it comes to coding for spending so much time on solving this seemingly simple problem. But in the end, my puny mind prevailed. And, of course, the solution was as simple as I imagined: it just took me longer to arrive to it.

Later same day

I didn't plan to spend most of my Sunday tinkering with Mejiro, but I did. Why? Because while watching an Australian series on ARTE, I came up with an idea of how to mask URL parameters to obfuscate file paths. I tried a few approaches and I'd settled on using bin2hex and hex2bin functions for that. I'm reasonably sure it's not the strongest way to mask URL parameters, but it's good enough for the task at hand.


Published: 2024-01-21Reads: 488
Comment by emailBack
dmpop

dmpop

Linux user, amateur photographer, aviation enthusiast, clueless developer of ADS-B station, Pellicola and Tinble, author of a bunch of books. I can mix a decent Negroni, too. You can reach me at me@dmpop.xyz