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.

Link to comment
Share on other sites

      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....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.