Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > mailer.php
<%
  # $Id: mailer.php,v 1.14 2005/01/03 07:15:26 hirokai Exp $
  $page = "mailer";
  include_once( "modules/utils.inc.php" );
	$site = getSiteUrl();

	$tok =  $authenticated = $_COOKIE["c_pass_token"];
	$u   =  $sessionUserId = $_COOKIE["c_uid"];
%>
<title> Feed Me Links : Mail Link  #<%= $id %>... </title>
<base href="<%= $site %>/mailer" />
<script language="javascript">

  if( window.focus() )
    window.focus();

</script>

<% include( "$modules/header.insecure.inc.php" ); %>

<b>mail this link:
<% if( ! $tok || ($tok && $tok != md5( getPasswdForUser( $u ))) ) {
	include( "$modules/popup-login.inc.php" );
} %> </b>
<br />

<%
	if( $tok && $u && $tok == md5( getPasswdForUser( $u ))) {

		$recips = get_previous_mailtos();

		if( $to ) {
			# boilableplate
			$linkName = getTitleForLink( $l );
			$from = getEmailAddressForUser( $sessionUserId );
			$headers = "";
			$headers .= "From: $sessionUserId <$from>\n";
			$headers .= "X-Mailer: feedmelinks-mailer-daemon\n";
			
			mail( $to, $subject ? $subject : "a link for you: $linkName", $comment ? $comment : "check this out: $site/$l", $headers);

			cache_mailto( $u, $to, $recips );

%>

LINK SENT!<br />
(window will close in 2 seconds)<br />

<script language="javascript">
	var timer = setTimeout( "window.close()", 2 * 1000 );
</script>

<%
		} else {
%>

<form action="mailer">

send the link <a target="_blank" href="/<%= $id %>"><big><%= getTitleForLink( $id ) %></big></a>:<br />

<table border=0 width=420>
<tr>
	<td align="right"><a accesskey="t" href="javascript:document.forms[0].to.select();"><u>T</u>o</a>:</td>
	<td><input name="to" size="28" maxlength="64" value="<%= get_last_mailto() %>" style="margin-left: 5px;" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;<%= get_previous_recips_menu( $recips ) %></td>
</tr>
<tr>
	<td align="right"><a accesskey="u" href="javascript:document.forms[0].subject.select();">S<u>u</u>bject</a>:</td>
	<td><input name="subject" size="28" maxlength="64" style="margin-left: 5px;" value="<%= getTitleForLink( $id ) %>" /></td>
</tr>
<tr>
	<td align="right" valign="top"><a accesskey="c" href="javascript:document.forms[0].comment.focus();"><u>C</u>omment</a>:</td>
	<td><textarea name="comment" rows="10" cols="38" style="margin-left: 5px;">Check this out: 

http://feedmelinks.com/<%= $id %>


-- <%= $u %></textarea></td>
</tr>

<tr>
	<td colspan="2">
<p style="text-align: right;"><button accesskey="s" value="Send it!" onClick="document.forms[0].submit();" class="default"><u>S</u>end It!</button></p>
<input type="hidden" name="l" value="<%= $id %>" />

	</td>
</tr>
</table>


</form>

<%
		}
	} 
%>

Return current item: FeedMeLinks, Social BookmarkingSince2002