I would like to add 20 offers per page and becuase the database is updated daily. i need a way to allow access to other pages so that all offers will be displayed. i was thinking the next / previous function, but my page count can constantly change so im wanting some way of it automatically only having the amount of pages needed to support the amount of offers. normally i can display anywhere from 100-1000+ offers
code:
<?
session_start() ;
$page="offers";
include"header. php";
include"mysql.p hp";
$_GET['out']=strip_tags($_G ET['out']);
$_GET['out']=mysql_real_esc ape_string($_GE T['out']);
if($_GET['out']!="")
{
mysql_query("up date offers set visits=visits+1 where id={$_GET['out']}",$c);
$geturl=mysql_q uery("select * from offers where id={$_GET['out']}",$c);
$out=mysql_fetc h_array($geturl );
print"
<h2>Please wait..</h2>
<p>
<center>
<meta http-equiv=\"refresh \" content=\"2;url ={$out['url']}/&subid1={$ui['username']}\">
Taking you to the offer...<br>
If this page does not change in 2 seconds, <a href=\"{$out['url']}/&subid1={$ui['username']}\">click here</a>.
</center>
</p>
";
include"side.ph p";
include"footer. php";
exit;
}
else
{
$money=0;
$getoffercash=m ysql_query("sel ect * from offers where active=1",$c);
while($oc=mysql _fetch_array($g etoffercash))
{
$money=$money+$ oc['reward'];
}
}
if($_SESSION['loggedin']==1)
{
$refer="<br>Ref er your friends: $siteurl/?ref={$ui['username']}<br>and receive an instant $$refbonus bonus per referral!";
}
else
{
$refer="";
}
?>
<h2>Free Offers</h2>
<p class="post-by"><a href="how.php?r ef=<? print"$ref"; ?>">not sure what to do?</a></p>
<p><center>Poss ible Earnings: $<?=$money;?><? =$refer;?></center></p>
<table width="90%">
<tr>
<th colspan="0" align="center">
Free To Complete
</th>
</tr>
<tr>
<th width="25%">Off er</th>
<th width="10%">Dat e</th>
<th width="45%">Des cription</th>
<th width="10%">Rew ard</th>
<th width="10%">Com pleted?</th>
</tr>
<?
$_GET['offer']=strip_tags($_G ET['offer']);
$_GET['offer']=mysql_real_esc ape_string($_GE T['offer']);
$type="free";
$getoffers=mysq l_query("select * from offers where `type`='$type' and active=1 order by reward desc",$c);
if(mysql_num_ro ws($getoffers)= =0)
{
print"<tr><td colspan=\"3\">T here are currently no free offers available</td></tr>";
}
else
{
while($off=mysq l_fetch_array($ getoffers))
{
$desc=$off['desc'];
$date=$off['date'];
if($_GET['offer']==$off['id'])
{
$color="style=\ "background-color: #a2e250;\"";
$front="<font color=\"black\" ><b>";
$back="</b></font>";
}
else
{
$color="";
$front="";
$back="";
}
if($_SESSION['loggedin']==1)
{
$form="<form class=\"searchf orm2\" action=\"comple ted.php\" method=\"get\"> <input type=\"hidden\" name=\"offer\" value=\"{$off['id']}\"><input type=\"submit\" class=\"button\ " value=\"Done!\" ></form>";
}
else
{
$form="<font color=\"red\">< b>Please Login</b></font>";
}
$checkpend=mysq l_query("select * from pending where offer_id={$off['id']} and user_id='{$_SES SION['userid']}' and denied=0",$c);
$checkcompleted =mysql_query("s elect * from completed where offer_id={$off['id']} and user_id='{$_SES SION['userid']}'",$c);
if(mysql_num_ro ws($checkpend)! =0)
{
$form="<font color=\"orange\ "><b>Pendin g</b></font>";
}
else if(mysql_num_ro ws($checkcomple ted)!=0)
{
$form="<font color=\"green\" ><b>Completed </b></font>";
}
if(mysql_num_ro ws($checkpend)! =0 || mysql_num_rows( $checkcompleted )!=0)
{
$link="$front{$ off['name']}$back";
}
else
{
$link="<a href=\"offers.p hp?out={$off['id']}\" target=\"_blank \" title=\"Availab le in: {$off['countries']}\">$front{$o ff['name']}$back</a>";
}
print"
<tr $color>
<td width=\"100%\"> $link</td>
<td align=\"center\ ">$date</td>
<td align=\"center\ ">$desc</td>
<td align=\"center\ ">$front\${ $off['reward']}$back</font></td>
<td align=\"center\ ">$form</td>
</tr>
";
}
}
?>
</table>
<?
include"side.ph p";
include"footer. php";
?>
code:
<?
session_start() ;
$page="offers";
include"header. php";
include"mysql.p hp";
$_GET['out']=strip_tags($_G ET['out']);
$_GET['out']=mysql_real_esc ape_string($_GE T['out']);
if($_GET['out']!="")
{
mysql_query("up date offers set visits=visits+1 where id={$_GET['out']}",$c);
$geturl=mysql_q uery("select * from offers where id={$_GET['out']}",$c);
$out=mysql_fetc h_array($geturl );
print"
<h2>Please wait..</h2>
<p>
<center>
<meta http-equiv=\"refresh \" content=\"2;url ={$out['url']}/&subid1={$ui['username']}\">
Taking you to the offer...<br>
If this page does not change in 2 seconds, <a href=\"{$out['url']}/&subid1={$ui['username']}\">click here</a>.
</center>
</p>
";
include"side.ph p";
include"footer. php";
exit;
}
else
{
$money=0;
$getoffercash=m ysql_query("sel ect * from offers where active=1",$c);
while($oc=mysql _fetch_array($g etoffercash))
{
$money=$money+$ oc['reward'];
}
}
if($_SESSION['loggedin']==1)
{
$refer="<br>Ref er your friends: $siteurl/?ref={$ui['username']}<br>and receive an instant $$refbonus bonus per referral!";
}
else
{
$refer="";
}
?>
<h2>Free Offers</h2>
<p class="post-by"><a href="how.php?r ef=<? print"$ref"; ?>">not sure what to do?</a></p>
<p><center>Poss ible Earnings: $<?=$money;?><? =$refer;?></center></p>
<table width="90%">
<tr>
<th colspan="0" align="center">
Free To Complete
</th>
</tr>
<tr>
<th width="25%">Off er</th>
<th width="10%">Dat e</th>
<th width="45%">Des cription</th>
<th width="10%">Rew ard</th>
<th width="10%">Com pleted?</th>
</tr>
<?
$_GET['offer']=strip_tags($_G ET['offer']);
$_GET['offer']=mysql_real_esc ape_string($_GE T['offer']);
$type="free";
$getoffers=mysq l_query("select * from offers where `type`='$type' and active=1 order by reward desc",$c);
if(mysql_num_ro ws($getoffers)= =0)
{
print"<tr><td colspan=\"3\">T here are currently no free offers available</td></tr>";
}
else
{
while($off=mysq l_fetch_array($ getoffers))
{
$desc=$off['desc'];
$date=$off['date'];
if($_GET['offer']==$off['id'])
{
$color="style=\ "background-color: #a2e250;\"";
$front="<font color=\"black\" ><b>";
$back="</b></font>";
}
else
{
$color="";
$front="";
$back="";
}
if($_SESSION['loggedin']==1)
{
$form="<form class=\"searchf orm2\" action=\"comple ted.php\" method=\"get\"> <input type=\"hidden\" name=\"offer\" value=\"{$off['id']}\"><input type=\"submit\" class=\"button\ " value=\"Done!\" ></form>";
}
else
{
$form="<font color=\"red\">< b>Please Login</b></font>";
}
$checkpend=mysq l_query("select * from pending where offer_id={$off['id']} and user_id='{$_SES SION['userid']}' and denied=0",$c);
$checkcompleted =mysql_query("s elect * from completed where offer_id={$off['id']} and user_id='{$_SES SION['userid']}'",$c);
if(mysql_num_ro ws($checkpend)! =0)
{
$form="<font color=\"orange\ "><b>Pendin g</b></font>";
}
else if(mysql_num_ro ws($checkcomple ted)!=0)
{
$form="<font color=\"green\" ><b>Completed </b></font>";
}
if(mysql_num_ro ws($checkpend)! =0 || mysql_num_rows( $checkcompleted )!=0)
{
$link="$front{$ off['name']}$back";
}
else
{
$link="<a href=\"offers.p hp?out={$off['id']}\" target=\"_blank \" title=\"Availab le in: {$off['countries']}\">$front{$o ff['name']}$back</a>";
}
print"
<tr $color>
<td width=\"100%\"> $link</td>
<td align=\"center\ ">$date</td>
<td align=\"center\ ">$desc</td>
<td align=\"center\ ">$front\${ $off['reward']}$back</font></td>
<td align=\"center\ ">$form</td>
</tr>
";
}
}
?>
</table>
<?
include"side.ph p";
include"footer. php";
?>
Comment