Building a Simple Affiliate System in PHP/MySQL - Your Index Page (
Page 4 of 6 )
Create a page called "index.php." This page serves as your introduction to your affiliate site.
<?
include("common.php");
include("header.php");
?>
<P>Sign up here to be one of our affiliates. Earn $<?=number_format($affpay,2)?> for each sale you
generate.</P>
<ul>
<li><a href='account.php'>Login To Your Account</a>
<li><a href='join.php'>Sign Up For An Account</a>
</ul>
<?
include("footer.php");
?>
Letting Affiliates Join
One of the first things you need to do is let your affiliates sign up.
Create a file called "join.php":
<?
include("common.php");
include("header.php");
$step = isset($_POST['step']) ? $_POST['step'] : 1;
switch ($step){
case '2':
// add affiliate to the DB
$aid = AffiliateAdd();
if( $aid ){
echo "Thank you for signing up. You can now log in to your account<br>";
echo "<a href='account.php'>Login Here</a><br/>";
}
break;
default:
?>
<table>
<form method="POST">
<input type='hidden' name='step' value='2'>
<?
foreach($affiliateForm as $field=>$info){
echo "<tr>";
if( !empty($info[0]) ){
echo "<td valign=top>{$info[0]}</td>";
}
echo "<td valign=top>";
switch($info[1]){
case "hidden":
echo "<input type='hidden' name='{$field}' value='{$info[2]}'>";
break;
case "password":
echo "<input type='password' name='{$field}' value=''>";
break;
case "text":
echo "<input type='text' name='{$field}' value='{$info[2]}'>";
break;
case "textarea":
echo "<textarea name='{$field}' rows=5 cols=25>{$info[2]}</textarea>";
break;
case "select":
$info[2] = explode("|",$info[2]);
echo "<select name='{$field}'>";
foreach($info[2] as $k=>$v){
echo "<option>{$v}</option>";
}
echo "</select>";
break;
}
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td colspan=2><input type='submit' value='Save'></td>
</tr>
</form>
</table>
<?
break;
}
include("footer.php");
?>
| | Discuss Building a Simple Affiliate System in PHP/MySQL | | | | | | | When I saw the headline, I was quite anxious to read this article. Unfortunately,... | | | | | | We are sorry to hear that you found the article disappointing. I am contacting the... | | | | | | Well, The article is about building a simple affiliate system. Which is what it... | | | | | | Hi. DevShed is all about open source programming. This article explores the... | | | | | | This article was entirely appropriate. I mean if it was about inventory tracking... | | | | | | Hello All,
A big thanks to the author for taking time to write this... | | | | | | There was a slight bad there when they inserted the article into the system... | | | | | | Thanks! I'll let ya know how I make out!
MrsDelley | | | | | | and what is this:
Parse error: parse error, unexpected ';' in... | | | | | | sorry i am blind today, although it is an error.
for those who may ask this Q... | | | | | | one more Qurestion i have;
What is this: <img src="/affiliates/sale.php">.... | | | | | | I keep getting this error message:
Warning: mysql_query(): supplied argument is... | | | | | | hi, first of all thanks for sharing this nice script. it seems to do exactly what i... | | | | | | scrap my last comment, i should be logging into manage.php not accesscotrol.php.... | | | | | | Its a very nice script.:)
Some notes from the comments that could be updated to... | | | | | | I get the same exact error message. Could someone shed some light on the solution... | | | | | | I get alot of these errors:
Warning: mysql_query(): supplied argument is not a... | | | | | | Hi There,
this script in common.php:
list($pending_total) = mysql_fetch_row(... | | | | | | I have gone through each page and created all the files. Needless to say, there is a... | | | | | | You access your MySQL database through a program called PHPMyAdmin. It should be... | | | | | | Hi to the Poster above,
I did eventually figure out how to upload the tables as... | | | | | | Hi, I'm have 2 problems at the moment with the system, although I see it will be... | | | | | | These scripts are broken and make a mess. | | | | | | have some one this script to work perfectly?
my yahoo messenger is edifice28 | | | | | | >>> Post your comment now! | | | | | |
|
 |