<?
//user query
$qa = mysql_query("SELECT * FROM site_log WHERE ip='$ip'") or die('error finding user (engine.php @ nether) '.mysql_error());
while ($list = mysql_fetch_object($qa)) {
$ra = mysql_num_rows($qa);
if ($ra >= 1) {
//this happens
$d = "<div id='bulletin'>Welcome to my blog <b>$list->user</b>! Most likely you got suckered into clicking on that link in my profile. As a result I now know your social security number, where you live and what you did last summer. Kidding. Below are my blog entries for the last couple weeks. Enjoy (oh to get rid of this message refresh or click on a link).</div>";
} else {
//this never happens
$d = "<div id='bulletin'>Welcome to my blog! Below are my blog entries for the last couple weeks. They aren't that exciting so feel free to check out another part of the site (oh to get rid of this message refresh or click on a link).</div>";
}
}
//check the number of users online
$qw = mysql_query("SELECT * FROM users_online") or die('error finding users (engine.php @ nether) '.mysql_error());
$rw = mysql_num_rows($qw);
//delete users online
$qd = mysql_query("DELETE FROM users_online WHERE time<$time_left") or die('error deleting user (engine.php @ nether) '.mysql_error());
//find users online that match a certain ip
$q = mysql_query("SELECT * FROM users_online WHERE ip='$ip'") or die('error finding ip (engine.php @ nether) '.mysql_error());
$r = mysql_num_rows($q);
if ($rw > 2500) {
echo "<div id='invalid'>Danger, Will Robinson! There are currently $rw users online! Certain site features are now disabled to cope with the load.</div>";
$u = mysql_query("UPDATE site_settings SET users_online='off', status='off'") or die('error updating site settings (engine.php @ nether) '.mysql_error());
}
elseif ($_GET['page'] == 'in') {
}
elseif (($_GET['page'] == 'blog') && ($r == 0) && ($rw < 3000)) {
echo "$d";
$i = mysql_query("INSERT INTO users_online (ip,time,id) VALUES ('$ip','$time','NULL')") or die('error inserting user (engine.php @ nether) '.mysql_error());
}
elseif ($r == 0 AND $rw < 3000) {
echo "<div id='bulletin'>Welcome to zealivityfive.com! Currently I'm looking for new affiliates so make sure to check out the <a href='?page=affiliate'>affiliate section</a> which can be found under the section labeled connect. Any questions, comments or suggestions regarding the site can be directed to my contact page. To make this bulletin disappear simply refresh.</div>";
$i = mysql_query("INSERT INTO users_online (ip,time,id) VALUES ('$ip','$time','NULL')") or die('error inserting user (engine.php @ nether) '.mysql_error());
}
?>
problem with script
Started by fiv3isaliv3, Jan 17 2006 10:36 PM
2 replies to this topic
#1
Posted 17 January 2006 - 10:36 PM
been staring at the code for this for awhile... not sure why a part of isn't working. when i say it isn't working it isn't giving an error it just isn't echoing. i've moved stuff around and done the if statements several different ways. EVERYTHING works except for where i commented in the code and said this never happens. if a variable isn't defined i defined it on another page. appreciate any help or suggestions. thanks!
#2
Posted 17 January 2006 - 10:59 PM
I think you are trying to echo out $d if I'm correct, I searched and there is no where in that script that echoes out $d.
Edit, I found the $d
Try putting random echoes in places of the script to determine what part it is hitting.
Edit, I found the $d
Try putting random echoes in places of the script to determine what part it is hitting.
Edited by HaloprO, 17 January 2006 - 11:00 PM.
#3
Posted 19 January 2006 - 04:49 PM
I had already tried sticking a few echos in there to see what was going on. That didn't help. Figured it out though.
Works now.
$qa = mysql_query("SELECT * FROM site_log WHERE ip='$ip'") or die('error finding user (engine.php @ nether) '.mysql_error());
while ($list = mysql_fetch_object($qa)) {
$user = "$list->user";
}
$ra = mysql_num_rows($qa);
if ($ra >= 1 AND $_GET['page'] == 'blog') {
//this will happen
}
elseif ($ra == 0 AND $_GET['page'] == 'blog') {
//then this will happen
}
Works now.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
