PHPnews.io

Overview for 'csiphp'

Really enjoy writing SQL

Written by CSI: PHP / Original link on Mar. 9, 2018

This great code snippet came from editor in chief of php[architect] magazine, Oscar Merida. The best step you can take to prevent your code from showing up here on our site is subscribe to @phparch Oscar sent us this code with the statement “The user must have really enjoyed writing raw SQL stateme…


stop writing your own strip tags

Written by CSI: PHP / Original link on May. 2, 2016

@devnuhl sent this one to us via a Gist earlier today; Some background he gave us: Honestly just stumbled onto this while updating the codebase. Oddly enough, it seems like the only usage of this function is in another function in the same file, which is being added to the gist now. Having gotten…


Everyone ALWAYS has JavaScript enabled right?

Written by CSI: PHP / Original link on Apr. 8, 2016

A JavaScript redirect is a fairly simple technique to easily redirect your users to a new location. Within the confines of a PHP application if you need the parent window’s URL, JavaScript is the easiest way to grab that info. We have a PHP application that has a checkIfUserIsLoggedIn function and…


Shortcuts Are Bad

Written by CSI: PHP / Original link on Apr. 8, 2016

Friend of mine asked me to take a look at his PHP script. The original scope was to call this script via ajax, posting an email address to get saved to a database. Here is the original code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39…


No Way That's Real

Written by CSI: PHP / Original link on Aug. 27, 2013

I thought that Graham was the most devious PHP code troll I’d ever met. Turns out I was wrong. Dead wrong. This tweet: Tweet could not be processed led me to this post: “Creating a user from the web problem”, which includes this code: 1 shell_exec("sudo useradd -p $encpass -g groupname -s /bin/bash…


Artisan Level Code Trolling

Written by CSI: PHP / Original link on Aug. 19, 2013

WARNING: The code you’re about to view is intended for mature audiences and may not be suitable for all readers. I saw this horrifying code snippet in my Twitter feed this afternoon. Tweet could not be processed To make this abomination easier to read, I’ve copied and formatted it here. 1 2 3 4 <…