If you need an idea of what I'm talking about, go to:
www.daobux.com
Login: phphelper
Pass: 123456
Click on Surf
Right now, I have about 10 websites inside my database that should be active. However, there are only 4 different websites being shown.
Here is all the code I have.
// surf.php //
Code: Select all
<?php
session_start();
include('inc/connect.php');
// Select a Random Website
$sitequery = "SELECT users.id, users.credits, users.username, websites.id, websites.url, websites.userid, websites.active
FROM users JOIN websites ON websites.userid = users.id
where websites.active='y' and users.credits > 0 and websites.userid != ".$_SESSION['userid']." order by rand() LIMIT 1";
$siteresult = mysql_query($sitequery) or die("Error in query: $sitequery. " . mysql_error());
if (mysql_num_rows($siteresult) != 0){
$siterow = mysql_fetch_array($siteresult);
$url = $siterow["url"];
}
else{
echo 'error';
}
?>
<html>
<head>
<title>My Traffic Exchange</title>
<script>
top.surfbar.location = 'surfbar.php'
top.Site.location = $url;
</script>
</head>
<!-- 68 - 80 pixels high is a good size for surfbar. No more than 100!! -->
<frameset rows="80,*" BORDERCOLOR="#222222" BORDER="3">
<frame src="surfbar.php" name="surfbar" marginwidth="O" marginheight="0" NORESIZE SCROLLING="no" />
<frame src="<?php echo $url ?>" name="Site" marginwidth="O" marginheight="0" noresize scrolling="auto" />
</frameset>
<noframes>
<body><p>Sorry, but your Browser does not support Frames. Please open this page in a new browser.</p></body>
</noframes>
</html>Code: Select all
<?php
session_start();
?>
<html>
<head>
<title>My Traffic Exchange</title>
<link rel="stylesheet" type="text/css" href="styles/surfbar.css" />
<script type="text/javascript">
var time = 10;
function startCountdown(){
var t = setTimeout("countdown()", 1000);
}
function countdown(){
--time;
if(time == 0){
document.getElementById("countdown").innerHTML = "<a href='surf.php'>Next</a>";
}else{
document.getElementById("countdown").innerHTML = time;
var t = setTimeout("countdown()", 1000);
}
}
</script>
</head>
<body onload="startCountdown();" class="surfbar" bgcolor="#333333">
<!-- Surfing Container -->
<div id="container">
<!-- Logo -->
<div id="logo" align="center">
<img src="img/ad.jpg" alt="ptc" width="150" height="48"><br />
<a href="member.php">Members Area</a>
</div>
<!-- Exp -->
<div id="exp" align="center">
<p><strong>Experience:</strong><p>
</div>
<!-- Timer -->
<div id="timer" align="center">
<div id="countdown">10</div>
<p><strong>
Total Surfed: 78<br />
Credits Earned: 78<br />
</strong></p>
</div>
<!-- Bonus -->
<div id="bonus" align="center">
<p><strong>Surf 25 More for <br>a 25 Credit Bonus!</strong></p>
</div>
<!-- Banner -->
<div id="banner" align="center">
<img src="img/ptc.jpg" alt="ptc">
</div>
</div>
</body>
</html>id int(11) No auto_increment
userid int(11) No
url varchar(2083) utf8_general_ci No
credits int(11) No 0
stats int(11) No 0
active tinytext utf8_general_ci No
status text utf8_general_ci No
title varchar(50) utf8_general_ci No
And my rows inside my websites database:
id userid url credits stats active status title
31 1 http://phpacademy.com 1823 0 y php
32 1 http://worldofwarcraft.com 1234567890 0 y World
29 2 http://dixie.edu 82749 0 y Dixie
24 2 http://nbc.com 6354 0 y nbc
23 2 http://abc.com 2 0 y My
25 2 http://youtube.com 1827942 0 y youtube
26 2 http://javaguy.com 0 0 y java
27 2 http://daobux.com 98798042 0 y sdfs
28 2 http://thottbot.com 1234 0 y youtube
33 1 http://bored.com 1823425123 0 y I
34 1 http://facebook.com 123842 0 y Facebook
35 2 http://jokes.com 244 0 y Jokes
36 2 http://godaddy.com 4444 0 y Great
37 0 0 0 y
38 0 http://abc.com 0 0 y
39 2 http://hbo.com 400 0 y HBO
41 2 http://devnetwork.net 456789 0 y dev
45 2 http://yahoo.com 1234 0 y yahoo
Thanks for your time. I appreciate the help