Jump to content
MakeWebGames

Recommended Posts

Posted

Re: TownView [$5]

Updated LostOnes post.

 

<?php

require("globals.php");

$query = mysql_query(
sprintf("SELECT `userid` FROM `users` WHERE (`location` = %u)",
$ir['location']));

$p = mysql_num_row($query);
$pages= abs(@intval(( ($p / 10) + 1 ));

if ($p % 10 == 0) { $pages--; }
echo '	<center>
<form action="'.$_SERVER['PHP_SELF'].'" method="POST">Page:<select name="page">'; // Pages
while ($pages = mysql_fetch_object($query)) {

for($i=1; $i <= $pages; $i++)
{
$pa = ($i-1) * 10;
echo '<option value="'.$pa.'">'.$pa.'</option>';
}

}
echo '</select><input type="submit" name="submit" value="Go To!" /></form>
</center><table width="80%">
		<tr>
			<th width="33%">Name</th>
			<th>Level</th>
			<th>Money</th>
			<th>Gender</th>
			<th>Online?</th>
			<th>In Jail?</th>
			<th>In Hosp?</th>
			<th width="33%">Attack?</th>
		</tr>';


$pag = abs(@intval($_POST['page']));
$limit_a = 0;
$limit_b = 10;
if (isset($_POST['page'])) { $limit_a = $_POST['page'] * 10; 
$limit_b = $limit_a + 10; }
$this_q = sprintf('SELECT username,userid,level,money,gender,laston,hospital,jail FROM `users` WHERE `location` = ("%u") ORDER BY userid ASC LIMIT %u , %u', 
$ir['location'],
$limit_a,
$limit_b);
$this_qu = mysql_query($this_q) or die (mysql_error());
if(!mysql_num_rows($this_qu))
{
	echo 'You are the only person in this location';
}
else
{
	while($ud = mysql_fetch_object($this_qu)) {
	if ($ud->laston > unix_timestamp()-15*60) { $status = 'Online'; } else { $status = 'Offline'; }
	if ($ud->jail > 0) { $jail = 'Yes'; } else { $jail = 'No'; }
	if ($ud->hospital > 0) { $hosp = 'Yes'; } else { $hosp = 'No'; }
	echo '	<tr>
				<td>' . $ud->username . ' [' . $ud->userid . ']</td>
				<td>' . number_format($ud->level, "") . '</td>
				<td>'. money_formatter($ud->money) .'</td>
				<td>'. $ud->gender .'</td>
				<td>'. $status .'</td>
				<td>'. $jail .'</td>
				<td>'. $hosp .'</td>';
				if ($hosp == 'No' || $jail == 'No') { echo 'Not attackable'; } else {
				echo '<td>[url="attack.php?ID=' . $ud->userid . '"]Attack[/url]</td>'; }
			echo '</tr>';
	}				
}
echo '</table>';

$h->endpage();

?>

 

(Not tested, will happily fix errors)

Posted

Re: TownView [$5]

 

Updated LostOnes post.

 

<?php

require("globals.php");

$query = mysql_query(
sprintf("SELECT `userid` FROM `users` WHERE (`location` = %u)",
$ir['location']));

$p = mysql_num_row($query);
$pages= abs(@intval(( ($p / 10) + 1 ));

if ($p % 10 == 0) { $pages--; }
echo '	<center>
<form action="'.$_SERVER['PHP_SELF'].'" method="POST">Page:<select name="page">'; // Pages
while ($pages = mysql_fetch_object($query)) {

for($i=1; $i <= $pages; $i++)
{
$pa = ($i-1) * 10;
echo '<option value="'.$pa.'">'.$pa.'</option>';
}

}
echo '</select><input type="submit" name="submit" value="Go To!" /></form>
</center><table width="80%">
		<tr>
			<th width="33%">Name</th>
			<th>Level</th>
			<th>Money</th>
			<th>Gender</th>
			<th>Online?</th>
			<th>In Jail?</th>
			<th>In Hosp?</th>
			<th width="33%">Attack?</th>
		</tr>';


$pag = abs(@intval($_POST['page']));
$limit_a = 0;
$limit_b = 10;
if (isset($_POST['page'])) { $limit_a = $_POST['page'] * 10; 
$limit_b = $limit_a + 10; }
$this_q = sprintf('SELECT username,userid,level,money,gender,laston,hospital,jail FROM `users` WHERE `location` = ("%u") ORDER BY userid ASC LIMIT %u , %u', 
$ir['location'],
$limit_a,
$limit_b);
$this_qu = mysql_query($this_q) or die (mysql_error());
if(!mysql_num_rows($this_qu))
{
	echo 'You are the only person in this location';
}
else
{
	while($ud = mysql_fetch_object($this_qu)) {
	if ($ud->laston > unix_timestamp()-15*60) { $status = 'Online'; } else { $status = 'Offline'; }
	if ($ud->jail > 0) { $jail = 'Yes'; } else { $jail = 'No'; }
	if ($ud->hospital > 0) { $hosp = 'Yes'; } else { $hosp = 'No'; }
	echo '	<tr>
				<td>' . $ud->username . ' [' . $ud->userid . ']</td>
				<td>' . number_format($ud->level, "") . '</td>
				<td>'. money_formatter($ud->money) .'</td>
				<td>'. $ud->gender .'</td>
				<td>'. $status .'</td>
				<td>'. $jail .'</td>
				<td>'. $hosp .'</td>';
				if ($hosp == 'No' || $jail == 'No') { echo 'Not attackable'; } else {
				echo '<td>[url="attack.php?ID=' . $ud->userid . '"]Attack[/url]</td>'; }
			echo '</tr>';
	}				
}
echo '</table>';

$h->endpage();

?>

 

(Not tested, will happily fix errors)

 

hahahaha lol

Posted

Re: TownView [$5]

 

Do you all have to be jackass's?

Btw iso, nice try but i see your's has more lines than mine xD

But stil does the same job :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...