/** * 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 {$_USER['username']} at {$_USER['email']} because they thought you would be " . "interested in learning more about a great Hunting & Fishing website called {$_CONF['site_name']}! " . $_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 {$_CONF['site_name']} at {$_CONF['site_url']} 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 {$_TABLES['vars']} (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 = '' . LB; $retval .= '' . LB; $retval .= '' . LB; if (!empty($msg)) { $retval .= ''; } $retval .= '
' . LB; $retval .= 'Email address:
' . LB; $retval .= ' 
' . $msg . '
'; return $retval; }