06-07-2008, 01:26 PM
hi,
i have advanced the affiliate script.. so i can activate my partners and new partners can send an request
and i must only activate it in the control panel (like the tutorial approve)
1. upload all files from the attachment on your server
2. go to your database control panel (like phpmyadmin) and add this lines over the SQL insert tool
3. add/edit the Templates
(you can use my other script to insert the template over the admin control panel --> http://tutorialms.com/forum/viewtopic.php?f=9&t=182 )
add template affiliates_submit_break
add template affiliates_submit
add template affiliates_list_break
add template affiliates_list_bit (thx to surfnlearn to complete the templates
)
replace template affiliates_bit
4. edit the includes/classes/template.php
search case 'affiliates_bit':
replace the complete part with this code
add after this code the following code to display all tutorials
5. edit the /includes/global.php
search
add below
Online Preview: http://www.webstone.info
i hope it's helpful.
if you find a bug.. please post it
greetz from germany
marcus
i have advanced the affiliate script.. so i can activate my partners and new partners can send an request
and i must only activate it in the control panel (like the tutorial approve)
1. upload all files from the attachment on your server
2. go to your database control panel (like phpmyadmin) and add this lines over the SQL insert tool
Code:
ALTER TABLE `affiliates` ADD `webbi` VARCHAR( 255 ) NOT NULL ;
ALTER TABLE `affiliates` ADD `email` VARCHAR( 255 ) NOT NULL ;
ALTER TABLE `affiliates` ADD `big` VARCHAR( 255 ) NOT NULL ;
ALTER TABLE `affiliates` ADD `small` VARCHAR( 255 ) NOT NULL ;
ALTER TABLE `affiliates` ADD `active` int(1) NOT NULL ;3. add/edit the Templates
(you can use my other script to insert the template over the admin control panel --> http://tutorialms.com/forum/viewtopic.php?f=9&t=182 )
add template affiliates_submit_break
Code:
<div class="thead">
<img src="$config[HTTP_SERVER]images/header_icons/contact.gif" alt="Contact Us"
style="margin-right:10px;" /> <strong>Submit Affiliates</strong>
</div>
<div class="genmcontainer">add template affiliates_submit
Code:
<span class="smalltext">
$messages[submit_result]<span>
<br>
<if condition="$config[MOD_REWRITE_ON] == 1">
<form method="POST" action="$config[HTTP_SERVER]affiliates_submit/">
<else />
<form method="POST" action="$config[HTTP_SERVER]affiliates_submit.php">
</if>
<div class="contact">Website Name:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="name" /></div>
<div style="clear: both;"></div>
<div class="contact">Your Name:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="webbi" /></div>
<div style="clear: both;"></div>
<div class="contact">Your E-mail Address:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="email" /></div>
<div style="clear: both;"></div>
<div class="contact">Your Homepage Adress:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="link" /></div>
<div style="clear: both;"></div>
<div class="contact">Your 88*31 Banner Adress:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="small" /></div>
<div style="clear: both;"></div>
<div class="contact">Your 468*60 Banner Adress:</div>
<div style="float: left;"><input type="text" class="form_styles" size="30" name="big" /></div>
<div style="clear: both;"></div>
<br />
<center><input type="submit" class="form_styles" value="Send" name="submit" /></center>
</form>
</div>add template affiliates_list_break
Code:
<div class="thead">
<img src="$config[HTTP_SERVER]images/header_icons/contact.gif" alt="Contact Us"
style="margin-right:10px;" /> <strong>All Affiliates</strong>
</div>
<div class="genmcontainer">add template affiliates_list_bit (thx to surfnlearn to complete the templates
)Code:
<if condition="$config[MOD_REWRITE_ON] == 1">
<div align="center"><a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank">$affiliates_bit[name]</a><br /><br />
<a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank"><img src="$affiliates_bit[big]" / border="0" alt="$affiliates_bit[name]"></a><br /><br />
Hits In: $affiliates_bit[in] Hits Out: $affiliates_bit[out]<br /><br />
</div>
<else />
<div align="center"><a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank">$affiliates_bit[name]</a><br /><br />
<a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank"><img src="$affiliates_bit[big]" / border="0" alt="$affiliates_bit[name]"></a><br /><br />
Hits In: $affiliates_bit[in] Hits Out: $affiliates_bit[out]<br /><br />
</div>
</if>replace template affiliates_bit
Code:
<if condition="$config[MOD_REWRITE_ON] == 1">
<if condition="$affiliates_bit[row] == 1">
<a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank"><img
src="$affiliates_bit[small]" alt="$affiliates_bit[name]" border="0" height="31" width="88"></a><br>
<else />
<a href="$config[HTTP_SERVER]affiliate_out/$affiliates_bit[id]/" target="_blank"><img
src="$affiliates_bit[small]" alt="$affiliates_bit[name]" border="0" height="31" width="88"></a><br>
</if>
<else />
<if condition="$affiliates_bit[row] == 1">
<a href="$config[HTTP_SERVER]affiliate_out.php?id=$affiliates_bit[id]" target="_blank"><img
src="$affiliates_bit[small]" alt="$affiliates_bit[name]" border="0" height="31" width="88"></a><br>
<else />
<a href="$config[HTTP_SERVER]affiliate_out.php?id=$affiliates_bit[id]" target="_blank"><img
src="$affiliates_bit[small]" alt="$affiliates_bit[name]" border="0" height="31" width="88"></a><br>
</if>
</if>4. edit the includes/classes/template.php
search case 'affiliates_bit':
replace the complete part with this code
Code:
case 'affiliates_bit':
$affiliates_temp_info = mysql_query("SELECT * FROM `affiliates` WHERE active=1") or
die(mysql_error());
if(mysql_num_rows($affiliates_temp_info) == 0) {
return '<span class="smalltext">There are no affiliates.</span>';
}
$i = 0;
while($affiliates_temp_array = mysql_fetch_array($affiliates_temp_info)) {
$affiliates_bit['id'][$i] = $affiliates_temp_array['id'];
$affiliates_bit['name'][$i] = $affiliates_temp_array['name'];
$affiliates_bit['small'][$i] = $affiliates_temp_array['small'];
$affiliates_bit['out'][$i] = $affiliates_temp_array['out'];
$affiliates_bit['showing'][$i] = 0;
$i++;
}
$number_affiliates = count($affiliates_bit['id']);
if($number_affiliates > NUMBER_AFFILIATES_SHOW) {
$entire_bits = '';
$i = 0;
$x = 0;
while($i < NUMBER_AFFILIATES_SHOW) {
$randnum = rand(0, $number_affiliates-1);
$templatecode = $templatecode_bit;
if($affiliates_bit['showing'][$randnum] != 1) {
if(($i+1) == NUMBER_AFFILIATES_SHOW) {
$last_row = 1;
}else{
$last_row = 0;
}
// affiliates_bit vars
$templatecode = preg_replace('/\$affiliates_bit\[id\]/',
$affiliates_bit['id'][$randnum], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[name\]/',
$affiliates_bit['name'][$randnum], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[small\]/',
$affiliates_bit['small'][$randnum], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[out\]/',
$affiliates_bit['out'][$randnum], $templatecode);
$templatecode =
preg_replace('/\$affiliates_bit\[last_row\]/', $last_row, $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[row\]/',
$x, $templatecode);
$affiliates_bit['showing'][$randnum] = 1;
$i++;
if($x == 0) {
$x = 1;
}else{
$x = 0;
}
$templatecode = parse_template($templatecode, 1);
$evald_templatecode = eval('?>'.$templatecode);
$entire_bits .= $evald_templatecode;
}
}
}else{
$entire_bits = '';
$i = 0;
$x = 0;
while($i < $number_affiliates) {
if(($i+1) == $number_affiliates) {
$last_row = 1;
}else{
$last_row = 0;
}
$templatecode = $templatecode_bit;
$templatecode = preg_replace('/\$affiliates_bit\[id\]/',
$affiliates_bit['id'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[name\]/',
$affiliates_bit['name'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[small\]/',
$affiliates_bit['small'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[out\]/',
$affiliates_bit['out'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[last_row\]/',
$last_row, $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[row\]/', $x,
$templatecode);
$i++;
if($x == 0) {
$x = 1;
}else{
$x = 0;
}
$templatecode = parse_template($templatecode, 1);
$evald_templatecode = eval('?>'.$templatecode);
$entire_bits .= $evald_templatecode;
}
}
break;add after this code the following code to display all tutorials
Code:
case 'affiliates_list_bit':
$affiliates_temp_info = mysql_query("SELECT * FROM `affiliates` WHERE active=1") or
die(mysql_error());
if(mysql_num_rows($affiliates_temp_info) == 0) {
return '<span class="smalltext">There are no affiliates.</span>';
}
$i = 0;
while($affiliates_temp_array = mysql_fetch_array($affiliates_temp_info)) {
$affiliates_bit['id'][$i] = $affiliates_temp_array['id'];
$affiliates_bit['name'][$i] = $affiliates_temp_array['name'];
$affiliates_bit['big'][$i] = $affiliates_temp_array['big'];
$affiliates_bit['out'][$i] = $affiliates_temp_array['out'];
$affiliates_bit['in'][$i] = $affiliates_temp_array['in'];
$affiliates_bit['showing'][$i] = 0;
$i++;
}
$number_affiliates = count($affiliates_bit['id']);
$entire_bits = '';
$i = 0;
$x = 0;
while($i < $number_affiliates) {
if(($i+1) == $number_affiliates) {
$last_row = 1;
}else{
$last_row = 0;
}
$templatecode = $templatecode_bit;
$templatecode = preg_replace('/\$affiliates_bit\[id\]/',
$affiliates_bit['id'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[name\]/',
$affiliates_bit['name'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[big\]/',
$affiliates_bit['big'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[in\]/',
$affiliates_bit['in'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[out\]/',
$affiliates_bit['out'][$i], $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[last_row\]/',
$last_row, $templatecode);
$templatecode = preg_replace('/\$affiliates_bit\[row\]/', $x,
$templatecode);
$i++;
if($x == 0) {
$x = 1;
}else{
$x = 0;
}
$templatecode = parse_template($templatecode, 1);
$evald_templatecode = eval('?>'.$templatecode);
$entire_bits .= $evald_templatecode;
}
break;5. edit the /includes/global.php
search
Code:
}elseif (isset($tutorials_page)) {
$glob['title'] = COMPANY_NAME.' - Browse Tutorials';add below
Code:
}elseif (isset($affiliates_page)) {
$glob['title'] = COMPANY_NAME.' - Affiliates';Online Preview: http://www.webstone.info
i hope it's helpful.
if you find a bug.. please post it

greetz from germany
marcus
![[Image: adminnavigationlf2.gif]](http://img256.imageshack.us/img256/3889/adminnavigationlf2.gif)
![[Image: adminaddus5.gif]](http://img256.imageshack.us/img256/2950/adminaddus5.gif)
![[Image: adminmodify2lj8.gif]](http://img256.imageshack.us/img256/4995/adminmodify2lj8.gif)
![[Image: adminmodifycp5.gif]](http://img256.imageshack.us/img256/1285/adminmodifycp5.gif)