";
echo $out;
$action=$_POST['action'];
$name=stripslashes($_POST['name']);
$email=stripslashes($_POST['email']);
$category=stripslashes($_POST['category']);
$website=stripslashes($_POST['website']);
$title=stripslashes($_POST['title']);
$descr=stripslashes($_POST['descr']);
$sl_id=stripslashes($_POST['sl_id']);
$linkpage=stripslashes($_POST['linkpage']);
$linkurl=stripslashes($_POST['linkurl']);
if ($action=="submit") {
if (empty($category)) {
$error="You didn't choose a Category. This field is required.";
} else if (empty($name)) {
$error="You left your Name blank. This field is required.";
} else if (empty($email)) {
$error="You left your E-mail address blank. This field is required.";
} else if ((check_email($email))==0) {
$error="Your E-mail's syntax is not correct.";
} else if (empty($website)) {
$error="Please enter URL of your site. This field is required.";
} else if (!empty($website) && substr($website,0,7)!="http://") {
$error="Your website does not start with \"http://\".";
} else if (empty($title)) {
$error="Please enter Title. This field is required.";
} else if (empty($descr)) {
$error="Please enter Description. This field is required.";
} else if (empty($linkpage)) {
$error="Please enter LinkPage. This field is required.";
} else if (!empty($linkpage) && substr($linkpage,0,7)!="http://") {
$error="Your LinkPage does not start with \"http://\".";
}
// is linkpage on website
if (!empty($linkpage) && !empty($website)) {
$web_domain = substr($website,7);
if(strpos($web_domain,'?') != false)
$web_domain=substr($web_domain,0, strpos($web_domain,'?'));
if(strpos($web_domain,'#') != false)
$web_domain=substr($web_domain,0, strpos($web_domain,'#'));
if(strpos($web_domain,'/') != false)
$web_domain=substr($web_domain,0, strpos($web_domain,'/'));
$link_site = substr($linkpage,7);
if(strpos($link_site,'?') != false)
$link_site=substr($link_site,0, strpos($link_site,'?'));
if(strpos($link_site,'#') != false)
$link_site=substr($link_site,0, strpos($link_site,'#'));
if(strpos($link_site,'/') != false)
$link_site=substr($link_site,0, strpos($link_site,'/'));
if (strtolower($link_site) != strtolower($web_domain)) {
$error="The LinkPage is not on your website";
}
}
if (empty($error) && !empty($name)) {
$query="SELECT * FROM links_categ WHERE usr='".qu($name)."'";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$error="Your Name already exists in our database.";
}
}
if (empty($error) && !empty($linkpage)) {
$query="SELECT * FROM url WHERE url='".qu($linkpage)."' and status_id=1";
$result = mysql_query($query);
if (mysql_num_rows($result)) {
$error="The LinkPage already exists in our database.";
}
}
if (empty($error)) {
// insert a new user
$query="INSERT INTO links_categ (usr, email, category_id, linkurl, website, title, descr, stat)
values('".qu($name)."', '".qu($email)."', '".qu($category)."' ,'".qu($linkurl)."', '".qu($website)."', '".qu($title)."', '".qu($descr)."', 8)";
mysql_query($query);
mysql_query("USE recip_links");
$query="update site_link set last_linked=now() where id='".qu($sl_id)."'";
mysql_query($query);
mysql_query("USE pregnancy_stories");
// delete previous urls
$query="DELETE FROM url where url = '".qu($linkpage)."'";
mysql_query($query);
// insert a new url
$query="INSERT INTO url (user, url, status_id, creation_date)
values('".qu($name)."', '".qu($linkpage)."', 3, now())";
mysql_query($query);
$query="SELECT url_id FROM url WHERE url='".qu($linkpage)."'";
$result = mysql_query($query);
if ($record = mysql_fetch_object($result)) {
$url_id = $record->url_id;
}
echo mysql_error();
$content="
Click here for details:
http://".getenv('HTTP_HOST')."/f/admin/activate_link.php?url_id=$url_id
";
$content_plain=strip_tags($content);
// to address, to name, from address, from name, subject, text message, html message
smail("maxine@hearthstoneonline.com", "maxine@hearthstoneonline.com", $email, $name, $email, "Link exchange request on PregnancyStories", $content_plain,$content);
smail("checkurl@pregnancy-info.net", "Eugene", $email, $name, $email, "Link exchange request on PregnancyStories", $content_plain,$content);
}
}
// first page
if (empty($action)) {
$query="select * from linkcategory order by category_name";
$result = mysql_query($query);
echo mysql_error();
$arr_categ = array();
while($record = mysql_fetch_object($result)) {
$arr_categ[$record->category_id] = $record->category_name;
}
mysql_free_result($result);
?>
At Pregnancy Stories, we are happy to include a link to your site. We feel that this is an ideal way for our visitors to access important resources, valuable parenting information, professional organizations and useful products related to being pregnant, giving birth and raising a child.
If you feel that the content of your site is a good match for pregnant women and parents, then follow the steps outlined in the form below. It is necessary for you to add one of the links that we specify below to your site before we add your site to our directory. Once a review of your site has been completed, we will send out an email to inform you whether you are linked to us and where your link appears.
We are looking forward to sharing links with you and keeping our visitors better informed about the exciting world of pregnancy and parenting!
There are two steps in the linking process. First, you will place one of our recommended links
on your site. Upon approval, we will add your site to our link page under the category that you
choose below. Please note that the link we provide you with may direct your visitors to another
website owned by PregnancyStories.net which we feel is more suited to your visitors. Please
do not change the link code that is given in anyway.
}
// second page
else if ($action=="show_code") {
if($_POST[category]==0) {
header('Location: http://'.getenv('HTTP_HOST').getenv('REQUEST_URI'));
exit;
}
// default values
$linkurl = "http://www.pregnancystories.net";
$g_title = "Pregnancy Stories";
$g_descr = "Short stories about being pregnant";
// load values from db
mysql_query("USE recip_links");
$query="
SELECT sl.id as sl_id, l.link as url, l.title, l.descr, img100, img125, img468
FROM site as s
right join site_link as sl on sl.siteid=s.id and active=1
right join link as l on l.id=sl.linkid and status=1
WHERE s.sitename='PregnancyStories'
order by last_linked limit 1";
$result=mysql_query($query);
if ($record=mysql_fetch_assoc($result)) {
$sl_id = $record[sl_id];
$linkurl = $record[url];
$g_title = $record[title];
$g_descr = $record[descr];
$g_img1="";
$g_img2="";
$g_img3="";
}
mysql_free_result($result);
mysql_query("USE pregnancy_stories");
?>
}
// third page
else if ($action=="contact_form" || ($action=="submit" && !empty($error))) {
if (!empty($error)) {
echo " ERROR WITH FORM: $error";
}
?>
}
// forth page
else if ($action=="submit") {
?>