Loading

post

HowTo: Browser and OS Detection with PHP

A very quick PHP script for detecting browser/device and OS agent strings from the HTTP User Agent variable. This is not 100% reliable because surfers and bots sometimes hide or falsify the user agent string so please use with caution. Browser and OS Detection Script This script detects whether the OS/Device is Linux, MacOS, iPad, iPhone, Droid, Unix, Windows or anything else (caught in Unknown). It also detects whether the browser is Chrome, Firefox, Opera or Internet Explorer. The user agent string is stored in the variable $agent. The operating system or device is stored in the … [Read more...]

post

Are You Getting Open_BaseDir Restriction Errors From Scripts and WordPress Plugins?

I don't know a secure solution but I do know the cause. The cause is a PHP security restriction. It's a good one to have and shows your host cares about you and other users on your server. A typical open_basedir error looks like this: PHP Warning: file_exists(): open_basedir restriction in effect. File(/var/www/your-website/wp-config.php) is not within the allowed path(s)... The open_basedir restriction is a security feature used on some servers. It prevents hackers from getting into different areas of your hosting space by, for example, exploiting a php script bug to upload a PHP shell … [Read more...]

post

Regular Expressions – A Quick Guide

Read it out loud: "Regular Expressions." It chimes like the name of a horror movie Alfred Hitchcock would be proud to tag his name to. But it shouldn't. Don't be frightened by the name. It is, after all, only a name. Familiarize it. Shorten it to Regex or Regexp and give it a little hug as you tell it "We're going to be lifelong buddies..." What follows in this guide is an introduction to regular expressions and a reference table of regular expression metacharacters with examples for their usage. Unless you really need an introduction, jump straight ahead to the table because that is where … [Read more...]

post

Really Simple Traffic Logger

Adding PHP Code to Shortcode Exec PHP

Born out of boredom, unrealized necessity and the fruit of another script, this really simple PHP counter logs page views and tracks visitors from the time they enter your site to  the time they leave it. Weighing in at slight 9.9 KiB, or 5.6 KiB when all comments are removed, it represents excellent value for a free php website traffic counter and logger. The traffic data logged by Really Simple Traffic Logger is everything you might need to see where your visitors are coming from, where they are going once they are on your site and for optionally displaying a configurable PHP counter on … [Read more...]

All original content on these pages is fingerprinted and certified by Digiprove