function friendsend($sid) {
global $user, $userinfo, $prefix, $db, $module_name, $pagetitle, $defis, $stop;
$sid = intval($sid);
$result = $db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid' AND time <= NOW() AND status='1'");
if ($db->sql_numrows($result) == 1) {
list($title) = $db->sql_fetchrow($result);
$title = stripslashes($title);
$pagetitle = "$defis "._NEWS." $defis $title $defis "._FRIEND."";
head();
title(""._FRIEND."");
if ($stop) warning($stop, "", "", 1);
OpenTable();
echo "<center><font class=\"content\"><b>"._YOUSENDSTORY." \"$title\" "._TOAFRIEND."</b></center><br>"
."<form action=\"index.php?name=$module_name\" method=\"post\">"
."<input type=\"hidden\" name=\"sid\" value=\"$sid\">";
if (is_user($user)) {
getusrinfo($user);
$yn = $userinfo['user_name'];
$ye = $userinfo['user_email'];
}
echo "<table align=\"center\"><tr><td>"._YOURNAME.":</td><td><input type=\"text\" name=\"yname\" value=\"$yn\" size=\"30\"></td></tr>"
."<tr><td>"._YOUREMAIL.":</td><td><input type=\"text\" name=\"ymail\" value=\"$ye\" size=\"30\"></td></tr>"
."<tr><td>"._FFRIENDNAME.":</td><td><input type=\"text\" name=\"fname\" size=\"30\"></td></tr>"
."<tr><td>"._FFRIENDEMAIL.":</td><td><input type=\"text\" name=\"fmail\" size=\"30\"></td></tr>"
."<center>".captcha_random(2)."</center>"
."<center><input type=\"hidden\" name=\"op\" value=\"sendstory\">\n"
."<input type=\"submit\" value="._SEND.">\n"
."</table></form></center>\n";
CloseTable();
foot();
} else {
Header("Location: index.php");
}
}
function sendstory($sid, $yname, $ymail, $fname, $fmail) {
global $sitename, $homeurl, $prefix, $db, $module_name, $stop;
checkemail($ymail);
checkemail($fmail);
if (captcha_check(2)) $stop = ""._SECCODEINCOR."";
if (!$stop) {
$sid = intval($sid);
list($title, $time, $topic) = $db->sql_fetchrow($db->sql_query("SELECT title, time, topic FROM ".$prefix."_stories WHERE sid='$sid'"));
$title = stripslashes($title);
$time = stripslashes($time);
$topic = intval($topic);
list($topictext) = $db->sql_fetchrow($db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$topic'"));
$topictext = stripslashes($topictext);
$subject = "$sitename - "._INTERESTING."";
$message = ""._HELLO." $fname!<br />"._YOURFRIEND." $yname "._CONSIDERED."<br /><br />"._FSTORY.": $title<br />"._PDATE.": ".formatTimestamp($time)."<br />"._PTOPIC.": $topictext<br /><br />"._THEURL.": <a href=\"$homeurl/index.php?name=$module_name&op=article&sid=$sid\" target=\"_blank\">$homeurl/index.php?name=$module_name&op=article&sid=$sid</a><br /><br />"._YOUCANREAD.": <a href=\"$homeurl\" target=\"_blank\">$sitename</a><br />"._FSITEURL.": <a href=\"$homeurl\" target=\"_blank\">$homeurl</a>";
mail_send($fmail, $ymail, $subject, $message, 0, 3);
update_points(6);
head();
title(""._FRIEND."");
warning(""._FSTORY." \"$title\" "._HASSENT." $fname", "?name=$module_name&op=article&sid=$sid", 5, 2);
foot();
} else {
friendsend($sid);
}
}