";
echo "";
}
}
elseif( strtolower( trim($HTTP_GET_VARS["action"]) ) == 'done')
{
//Confirm
contact_header();
confirm();
contact_footer();
}
else
{
//Start
contact_header();
contact_form('','');
contact_footer();
}
################################FUNCTIONS########################################
function contact_header()
{
?>
Contact Stock Investor Media
|
|
|
|
$value)
{
$VARS[$key] = htmlspecialchars(stripslashes($HTTP_POST_VARS[$key]));
}
}
?>
}
function contact_footer()
{
?>
|
|
Please use the contact form above for any inquiries |
|
|
|
 |
Copyright © Stock Investor Media Inc. All Rights Reserved |
}
function confirm()
{
?>
Your comments/message has been sent successfully. Please allow 24/48 hours processing time.
Thank You. StockInvestorMedia.com |
}
function validate_form($VARS)
{
$blanks['First Name'] = trim($VARS['firstname']);
$blanks['Last Name'] = trim($VARS['lastname']);
$blanks['Subject'] = trim($VARS['subject']);
$blanks['Comments'] = trim($VARS['comments']);
//Check for blanks
foreach ($blanks as $key => $value)
{
if(!$value)
{
$error_messages[$key] = 'is empty or invalid';
}
}
//Check for a valid contact email address
$email = trim($VARS['email']);
if( !eregi("@", $email) )
{
$error_messages['Email'] = 'please enter a valid email address';
}
return $error_messages;
}
function post_data($HTTP_POST_VARS)
{
global $sitename;
$host = "www.site-partners.com/web_contact_forms/results.php";
$reqbody = "";
foreach($HTTP_POST_VARS as $key=>$val)
{
if (!empty($reqbody)) $reqbody.= "&";
$reqbody.= $key."=".urlencode($val);
}
//Add which site it comes from
$reqbody .= '&site=' . urlencode($sitename);
$result = post($host,$reqbody);
}
function post($host, $query, $others='')
{
# $host includes host and path and filename
# ex: "myserver.com/this/is/path/to/file.php"
# $query is the POST query data
# ex: "a=thisstring&number=46&string=thatstring
# $others is any extra headers you want to send
# ex: "Accept-Encoding: compress, gzip\r\n"
$path = explode('/',$host);
$host = $path[0];
unset($path[0]);
$path = '/'.(implode('/',$path));
$post = "POST $path HTTP/1.1\r\nHost: $host\r\nContent-type: application/x-www-form-urlencoded\r\n${others}User-Agent: Mozilla 4.0\r\nContent-length: ".strlen($query)."\r\nConnection: close\r\n\r\n$query";
$h = @fsockopen($host,80);
@fwrite($h,$post);
for($a = 0,$r = ''; !$a;)
{
$b = @fread($h,8192);
$r.= $b;
$a = ( ($b == '')?1:0 );
}
@fclose($h);
return $r;
}
?>