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 @phparchOscar sent us this code with the statement “The user must have really enjoyed writing raw SQL statemen…


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 rid…


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 code123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960…


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 processedled me to this post: “Creating a user from the web problem”,which includes this code:1shell_exec("sudo useradd -p $encpass -g groupname -s /bin/bash $user…


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 andmay not be suitable for all readers.I saw this horrifying code snippet in my Twitter feed this afternoon.Tweet could not be processedTo make this abomination easier to read, I’ve copied and formatted it here.1234<?foreach…