First, check the browser or user agent using $_SERVER['HTTP_USER_AGENT'] for some of the strings listed here: http://www.useragentstring.com/pages/All/ Or more specifically for crawlers: http://www.useragentstring.com/pages/Crawlerlist/ If you want to say log the number of visits of most common search engine crawlers, you could use: $interestingCrawlers = array( 'google', 'yahoo' ); $pattern = '/(' . implode('|', $interestingCrawlers) .')/'; $matches = array(); $numMatches = [...]
Here is a simple way to install ioncube on XAMPP (web server at localhost). First, download ioncube loader from http://www.ioncube.com/loaders.php Then extract to the root htdocs, usually on C:\xampp\htdocs and the root folder of ioncube loader is on C:\xampp\htdocs\ioncube Find and edit php.ini file, usually at C:\xampp\php\php.ini After downloading ioncube loader, then extract to the root htdocs of your XAMPP, [...]
To removes (trim) all white space around image (example on JPG), you can use this short code. How it’s work? It just a simple way. This script will find out where is the “WhiteSpace” stops, then it will copy everything inside the white space border. <?php //load the image! it's possible to open remote image from another website, just put [...]
Here is small code to make your WordPress Search Result more friendly for SEO (Search Engine Optimization). It will result http://www.shouthuns.com/search/find-something/ instead http://www.shouthuns.com/?s=find+something Just put this code into top of the header of your themes. (Remember! It should be placed on first line on your header themes) <?php $src = strtolower(mysql_real_escape_string($_GET['s'])); $sclear = ereg_replace("[^ 0-9a-zA-Z]", " ", $src); // Remove [...]
I don’t have idea about an iframe on PHP, it’s just served as another page and interpreted with browser. But you could do something like this : <iframe src="frame-page.php?parent=<?php echo parentPageURL(); ?>"> On inside the iframe (frame-page.php), you can access $_GET['parent'] to get the parent page url. Just make sure you verify, as that would be insecure. And here the [...]
Here the various ways to get current page (url) with PHP, JavaScript, and WordPress. Use PHP : $current_page_URL = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; Where $_SERVER["SERVER_NAME"] will give you the domain name of current page and $_SERVER["REQUEST_URI"] will give you the rest request page! example:- for the URL http://www.shouthuns.com/php/get-current-page-url-with-various-ways.html $_SERVER["SERVER_NAME"] : will return www.shouthuns.com $_SERVER["REQUEST_URI"] : will return /php/get-current-page-url-with-various-ways.html If you want [...]
The following class is useful to take (download) a picture of a another site and copied to the local computer (server). You only need to specify the url of remote files and local directory that will be used as a storage place, then let this class to download a remote file. Incoming search terms:$image_create_func, image_save_func,
I’ve got simple email validation. Here’s the code: <?php function is_validemail($email) { return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email); } $email = "simple.email.address@shouthuns.com"; if(is_validemail($email)) { echo ("email validated"); } else { echo ("invalid email given"); } ?> This function work fine for me! Please enjoy the code ;)