#!/usr/bin/perl
push(@INC,".");
push(@INC,"/usr/contrib/lib/perl/");

# Include a couple of libraries (cgi-lib.pl has several html type functions)

require("cgi-lib.pl");

# Initialize variables

$mail = "/usr/sbin/sendmail";

$ENV{"PATH"} = "";
$ENV{'IFS'} = '';
$reurl = $ENV{QUERY_STRING};
$baseurl = "http://www.avatarpress.com/";
$newurl = $baseurl . $reurl;

&ReadParse;

$emailAddr = $in{"visitor"};


# If we are here, then success -- print a happy message

print "Content-type: text/html\n\n";
print <<TAG;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<SCRIPT LANGUAGE="Javascript">
    // Sets cookie values. Expiration date is optional
    function setCookie(name, value, expire) 
    {
        strCookie = name + "=" + escape(value);
        if (expire)
            strCookie += "; expires=" + expire.toGMTString();

        document.cookie = strCookie;
    }

    function getCookie(Name) 
    {
        var search = Name + "="
        if (document.cookie.length > 0) { 
            // if there are any cookies
            offset = document.cookie.indexOf(search)
            if (offset != -1) { 
                // if cookie exists
                offset += search.length

                // set index of beginning of value
                end = document.cookie.indexOf(";", offset)

                // set index of end of cookie value
                if (end == -1)
                    end = document.cookie.length

                return unescape(document.cookie.substring(offset, end))
            }
        }
    }
	
    <!-- 
    function saveVisitor()
    {
        var visitorName = document.firstForm.from.value;
		expireDate = new Date("January 01, 2010 00:00:00");
        setCookie("visitor", visitorName, expireDate);
    }
	
	  function lengthVisitor()
    {
        var visitorlength = document.firstForm.from.value;
		expireDate = new Date("January 01, 2010 00:00:00");
        setCookie("visitor", visitorName, expireDate);
    }

    // -->

  function getVisitor()
    {
        var vname = getCookie("visitor");
	if (vname == null || vname == "null" || vname == "Anonymous" || vname == "" || vname == "undefined") vname = "email address";
		document.firstForm.from.value = vname;  
    }
	
function checkEmail(firstForm) {
if (/^\\w+([\\.-]?\\w+)*\@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+\$/.test(firstForm.from.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}

function checkOut() {
if (/^\\w+([\\.-]?\\w+)*\@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+\$/.test(document.firstForm.from.value)){
document.myForm.visitor.value=document.firstForm.from.value;
document.myForm.submit();
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}

</SCRIPT>


	<title>Adult Section Entrance</title>
</head>

<body bgcolor="#000000" text="#ffffff" link="#FFFFFF" vlink="#CCCCFF" alink="#FFFFFF" onLoad="getVisitor()" onunLoad="saveVisitor()">

<center><h3>Adult Section Entrance</h3>
<p>The section you are about to enter contains mature or adult material
<br>for adults only. Please enter your email address to verify you are 18 
<br>or older and wish to enter this section.  Optionally, you may sign up
<br>for our mailing list at the same time.

 <form NAME="firstForm" onSubmit="return checkEmail(this)" align="center" method="POST" action="http://www.avatarpress.net/cgi-bin/elists.cgi">
        <b><font size="-1"> 
        <input type="hidden" name="df" value="avatarpress::">
        <input type="hidden" name="return" value="$newurl">
		<input type="hidden" name="thnx" value="$newurl">
        <input type="hidden" name="this" value="http://www.avatarpress.com/subscribe.html">
        <input type="hidden" name="undo" value="http://www.avatarpress.com/unsubscribe.html">
        <input type="hidden" value="0" name="unsub">
                <input type="text" name="from" size="18"><br>
                <input type=button value="submit" onClick="checkOut()">  <input type="submit" value="submit & subscribe" name="send">  
 
      </form>


<form NAME="myForm"  method="POST" action="http://www.avatarpress.com/cgi-bin/eform.cgi">
<input type="hidden" name="visitor"> 
<input type="hidden" name="adulturl" value="$newurl">
</form>
<p>Both options take you directly to your adult page.

</body>
</html>
TAG

exit 0;

