Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts

    help with referral tracking code

    Hey guys,
    I'm slowly trying to learn some php, I can mostly just follow along tutorials, as I haven't been able to memorize a lot of the rules and things yet.

    I'd like to have a way for people to refer other people to fill out this form on my site.
    Basically how I plan for it to work, is a user enters their info into the form, submits it, info is appended to csv file. I open csv file and assign a unique id # based on the position in the csv file. Then I'd like them to be able to refer other users based on that id #. And if someone fills out the form using that other person's referral id #, it records that on the csv file.

    So I have some questions with going about this...

    Lets say someone's referral id # is 123. Can I give them a link that says mysite.com/apply.php?refid=123 and then insert the code below into /apply.php, or is there another step?

    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) . '" />';
    }
    
    ?>
    So what the code above should accomplish is:
    • If there is a ref id # in the URL, record it in an invisible field on the form and add the ref id # to a session cookie.
    • If there is no ref id # in the URL, check if there is a session cookie with a ref id #
    • If there is no ref id # in the URL or session, don't add any input.
    • If there is a ref id # in the session, record it in an invisible field on the form.


    Does the code accomplish those things? And are there any problems with the way the codes written?

    Any suggestions or help is appreciated

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    If there is a ref id # in the session, record it in an invisible field on the form.
    Looks like that isn't done, but why do you need it?????

    You are concentrating on the referrer, why? he is not on your site nor is he doing anything on your site at present. It's the current user you need to track. Especially if you have things she can or should do on the site.

    When the new user fills out the form he enters or does not enter a referrer's number. You should write all form info to the file immediately, including the referrer number. That's all you need.

    P.S. This is just for your information:
    Learn how PHP talks to MySQL (a database) or one of your choosing. It's simple and you can get info from it much easier then a cvs file.

  • #3
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    If user2 goes to your site because of a link on user1's web site and leaves you have no information on him. How are you going to know when he comes back? Do you have a login page? Is there anyway you can store his info if he(user2) does not fill out the form.

    If you log everyone that comes to your site from user1 that file will get large and how do you know when to delete them?

    Say user2 comes in from user1 and leaves; comes back 5 times over a three month period and then fills out the form. See what I mean?

    I think you can reward user1 when a person follows his link to your page and you can give out bigger rewards if user2 fills in the form at that time, but keeping records on people that enter via a link and tying them to that link will get out of hand.

    FYI
    Session variables are destroyed when a session ends or times out.
    Before starting an online advertising network learn how to use a database!!

  • #5
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    @Sunfighter I want it to save the session info (refid) for a limited amount of time. I was under the impression that the session ID would expire when the person closes their browser or clears their history?
    All I want is if user2 follows user1's link, and user2 fills out the form, then user1's refid is appended to the entry into the csv file.
    And if user2 views a different page on my site right after following user1's link, it should store user1's refid for a short time so if user2 goes back to the form and fills it out, it still adds user1's refid.

    I tried editing my code some, but I'm getting this error still:
    PHP Warning: Cannot modify header information - headers already sent by (output started at /home/vvm/public_html/publishers/apply/index.php:21) in /home/vvm/public_html/publishers/apply/index.php on line 88



    Also, can anyone help me in deleting the commas, enters, =, -, and other special characters that users can enter that ruin csv files?


    Code:
    <?php
    
    // start refid
    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'];
    }
    
    else {
      // 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) . '" />';
    }
    
    // end refid
    
    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['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="/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">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; 01-31-2013 at 09:04 PM.

  • #6
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    First let me ask you a question, does the site your putting this on give you access to mysql?

    If user2 comes into your site with address that ends in ?refid=123 or some other number this code checks it and sets a cookie OR it see if as cookie exists and if yes reads it and puts into a session variable.

    PHP 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;
        echo 
    $_SESSION["rewards"]; // ONLY here for show
    }
    ?>
    You should be having trouble with the code you published
    , are you?
    Last edited by sunfighter; 01-31-2013 at 09:52 PM.

  • Users who have thanked sunfighter for this post:

    njfail (01-31-2013)

  • #7
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Yes, I do have access to mysql, though I'm not too familiar with mysql.
    I figured the csv file would be simpler, and at least be functional until I can develop a better solution.

    Yes, I am having trouble with the code I published

    Could you help me with integrating your cookie script into my code so its functional?

  • #8
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    Replace your first php section with what I gave you.

    IE does not understand the submit button. In your form use a hidden field. I like
    Code:
    <input type="hidden" name="msoft" value="junk">
    right after the form tag.
    Then use this line in your evaluation code:
    Code:
    if(isset($_POST["msoft"]) && $_POST["msoft"] == 'junk')
    instead of this one:
    Code:
    if($_POST['pubformsubmit'] == "Submit")
    Your input checking just looks to see if the user entered something and not what he entered. You should spend some time on the internet looking up evaluating forms. Lots out there. It's also where you eliminate the commas, enters, =, -, and other special characters that your having problems with. Some of this uses Regex which is hard to master, but easy to copy/paste.

    Here's an updated but not fully correct page:
    PHP 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");
    }
    ?>
    <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<br>
    <span class="small">First Name Last Name</span>
    </label>
    <input type="text" name="publishername" id="publishername" /><br><br>

    <label>Email Address<br>
    <span class="small">This is how we will contact you</span>
    </label>
    <input type="text" name="publisheremail" id="publisheremail" /><br><br>

    <label>Company Name<br>
    <span class="small">Leave blank if you are not representing a company</span>
    </label>
    <input type="text" name="publishercompanyname" id="publishercompanyname" /><br><br>

    <label>Website Name<br>
    <span class="small">Title of your website</span>
    </label>
    <input type="text" name="websitename" id="websitename" /><br><br>

    <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.<br>
    If you have multiple sites, you can separate the titles using a backslash /.
    </div>
    </div>
    </div>

    <label>Website URL<br>
    <span class="small">http://example.com</span>
    </label>
    <input type="text" name="websiteurl" id="websiteurl" /><br><br>

    <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<br>
    <span class="small">Your average unique views</span>
    </label>
    <input type="text" name="uniqueviews" id="uniqueviews"><br><br>

    <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><br>

    <label>Raw Impressions Per Month<br>
    <span class="small">Your average overall impressions per month</span>
    </label>
    <input type="text" name="rawviews" id="rawviews"><br><br>

    <label>Website Description<br>
    <span class="small">Describe your website to us</span>
    </label><br>
    <textarea rows="5" cols="50" name="websitedescription" id="websitedescription"></textarea>

    <div class="submitcenter">
    <input class="submitappbutton" type="submit" name="pubformsubmit" value="Submit"><br>
    </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>
    </body>
    </html>

  • #9
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #10
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    not writing the refid # to the csv file?
    I never did that.
    Add this line in form under the first hidden input:
    Code:
    <input type="hidden" id="refid" name="refid" value="<?php echo $value; ?>">
    At the top of the code add
    Code:
    $value = '';
    right after the line
    Code:
    $_SESSION["rewards"] = '';
    Should do it.

  • #11
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    It seems to only work when I go to the page with the refid link, then visit another page and go back to the form.

    So if you go straight to the refid link and fill out the form, it doesn't record the refid into the csv.

    I tried messing around with the code but nothing I did seems to fix it
    Could you help me with this?

  • #12
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    If you call the form page like this http://www.formpage.php?refid=235
    Then you have an id of 235 and that should be written to the file. If you click on the page or call it with http://www.formpage.php then you did not come from a referencer page and there is no ID.

  • #13
    Regular Coder
    Join Date
    Aug 2010
    Posts
    133
    Thanks
    2
    Thanked 0 Times in 0 Posts
    If you go to the page from example.com/apply/index.php?refid=123
    And you fill out the form, it will not record refid 123.
    However, if you go to example.com/apply/index.php?refid=123
    And then leave the page, and then go back to example.com/apply
    Then it will record refid 123 in the csv when you submit the form.

    I'm not sure why its working like that, is there something I missed?

    I tried adding this code below to the form, and adding $refid to the list of fwrite
    but it did not change anything.
    Code:
    <input type="hidden" id="refid" name="refid" value="<?php echo $refid; ?>" />
    I deleted that since it was not doing anything. This is what I have now:
    PHP Code:
    <?php
    session_start
    ();
     
    $_SESSION["rewards"] = '';
     
    $value '';

    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 ", " $value "\n");
            
    fclose($fs);
            
            
    header("Location: /publishers/success/");
            exit;
        }
    }
    ?>
    Code:
    <!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" />
    					<input type="hidden" id="refidsession" name="refidsession" value="<?php echo $value; ?>" />
    					<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>

    Also I looked up Regex like you suggested
    Do you think this code would remove everything except letters numbers _ and -
    I think those are all the important characters.
    Could you tell me where in my code I should place this?

    PHP Code:
    <?php
    function dataCleasing($data){
    $data strip_tags ($data); // remove HTML Tags
       // remove Incorrect encoding characters
    $data preg_replace('/[^\w-]/'''$data);
    $data str_replace "\n"""$data );//remove Enter
    $data str_replace ","""$data );//remove Comma
    $data str_replace "\t"""$data );//remove TAB
    $data str_replace "\r\n"""$data );//remove Enter
    $data trim($data);
    return 
    $data;
    }
    ?>

    Also, thank you for all the help sunfighter. I greatly appreciate it!

  • #14
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,763
    Thanks
    23
    Thanked 548 Times in 547 Posts
    njfail there is no need to continue this on the forms. I sent you email through the site it's in your "USERCP" The tag to get there is located at the top of the page. Mail sent this PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •