Hey Guys
Just seeking a little help with this script. I have created it, and now I want to make it so that when the person has 5 referrals, it changes over a part of the script to link to another website
<?php
$code = $_SERVER['REMOTE_ADDR'];
$code = md5($code);
if(file_exists('referrals/' . $code . '.txt'))
{
$referrals = file_get_contents('referrals/' . $code . '.txt');
}
else
{
$referrals = 0;
}
$ips = file_get_contents('ips.txt');
$ips = explode(',',$ips);
if(!in_array($_SERVER['REMOTE_ADDR'],$ips))
{
if(isset($_GET['refcode']))
{
$file = fopen('referrals/' . $code . '.txt','w');
fwrite($file,'0');
fclose($file);
@$refs = file_get_contents('referrals/' . $_GET['refcode'] . '.txt');
$refs++;
$file = fopen('referrals/' . $_GET['refcode'] . '.txt','w');
fwrite($file,$refs);
fclose($file);
$file = fopen('ips.txt','a');
fwrite($file,$_SERVER['REMOTE_ADDR'] . ',');
fclose($file);
}
else
{
$file = fopen('ips.txt','a');
fwrite($file,$_SERVER['REMOTE_ADDR'] . ',');
fclose($file);
}
}
else
{
}
?>
[/code]
<div class="pack">
<a href="javascript:alert('You need <? $var = 5-$referrals; echo $var; ?> more referrals to unlock 1600 Microsoft Points.');" alt="1,600 Points">5 Referals!<br/>
<img src="pack1.gif" border="0" alt="1,600 Points" />
</a>
<br/>
<span>US, UK & EU</span>
</div>
<div class="spacer"></div>
<div class="pack">
<a href="javascript:alert('You need <? $var2 = 10-$referrals; echo $var2; ?> more referrals to unlock 2100 Microsoft Points.');" alt="2,100 Points">10 Referals!<br/>
<img src="pack2.gif" border="0" alt="2,100 Points" />
</a>
<br/>
<span>UK & EU</span>
</div>
<div class="spacer"></div>
<div class="pack">
<a href="javascript:alert('You need <? $var3 = 15-$referrals; echo $var3; ?> more referrals to unlock 4200 Microsoft Points.');" alt="4,200 Points">15 Referals!<br/>
<img src="pack3.gif" border="0" alt="4,200 Points" />
</a>
<br/>
<span>US, UK & EU</span>
</div>
</div>
[/code]
Now code ONE is my PHP script, this makes the referral count work. I have also made the HTML/JS code work so that it counts down how many referrals a person needs to obtain before unlocking the content. But, I want to make the HTML code so that when they have say, 5 referrals, and they click the image, it changes from
<a href="javascript:alert('You need <? $var = 5-$referrals; echo $var; ?> more referrals to unlock 1600 Microsoft Points.');" alt="1,600 Points">5 Referals!<br/>
to the code bwloe
<a href="http://www.website.com" alt="1,600 Points>5 Referrals!<br/>
Can anybody assist me with how I would do this please?
Thanks