Location: PHPKode > projects > QuickTalk Forum > quicktalk/qtf_j_name.php
<?php



// QuickTalk 2.5 build:20100924



if ( !isset($_GET['q']) ) return;

if ( empty($_GET['q']) ) return;



$strRole = ''; if ( isset($_GET['r']) ) $strRole = strtoupper($_GET['r']);

if ( $strRole=='A' ) $strRole = 'role="A" AND ';

if ( $strRole=='M' ) $strRole = '(role="A" OR role="M") AND ';



$arrValue = array();



include('bin/qt_lib_db.php');

include('bin/config.php');



// query



$oDBAJAX = new cDB($qtf_dbsystem,$qtf_host,$qtf_database,$qtf_user,$qtf_pwd,$qtf_port,$qtf_dsn);

if ( !empty($oDBAJAX->error) ) return;



$oDBAJAX->Query('SELECT name FROM '.$qtf_prefix.'qtauser WHERE '.$strRole.' UPPER(name) like "%'.addslashes(strtoupper($_GET['q'])).'%"');



$i=0;

while($row=$oDBAJAX->GetRow())

{

  if ( !in_array($row['name'],$arrValue) )

  {

    $arrValue[$i]=$row['name'];

    $i++;    

  }

  if ( $i>9 ) break;

}

if ( count($arrValue)==0 ) return;



foreach($arrValue as $strKey=>$strValue)

{

  echo "$strValue\n";

}



?>
Return current item: QuickTalk Forum