/** * 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"> <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; }