Tagged: php

Redirection Methods and Referer Passing 0

Redirection Methods and Referer Passing

The following are some methods you can use to redirect users from one place to another. I generally use 301 redirects for anything where I want the referer passed through because this is the fastest. Double meta refresh for anything where blank referer is important and a custom script which incorporates the form submit redirect to fake the referer where this is necessary. Getting the right redirect is important to...

Prosper202 Mod – Set preferences before crashing server 0

Prosper202 Mod – Set preferences before crashing server

Had a bit of an issue with Prosper crashing once the database got too big. I would log out and leave the analysis preferences set to my biggest traffic source and when I logged back in the server would crash as it tries to pull a report before you can modify the search critieria. I knocked up a quick mod so you can set preferences before attempting to run a...

Rotating Offer Pages and Landing Pages in Prosper202 0

Rotating Offer Pages and Landing Pages in Prosper202

It is really easy to setup rotation of urls in Prosper but if you actually want to track which url is doing better or you want to test different landing pages it can be a little more challenging. One way to do this is to set each url or landing page up separately and then use a php rotation script to divide the traffic. Direct Linking to an Affiliate Offer...

Prosper 202 Mods 2012 0

Prosper 202 Mods 2012

Prosper202 mods 1) increase session life – stops it logging you out every five minutes when you are trying to work add the following line just before session_start(); in 202-config/connect.php ini_set(‘session.gc_maxlifetime’,99999); 2) bypass adverts on first page – bit naughty but I prefer to jump straight into the spy section to see whats been going on. edit 202-login.php line 80: header(‘location: /202-account’);  to   header(‘location: /tracking202’); or /tracking202/spy/ 3) Change $...

Custom Facebook Share and Twitter Tweet Buttons as WordPress Widget 0

Custom Facebook Share and Twitter Tweet Buttons as WordPress Widget

The following is the php code to make your own dynamic Facebook share and Twitter tweet buttons. Just place the images in the root directory and install the Samsarin PHP widget. Copy this code into a Samsarin Php widget and drag it to your sidebar. <a target=”_blank” href=”http://www.facebook.com/sharer.php?u=<?php echo “http://” . $_SERVER[‘HTTP_HOST’]  . $_SERVER[‘REQUEST_URI’]; ?>”><img src=”/share-facebook.png” alt=”Share on Facebook” border=”0″ /></a> <br /> <a title=”Share on Twitter” href=”http://twitter.com/share?_=1292093673417&amp;count=horizontal&amp;original_referer=<?php echo “http://”...

Custom wordpress 404 page for SEO 0

Custom wordpress 404 page for SEO

We have recently been purchasing used domain names from Godaddy auctions and Dropday. When we get the domains the first thing we do is look at what traffic they were pulling for what topics via google cached web search. If there is some good content on there and things we want to keep we will rebuild the page with the same url. The big advantage of this is that you...

Setting up custom facebook and twitter buttons using php 0

Setting up custom facebook and twitter buttons using php

The canonical tag has been a god send for us helping to get pages indexed and clean up site structures. In many sites we use the same php variable for our share buttons. This is a great way to setup custom twitter and facebook share buttons for your pages. We always use an external template file and then include it from the pages but you can hard code this into...

Mixing php with javascrip – Heredoc 0

Mixing php with javascrip – Heredoc

My main issue with javascript is the fact it is full of ‘ and ” which can be a real pain when coding. I’ve started using a method called heredoc to set a start and end point, example below. // Heredoc string // $sstring = <<<TEST Hello World TEST; The word TEST could be anything and it wont finish inputing the string until it comes across it again. This is...

Poor mans GeoIP – Quick and Easy Geolocation 0

Poor mans GeoIP – Quick and Easy Geolocation

//poor mans geoip $country=trim(file_get_contents(“http://api.hostip.info/country.php?ip=”.$_SERVER[‘REMOTE_ADDR’])); //You can then redirect customers to different offers depending on country. I wouldn’t recommend this for critical or high volume use. if ($country == ‘MyCountry’) { yadda yadda yadda; }

Two php functions for scraping content and extracting links 0

Two php functions for scraping content and extracting links

////// Grab webpage ////// function webFetcher($url) { $crawl = curl_init(); curl_setopt ($crawl, CURLOPT_URL, $url); curl_setopt($crawl, CURLOPT_RETURNTRANSFER, 1); $resulting = $resulting.curl_exec($crawl); curl_close($crawl); return $result = $resulting; } //////////////////////////////// //// extract links //// function extract_links($text) { preg_match_all(‘/<\s*a[^<>]*?href=[\’”]?([^\s<>\’”]*)[\’”]?[^<>]*>(.*?)<\/a>/si’, $text, $match_array, PREG_SET_ORDER); $return = array() ; foreach ($match_array as $serp) { $full_anchor = $serp[0]; $href = $serp[1]; $anchortext = $serp[2]; if ( (preg_match(“/http:/i”,$href)) && (!preg_match(“/cache/i”,$href)) && (!preg_match(“/google.com/i”,$href)) && (!preg_match(“/youtube.com/i”,$href)) && (!preg_match(“/wikipedia.org/i”,$href)) && ($href[0]!= ‘/’)...