Location: PHPKode > projects > Modular Site Manager > htdocs/content/AffApply.php
<?php 
if (!isset($_POST['submit']) ) {
?>
<h3 style="text-align:center;">Become an Affiliate:</h3>
<fieldset>
<form action="http://www.vouksh.info/v5/AffApply" method="post"> 
<div class="formtext">Your site name:</div>
<div class="formdiv"><input type="text" name="sitename" /></div>
<div class="formtext">Your name:</div>
<div class="formdiv"><input type="text" name="webmaster" /></div>
<div class="formtext">Site address:</div>
<div class="formdiv"><input type="text" name="address" value="http://www." /></div>
<div class="formtext">Button URL</div>
<div class="formdiv"><input type="text" name="button" value="http://www." /></div>
<div class="formtext">Contact email:</div>
<div class="formdiv"><input type="text" name="contact" /></div>
<div style="text-align:center"><br /> 
My Button<br />
<img src="http://www.vouksh.info/buttons/vouksh-info.gif" alt="Vouksh.info Button" /><br />
http://www.vouksh.info/buttons/vouksh-info.gif
</div>
<div class="buttondiv"><input type="submit" value="Submit" name="submit" />&nbsp;&nbsp;<input type="reset" name="reset" value="Reset" /></div>
</form>
</fieldset>
<?php
} else { 
	$sitename = htmlspecialchars(addslashes($_POST['sitename']));
	$webmaster = addslashes($_POST['webmaster']);
	$address = addslashes($_POST['address']);
	$button = addslashes($_POST['button']);
	$contact = addslashes($_POST['contact']);
	$date = date('F jS, Y'); 
	$ip = $_SERVER['REMOTE_ADDR']; 
	$size = @getimagesize($button);
	$width = $size[0];
	$height = $size[1];
	if (empty($width)) {
		$width = 0;
	}
	if (empty($height)) {
		$height = 0;
	}
	if (empty($sitename) or empty($webmaster) or empty($address) or empty($button) or empty($contact))
	{ 
		echo '<div class="error">Error: You forgot some info</div>';
		exit();
	}
	if ($width !== 88 or $height !== 31) 
	{ 
		echo('<div class="error">Error: Your button <em>must</em> be 88x31 pixels in size.</div>'); 
		exit();
	}
	$mysql = new mysql(DB_MAIN);
	$sql = $mysql->insert(PRE."affiliates", array("sitename", "webmaster", "address", "button", "submitdate", "ip", "status", "contact"), array($sitename, $webmaster, $address, $button, $date, $ip, 'pending', $contact));
	$bleh = $mysql->select(PRE."affiliates", NULL, "id", "DESC", "1");
	while($rows = mysql_fetch_array($bleh))
	{ 
		$ids= $rows['id']; 
	}
	echo('<div style="text-align: center;">You\'ve successfully submitted the following information to our site on '.$date.', please wait for an administrator to add you as an affiliate');
	echo('Here is the information you submitted:');
	echo('<table style="text-align: center width: 400px border: 1px solid #000;">
		<tr>
			<td>Your site name:</td>
			<td>'.$sitename.'</td>
		</tr>
		<tr>
			<td>Your name:</td>
			<td>'.$webmaster.'</td>
		</tr>
		<tr>
			<td>Site address:</td>
			<td>'.$address.'</td>
		</tr>
		<tr>
			<td>Your affiliate button (88x31):</td>
			<td><img src="'.$button.'" alt="" /></td>
		</tr>
		<tr>
			<td>Contact email:</td>
			<td>'.$contact.'</td>
		</tr>
		<tr>
			<td>Your Link:</td>
			<td>http://www.vouksh.info/in.php?id='.$ids.'</td>
		</tr>
	</table>
</div>');
	//This part is optional, it will email you every time someone submits their site
	$header = "FROM: ".$webmaster." <".$contact.">\nContent-Type: text/html;";
	mail("hide@address.com", "New Affiliate Request", '<table align="center" width="400" border=1 bordercolor="black"><tr><td>Your site name:</td><td>'.$sitename.'</td></tr><tr><td>Your name:</td><td>'.$webmaster.'</td></tr><tr><td>Site address:</td><td>'.$address.'</td></tr><tr><td>Your affiliate button (88x31):</td><td><img src="'.$button.'" border=0></td></tr><tr><td>Contact email:</td><td>'.$contact.'</td></tr></table>', $header);
}
?>
Return current item: Modular Site Manager