View Single Post
Old 01-31-2013, 05:24 PM   PM User | #3
njfail
Regular Coder

 
Join Date: Aug 2010
Posts: 125
Thanks: 2
Thanked 0 Times in 0 Posts
njfail is an unknown quantity at this point
I'm starting an online advertising network.
I want to be able to reward people for referring others to my network.

So lets say user1 signs up, gets their refid #, then posts it on their website.
user2 follows that link, and check out my site. closes it out, leaves the computer, and comes back later in the day and signs up.
I don't want user2 to have to fill in user1's refid #.
I'd like user1's refid # to be sent to the csv file with the rest of the form automatically.

I'm not sure why the code above isn't accomplishing that
Could you help me out? Or tell me if I'm confused with something.

I think integrating mysql is a little beyond my level right now. But in the future as I learn more I may try it out.

Edit:
This is the full code:
Code:
<?php session_start();

// See if a refid is being given in the URL
if (strlen($_GET['refid']) > 0) {
  $refid = $_GET['refid'];
}

// If there is no refid in the URL, check the session
elseif (strlen($_SESSION['refid']) > 0) {
  $refid = $_SESSION['refid'];
}


  // Write the current refid to the session.
  // Now, if the user strays away, the session will be checked for the most recent refid
  $_SESSION['refid'] = $refid;
  // Echo an <input> tag for the refid, for the registration form
  echo '<input type="hidden" name="refid" value="' . htmlspecialchars($refid) . '" />';

?>
<?php
if($_POST['pubformsubmit'] == "Submit")
{
	$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['websitedescription']))
	{
		$errorMessage .= "<li>Please enter a description for your website.</li>";
	}
	if(empty($_POST['keywords']))
	{
		$errorMessage .= "<li>Please enter keywords for your website.</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>";
	}

	$varpublishername = $_POST['publishername'];
	$varpublisheremail = $_POST['publisheremail'];
	$varwebsitename = $_POST['websitename'];
	$varwebsiteurl = $_POST['websiteurl'];
	$varwebsitedescription = $_POST['websitedescription'];
	$varkeywords = $_POST['keywords'];
	$varuniqueviews = $_POST['uniqueviews'];
	$varrawviews = $_POST['rawviews'];
	
	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 . ", " . $varwebsitedescription . ", " . $varkeywords . ", " . $varuniqueviews . ", " . $varrawviews . "\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="/publishers/apply/">
					<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">Your website's address</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>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>
					<label>Keywords
						<span class="small">List keywords associated with your website</span>
					</label>
					<textarea type="text" value="<?php echo $varkeywords; ?>" rows=5 name="keywords" id="keywords"></textarea>
					<div class="helpicon">
						<div class="help">
							<img src="/help.png">
							<div>
								We will use this information to evaluate your site and select a category that best fits your content. Please do not put keywords that do not accurately describe your website, as we will search your site for content relating to your keywords.
								If you have multiple websites, please list your website's URL and then enter the keywords for that site, then list your next URL and list the keywords for that site.
							</div>
						</div>
					</div>
					<label>Unique Visitors Per Month
						<span class="small">Your average unique views and data source</span>
					</label>
					<textarea type="text" value="<?php echo $varuniqueviews; ?>" rows=2 name="uniqueviews" id="uniqueviews"></textarea>
					<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 statistics for that site. Then list your next website's URL and list the statistics for that site.
							</div>
						</div>
					</div>
					<label>Raw Impressions Per Month
						<span class="small">Your average overall impressions per month and data source</span>
					</label>
					<textarea type="text" value="<?php echo $varrawviews; ?>" rows=2 name="rawviews" id="rawviews"></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>
And its throwing up this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/vvm/public_html/publishers/apply/index.php:18) in /home/vvm/public_html/publishers/apply/index.php on line 84

Last edited by njfail; 01-31-2013 at 05:46 PM..
njfail is offline   Reply With Quote