View Single Post
Old 01-31-2013, 11:39 PM   PM User | #9
njfail
Regular Coder

 
Join Date: Aug 2010
Posts: 130
Thanks: 2
Thanked 0 Times in 0 Posts
njfail is an unknown quantity at this point
Thanks for the help.
I'll start on researching validating the input forms more once I get the refid thing working right.

I updated the code with your changes. There are no errors, but its not writing the refid # to the csv file? Any idea why?

Code:
<?php
session_start();
 $_SESSION["rewards"] = '';

if(isset($_GET['refid'])){
    setcookie("njfailREWARDsystem", $_GET['refid'], time()+604800);

}else if(isset($_COOKIE["njfailREWARDsystem"])){
    $value = $_COOKIE["njfailREWARDsystem"];
    $_SESSION["rewards"] = $value;
}

if(isset($_POST["msoft"]) && $_POST["msoft"] == 'junk')
{
	$errorMessage = "";
	
	if(empty($_POST['publishername']))
	{
		$errorMessage .= "<li>Please enter your name in the field below.</li>";
	}
	if(empty($_POST['publisheremail']))
	{
		$errorMessage .= "<li>Please enter your email in the field below.</li>";
	}
	if(empty($_POST['websitename']))
	{
		$errorMessage .= "<li>Please enter a name for your website.</li>";
	}
	if(empty($_POST['websiteurl']))
	{
		$errorMessage .= "<li>Please enter your website's URL.</li>";
	}
	if(empty($_POST['uniqueviews']))
	{
		$errorMessage .= "<li>Please enter an estimate of your website's monthly unique views.</li>";
	}
	if(empty($_POST['rawviews']))
	{
		$errorMessage .= "<li>Please enter an estimate of your website's monthly raw impressions.</li>";
	}
	if(empty($_POST['websitedescription']))
	{
		$errorMessage .= "<li>Please enter a description for your website.</li>";
	}

	$varpublishername = $_POST['publishername'];
	$varpublisheremail = $_POST['publisheremail'];
	$varwebsitename = $_POST['websitename'];
	$varwebsiteurl = $_POST['websiteurl'];
	$varuniqueviews = $_POST['uniqueviews'];
	$varrawviews = $_POST['rawviews'];
	$varwebsitedescription = $_POST['websitedescription'];

	
	if(empty($errorMessage)) 
	{
	
//define the receiver of the email
	$to = $_POST['publisheremail'];
//define the subject of the email
	$subject = 'ValueViewMedia Application Confirmation';
//define the message to be sent. Each line should be separated with \n
	$message = $_POST['publishername']. ",\n\nThank you for applying to become a ValueViewMedia publisher!\nWe will review your application, and contact you with the results within 48 hours.\n\nThank you,\nValueViewMedia";
//define the headers we want passed. Note that they are separated with \r\n
	$headers = "From: publishers@valueviewmedia.com\r\nReply-To: publishers@valueviewmedia.com";
//send the email
	$mail_sent = @mail( $to, $subject, $message, $headers );

		$fs = fopen("publisherapps.csv","a");
		fwrite($fs,$varpublishername . ", " . $varpublisheremail . ", " . $varwebsitename . ", " . $varwebsiteurl . ", " . $varuniqueviews . ", " . $varrawviews . ", " . $varwebsitedescription . ", " . $refid . "\n");
		fclose($fs);
		
		header("Location: /publishers/success/");
		exit;
	}
}
?>

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" href="/style.css" rel="stylesheet">
		<link type="text/css" href="/publishers/apply/applystyle.css" rel="stylesheet">
		<meta content="width=device-width, initial-scale=1.0" name="viewport">
		<title>Publisher Application</title>
		<link rel="icon" type="image/png" href="/vvmfavicon16.png">
	</head>
	<body>
		<div id="headerWrapper">
			<div id="header">
				<div id="networkname">
					<h1><a href="/"><img alt="ValueViewMedia" src="/valueviewmedia.png"></a></h1>
				</div>
				<nav class="topbar" id="usernav">
					<ul>
						<li class="menu"><a class="menu" name="Settings" title="Log in to your ValueViewMedia Publisher or Advertiser account." href="http://manage.valueviewmedia.com/">Log in</a></li>
						<li><a title="Talk with a support representative." href="/contactus/">Contact Us</a></li>
					</ul>
				</nav>
			</div>
		</div>
		<div class="navtabsWrapper">
			<nav id="navtabs">
				<ul>
					<li id="tab-dashboard"><a title="Home Page." href="/">Home</a></li>
					<li id="tab-campaigns" class="selected"><a title="Information on becoming a ValueViewMedia Publisher." href="/publishers/">Publishers</a></li>
					<li id="tab-sites"><a title="Learn about advertising on the ValueViewMedia network." href="/advertisers/">Advertisers</a></li>
				</ul>
			</nav>
		</div>
		<div class="imageNavContainer">
		</div>
		<div id="maincontent">
			<div class="contentHeader">
				<h2>Publisher Application</h2>
			</div>
			<div class="applicationcontainer">
				<?php
					if(!empty($errorMessage)) 
					{
						echo("<div class='errormessages'>\n");
						echo("<p>There was an error with your application:</p>\n");
						echo("<ul>" . $errorMessage . "</ul>\n");
						echo("</div>\n");
					} 
				?>
				<div id="stylized" class="myform">
					<form id="form" name="form" method="post" action="#">
					<input type="hidden" name="msoft" value="junk">
					<h1>Please fill out the form below.</h1>
					<p>After you submit this form, a ValueViewMedia representative will review your website(s), and email you within 48 hours to discuss the results and help you get started with our network.</p>
					<label>Full Name
						<span class="small">First Name Last Name</span>
					</label>
					<input type="text" value="<?php echo $varpublishername; ?>" name="publishername" id="publishername" />
					<label>Email Address
						<span class="small">This is how we will contact you</span>
					</label>
					<input type="text" value="<?php echo $varpublisheremail; ?>" name="publisheremail" id="publisheremail" />
					<label>Company Name
						<span class="small">Leave blank if you are not representing a company</span>
					</label>
					<input type="text" name="publishercompanyname" id="publishercompanyname" />
					<label>Website Name
						<span class="small">Title of your website</span>
					</label>
					<input type="text" value="<?php echo $varwebsitename; ?>" name="websitename" id="websitename" />
					<div class="helpicon">
						<div class="help">
							<img src="/help.png">
							<div>
								This information will not be used to market your site, so please do not load it with keywords. If you have multiple sites, you can separate the titles using a backslash /.
							</div>
						</div>
					</div>
					<label>Website URL
						<span class="small">http://example.com</span>
					</label>
					<input type="text" value="<?php echo $varwebsiteurl; ?>" name="websiteurl" id="websiteurl" />
					<div class="helpicon">
						<div class="help">
							<img src="/help.png">
							<div>
								If you have multiple websites, you can separate them using a backslash /.
								Example: http://example.com  /  http://other.com
							</div>
						</div>
					</div>
					<label>Unique Visitors Per Month
						<span class="small">Your average unique views</span>
					</label>
					<input type="text" value="<?php echo $varuniqueviews; ?>" name="uniqueviews" id="uniqueviews" />
					<div class="helpicon">
						<div class="help">
							<img src="/help.png">
							<div>
								If you have multiple websites, please list your site's URL and then the views for that site. Then list your next website's URL and list the views for that site. Example: example.com 22000 other.com 15000
							</div>
						</div>
					</div>
					<label>Raw Impressions Per Month
						<span class="small">Your average overall impressions per month</span>
					</label>
					<input type="text" value="<?php echo $varrawviews; ?>" name="rawviews" id="rawviews" />
					<label>Website Description
						<span class="small">Describe your website to us</span>
					</label>
					<textarea type="text" value="<?php echo $varwebsitedescription; ?>" rows=5 name="websitedescription" id="websitedescription"></textarea>
					<div class="submitcenter">
						<input class="submitappbutton" type="submit" name="pubformsubmit" value="Submit" />
					</div>
					<div class="spacer"></div>
					</form>
				</div>
				<div class="footerx">
					<a href="/privacypolicy/">Privacy Policy</a>
					<a style="margin-left:60px;margin-right:60px;" href="/termsofservice/">Terms of Service</a>
					<a href="/contactus/">Contact Us</a>
					<a style="margin-left:60px;" href="/ourphilosophy/">Our Philosophy</a>
					<div class="copyrightx">Copyright &copy; 2013, Value View Media Inc.</div>
				</div>
			</div>
		</div>
	</body>
</html>

Last edited by njfail; 02-01-2013 at 12:48 AM..
njfail is offline   Reply With Quote