2011-05-04 15:53:26 +02:00
< ? php
2025-03-05 11:28:53 +01:00
namespace Adminer ;
2012-08-19 23:25:23 -07:00
if ( $_GET [ " script " ] == " kill " ) {
2014-11-24 18:17:43 -08:00
$connection -> query ( " KILL " . number ( $_POST [ " kill " ]));
2012-08-19 23:25:23 -07:00
2018-02-19 23:04:27 +01:00
} elseif ( list ( $table , $id , $name ) = $adminer -> _foreignColumn ( column_foreign_keys ( $_GET [ " source " ]), $_GET [ " field " ])) { // complete
2013-05-23 18:31:48 -07:00
$limit = 11 ;
2013-07-24 16:26:41 -07:00
$result = $connection -> query ( " SELECT $id , $name FROM " . table ( $table ) . " WHERE " . ( preg_match ( '~^[0-9]+$~' , $_GET [ " value " ]) ? " $id = $_GET[value] OR " : " " ) . " $name LIKE " . q ( " $_GET[value] % " ) . " ORDER BY 2 LIMIT $limit " );
2013-05-23 18:31:48 -07:00
for ( $i = 1 ; ( $row = $result -> fetch_row ()) && $i < $limit ; $i ++ ) {
2011-05-04 15:53:26 +02:00
echo " <a href=' " . h ( ME . " edit= " . urlencode ( $table ) . " &where " . urlencode ( " [ " . bracket_escape ( idf_unescape ( $id )) . " ] " ) . " = " . urlencode ( $row [ 0 ])) . " '> " . h ( $row [ 1 ]) . " </a><br> \n " ;
}
2013-05-23 18:31:48 -07:00
if ( $row ) {
2011-05-04 15:53:26 +02:00
echo " ... \n " ;
}
}
exit ; // don't print footer