Modern PHP Session Management: Replacing session_register() and Securing Sessions
If you learned PHP a decade or more ago, you probably reached for session_register() without a second thought. Then one day
A collection of web development tutorials and code snippets for WordPress, PHP, JavaScript, CSS and many more.
If you learned PHP a decade or more ago, you probably reached for session_register() without a second thought. Then one day
You upgrade PHP on a Friday, and by Monday your error log is full of “Deprecated:” lines you have never seen
You ship a login flow, stash the session token in localStorage because it survives refreshes, and move on. It works. Then
A user lands on your page, sees a friendly button, and clicks it. Nothing looks wrong. But the click never went
You escaped every bit of user input in your HTML. You locked down your script sources. Then someone pastes a few
In September 2024, a single conference talk pulled the WordPress world into a fight it still hasn’t finished. Matt Mullenweg, co-founder
One line of PHP is all it takes. A developer wires a page loader off a URL parameter, ships it, and
You drop a meta tag into your <head>, and something in your brain relaxes. Security handled. Move on. That feeling is
You upgrade PHP, reload the site, and there it is in the logs: Deprecated: …. Nothing broke. The page still works.
You add one small library to save an afternoon. It pulls in twelve more you never read. Six months later a
WordPress runs north of 40% of the web, and most of that power comes from plugins. That’s the trade. Plugins hand
You ship a Content Security Policy, see the header show up in DevTools, and feel safe. That feeling is the trap.
If you have ever inherited an old PHP codebase, you have probably met magic_quotes_gpc. It was PHP’s attempt to keep you
You merge a chunk of user-supplied JSON into a plain object. Looks harmless. A moment later every object in your app
Someone leaves a comment on your site. It looks ordinary. But tucked inside the text is a <script> tag, and the
Open the access log on almost any WordPress site and you’ll find them: a slow, patient drip of POST requests to
You click a button that says “Play.” Nothing seems to happen. But the click didn’t land on the button you saw.
A stylesheet feels harmless. It picks fonts, sets colors, nudges spacing. Nobody audits CSS the way they audit a login form,
If you’ve inherited an old PHP app, there’s a good chance its passwords are sitting in the database as md5() or
You inherit a PHP project, open two files, and find two classes both called User. One is yours. One came from