Jump to content

Can we send Google referral email from within top of index.html?


yshua

Recommended Posts

 

      Right now, the following PHP script claims to send an email for Google referrals, as your forum states.  I put it in the first few lines of index.php.  Is this wrong, because I still received zero emails, adding the site name to keywords below...?  And, of course, I searched the same keyword from Google without success.

 

<?php

// Script to email you when Google refers traffic to your site.

$name=""; // add your name here

$email_address="";

// add your email address here

$keywords="";

$referrer=$_SERVER['HTTP_REFERER'];

if( (stristr($referrer, "google")) && (stristr($referrer, "search")) ) {

 

parse_str($referrer, $output);

$keywords=$output['q'];

$email_message="Hi $name, A visitor just arrived to your site after searching for '$keywords'. ($referrer)"; mail ("$email_address","Google referred a visitor","$email_message");

}

?>

    If this is wrong, how DO I use such a PHP within my phpmyadmin folder?  Need help.

      Correct.  I am new to this, and my email address and name were filled in between the quotes.  And thanks to you asking, the Spam folder was empty as well.  In regards to the reference to phpmyadmin, this is something new to me.  The index.php file (I was used to index.html) I believe is referenced through my contracted one time software provider under that folder.  Now I truly am unfamiliar with the PHP programming heirarchy of index.php, database, config files, etc.  I am just getting my feet wet and would appreciate any and all pointers....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.