Location: PHPKode > projects > php Strategy Game Engine X > phpsgex/adm/users.php
if( isset($_GET['editusr']) ){ //edit user
	$uid= (int)$_GET['editusr'];
	$usrinf= mysql_fetch_array( mysql_query("SELECT * FROM `users` WHERE `id` =".$uid) );
	$body="<h3>City of ".$usrinf['username']."</h3><table border='0' width='21%'>";
	$qrct= mysql_query("SELECT * FROM `city` WHERE `owner` =".$uid);
	while( $row= mysql_fetch_array($qrct) ){
		$body.=	"<tr> <td>".$row['name']."<td> <td><a href='?pg=users&editcity=".$row['id']."'><img src='../img/icons/b_edit.png'></a></td> </tr>";
} else if( isset($_GET['editcity']) ){ //edit city
	$cid= (int)$_GET['editcity'];
	$cinf= mysql_fetch_array( mysql_query("SELECT * FROM city WHERE id=".$cid) );
	$body="<h3>Modifica città</h3>";
	$body.="<input type='text' name='name' value='".$cinf['name']."'> ";
	$body.="<table border='1'><tr>";
	$resnam= get_resources_name();
	for( $i=1; $i<=count($resnam); $i++) $body.="<td>".$resnam[$i]."</td>";
	//show city res
	$resd= mysql_query("SELECT * FROM resdata");
	while( $ftr= mysql_fetch_array($resd) ){
		$crs= mysql_fetch_array( mysql_query("SELECT * FROM `city_resources` WHERE `city_id` =$cid AND `res_id` =".$ftr['id']) );
		$body.="<td> <input type='text' name='res".$ftr['id']."' value='".$crs['res_quantity']."'> </td>";
} else { //show all users
	$body="<table border='1' width='50%'>";
	$qr= mysql_query("SELECT * FROM `users`");
	while( $row= mysql_fetch_array($qr) ){
		$body.="<tr> <td>".$row['username'];
		if( $row['rank'] >0 ) $body.=" [<font color='#00FF00'>A</font>]";
		$body.="</td> <td>".$row['points']."</td> <td><a href='?pg=users&editusr=".$row['id']."'><img src='../img/icons/b_edit.png'></a></td> </tr>";	
Return current item: php Strategy Game Engine X