Jump to content

[Ajuda] SQL GET


valascus
 Share

Recommended Posts

No código base do amxbans, la página admins_list, tenho: $admins=sql_get_amxadmins_list();

Eu queria alterar isso de forma a que, dentro disso, ele vá buscar apenas os que tem o valor "c na linha "flags".

Como é que faço isso?

Edited by valascus
Link to comment
Share on other sites

Boas,

não faço ideia do que se trata, mas procurando pelo código dessa função, encontrei isto:

function sql_get_amxadmins_list() 
{
   global $config;
   $query = mysql_query("SELECT * FROM `".$config->db_prefix."_amxadmins` WHERE `ashow`=1 AND (`expired`=0 OR `expired`>UNIX_TIMESTAMP()) ORDER BY `expired`,`access` DESC,`username` ASC") or die (mysql_error());
   $admins=array();
   while($result = mysql_fetch_object($query)) 
   {
       if(!empty($result->steamid)) 
       {
           $steamid = htmlentities($result->steamid, ENT_QUOTES);
           $steamcomid = GetFriendId($steamid);
       }
   $admin=array(
       "aid"=>$result->id,
       "username"=>html_safe($result->username),
       "comid"=>$steamcomid,
       "password"=>$result->password,
       "access"=>$result->access,
       "flags"=>$result->flags,
       "steamid"=>$result->steamid,
       "nickname"=>html_safe($result->nickname),
       "ashow"=>$result->ashow,
       "created"=>$result->created,
       "expired"=>$result->expired,
       "days"=>$result->days
       );
       $admins[]=$admin;
   }
   return $admins;
}

Caso seja a função a que te referes e caso flags se refira a um nome de um campo da tabela amxadmins e seja alfanumérico, provavelmente bastará alterar a linha do select para ter algo assim (não testado):

$query = mysql_query("SELECT * FROM ".$config->db_prefix."_amxadmins WHERE flags like '%c%' and ashow=1 AND (expired=0 OR expired>UNIX_TIMESTAMP()) ORDER BY expired,access DESC,username ASC") or die (mysql_error());
Link to comment
Share on other sites

Não, não é isso.

O código é:

session_start();
require_once("include/config.inc.php");
require_once("include/access.inc.php");
require_once("include/menu.inc.php");
require_once("include/steam.inc.php");
require_once("include/sql.inc.php");
require_once("include/logfunc.inc.php");
require_once("include/functions.inc.php");
// Template generieren
$title = "_TITLEADMINLIST";
$smarty = new dynamicPage;
//get all amxadmins
$admins=sql_get_amxadmins_list();
$smarty->assign("admins",$admins);
$smarty->assign("meta","");
$smarty->assign("title",$title);
$smarty->assign("version_web",$config->v_web);
// amxbans.css available in design? if not, take default one.
if(file_exists("templates/".$config->design."/amxbans.css")) {
$smarty->assign("design",$config->design);
}
$smarty->assign("dir",$config->document_root);
$smarty->assign("this",$_SERVER['PHP_SELF']);
$smarty->assign("menu",$menu);
$smarty->assign("banner",$config->banner);
$smarty->assign("banner_url",$config->banner_url);
$smarty->display('main_header.tpl');
$smarty->display('admin_list.tpl');
$smarty->display('main_footer.tpl');
?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.