James Bachini

Code

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

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

  • Using Adsense Section Targeting

    If you are getting lots of Groupon and Three ads on your adsense niche site the chances are it isn’t optimised correctly. By simply writing a short, keyword rich, snippet of what your site is about and surrounding it in the following tags you can manipulate which ads are shown. <!– google_ad_section_start –> Jet internet…

  • Facebook Share button more effective than Likes?

    A recent post at SEOMoz suggested that their research has found a better correlation between facebook shares than Facebook likes. The full post is here and makes for an interesting read. One of the things that really caught my attention was in the comments and I quote: “After chatting with our Google rep it seems…

  • Custom WordPress 404 Page For SEO

    I have recently been purchasing used domain names from Godaddy Auctions and Dropcatch. When I 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…

  • Setting up twitter feed to post to Twitter and Facebook accounts

    If you don’t already have a facebook and twitter account for your company they are really easy to setup. On facebook remember to click the “Create a Page for a celebrity, band or business” link on the homepage. Once you have those accounts setup head over to twitterfeed.com and sign up for an account. Enter…

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

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

  • 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

    ////// 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 =…

  • Three ways to debug php

    Method 1 – error.log For this to work you need to be coding in a linux environment with php, apache etc setup. This is the best way I have found and what I currently use to debug my applications/web pages. open up a new terminal and type: tail -f /var/log/apache2/error.log This will give you a…

  • list to php array list2phparray

    Code below for a script to take a list and turn it into an array. Comes in pretty useful. <?php if ($_POST[‘list’]) { $splist = explode(“\n”, $_POST[‘list’]); $out = ‘$x = array(‘; foreach ($splist as $line) { $out = $out.”‘$line’, “; } $out = substr($out,0,-1); $out = substr($out,0,-1); $out = $out.’);’; echo $out; } else…

  • Prosper202 Hacks and Modifications

    Prosper202 Hacks and Modifications

    JiM’s Prosper202 mods 1) increase session life (stops it locking you out every few minutes) add the following line just before session_start(); in 202-config/connect.php ini_set(‘session.gc_maxlifetime’,99999); 2) Cchange the first page you see. edit 202-login.php line 80: header(‘location: /202-account’);  to   header(‘location: /tracking202’); or /tracking202/spy/ If you are doing email submits or any volume loging into spy…

  • Dynamically modifying the landing page with TrafficVance using php

    Dynamically modifying the landing page with TrafficVance using php

    I ran into a silly issue today when dynamically modifying a landing page using TrafficVance. The script I was using was a pretty straight forward: <?php if ($_GET[‘t202kw’]) { $kw = strip_tags($_GET[‘t202kw’]); } if(strpos($kw,’jetinternetmarketing.co.uk’) !== false) { $page = ‘<h1>Dont target JiM on traffic Vance</h1>’; } ?> The problem was that the url I was…