Let's not crap out if we don't specify a user, find a random one

This commit is contained in:
Laurent Raufaste 2013-05-12 23:21:15 -04:00
parent fffdb6d566
commit 894877084d
2 changed files with 14 additions and 17 deletions

View File

@ -5,6 +5,13 @@ require("include/libbb.php");
require("recaptchalib.php");
$who = (int)$_GET["who"];
if(!$who) {
$result = mysql_query("SELECT id FROM users");
while($tmp = mysql_fetch_row($result)) {
$ids[]=$tmp[0];
}
$who=$ids[mt_rand(0,count($ids)-1)];
}
$usercustom=$user;
@ -16,14 +23,6 @@ $nbmsg=mysql_result($result,0);
if(!$page) $page=1;
if(!is_numeric($who)) {
$result = mysql_query("SELECT id FROM users");
while($tmp = mysql_fetch_row($result)) {
$ids[]=$tmp[0];
}
$who=$ids[mt_rand(0,count($ids)-1)];
}
$result = mysql_query_debug("SELECT * FROM users WHERE id=".$who);
$user = mysql_fetch_array($result);

View File

@ -4,7 +4,13 @@ require("include/top.php");
require("include/libbb.php");
$who = (int)$_GET["who"];
//$linebypage = $_GET["lines"];
if(!$who) {
$result = mysql_query("SELECT id FROM users");
while($tmp = mysql_fetch_row($result)) {
$ids[]=$tmp[0];
}
$who=$ids[mt_rand(0,count($ids)-1)];
}
$usercustom=$user;
@ -16,14 +22,6 @@ $nbmsg=mysql_result($result,0);
if(!$page) $page=1;
if(!is_numeric($who)) {
$result = mysql_query("SELECT id FROM users");
while($tmp = mysql_fetch_row($result)) {
$ids[]=$tmp[0];
}
$who=$ids[mt_rand(0,count($ids)-1)];
}
$result = mysql_query_debug("SELECT * FROM users WHERE id=".$who);
$user = mysql_fetch_array($result);