Geeklog France
 

Block refer site

/**
* Shows refer this site block, not meant to be used by anonymous users
*
* BE SURE TO PUT ALL CUSTOM CODE IN /path/to/geeklog/system/lib-custom.php
* AS THIS WILL MAKE YOUR UPGRADES EASIER!!!
*/
function phpblock_refer_site() {
    global $HTTP_POST_VARS, $_USER, $_CONF, $PHP_SELF, $_TABLES;
 
    $toemail = strtolower($HTTP_POST_VARS['emailaddr']);
    $to = $toemail;
    $mailsent = false;
 
    if (!empty($toemail) && COM_isemail($toemail)) {
        if (DB_count($_TABLES['users'],'email',$toemail) > 0) {
            $msg = $toemail . ' is already a member of ' . $_CONF['site_name'];
        } else {
            // Good got an email addresss, send referral
            $mailtext = "This message was sent to you by  at  because they thought you would be "
                . "interested in learning more about a great Hunting & Fishing website called ! "
                . $_CONF['site_name'] . " is a not-for-profit website with the only focus being to make you and others better at "
                . "their outdoor pursuits.  Get a wide variety of information, tips, tactics on fishing, hunting, trapping and much more "
                . "by visiting  at  today!" . LB . LB
                . '------------------------------------------------------------'.LB
                . "NOTE: This is not unsolicited mail.  You received this message because someone specifically requested that "
                . "you do.  Your email address was not saved and will not be given out under any circumstance.";
 
            $mailto = $to.' <'.$toemail.'>';
            $mailfrom = 'From: '.$_USER['username'] .' <'. $_USER['email']. '>';
            $subject = 'Re: Hunting & Fishing!';
 
            @mail($toemail,$subject,$mailtext,$mailfrom);
 
            $msg = 'Successfully referred ' . $toemail . '!';
        }
 
        if (DB_count($_TABLES['vars'], 'name','num_site_referrals') == 0) {
            DB_query("INSERT INTO  (name,value) VALUES ('num_site_referrals',0)");
        }
 
        // Increment numemails counter for story
        DB_change($_TABLES['vars'], 'value', 'value+1', 'name', 'num_site_referrals', '', true);
    }
 
    // Now show the form
    $retval = '<table cellpadding="0" cellspacing="0" border="0" align="center">' . LB;
    $retval .= '<form name="refer_site" action="' . $PHP_SELF . '" method="post">' . LB;
    $retval .= '<tr><td>' . LB;
    $retval .= '<b>Email address:</b></td></tr><tr><td>' . LB;
    $retval .= '<input type="text" name="emailaddr" size="16">&nbsp;<input type="submit" value="Go!"></td></tr>' . LB;
    if (!empty($msg)) {
        $retval .= '<tr><td><font color="red">' . $msg . '</font></td></tr>';
    }
    $retval .= '</form></table>';
 
    return $retval;
}
Connecté en tant que : Guest (Guest)
blocks/refersite.txt · Dernière modification: 2009/01/16 19:04 par ::Ben
 

Download geeklog

Last version 1.8.1

Espace Membre





Devenir membre
Enregistrez-vous

Mot de passe oublié ?

Change language

Categories

  • Geeklog (38)
  • Plugins (53)
  • Thèmes (17)
  • My cart

    Votre panier (0 article)

    Votre panier est vide!

    0.00 EUR

    Visual Theme Switcher

    Test out available themes by selecting from one of the 6 available themes or give the Visual Switcher a try:

    Follow us on twitter

    En ligne

    Visiteurs: 7