foo bar */ /* dbase shit */ $dbhost = 'localhost'; $dbuser = 'iexperts'; $dbpass = 'w5zMTZx2B9S'; $dbname = 'iexperts'; $dbtable = 'wp_posts'; // ma conectez la baza de date $conn = mysql_connect( $odbc_data_source , $dbuser , $dbpass ) or die("Nu m-am putut conecta la baza de date"); $dbsel = mysql_select_db($dbname , $conn) or die('Nu am putut selecta baza de date '.$dbname); // make a query $query = "SELECT post_title,guid FROM ".$dbtable; // execute the goddamn query $result = mysql_query( $query , $conn ); $input = strtolower( $_GET['input'] ); $len = strlen($input); $aResults = array(); if ($len) { // pentru toate randurile gasite while( $row = mysql_fetch_array($result) ) { $name = $row['post_title']; $link = $row['guid']; if (strtolower(substr(utf8_decode($name),0,$len)) == $input) $aResults[] = array( "value"=>htmlspecialchars($name), "info"=>htmlspecialchars($link) ); } } // free the result mysql_free_result($result); // inchidem conexiunea cu baza de date mysql_close($conn); // generate the goddamn XML header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 if (isset($_REQUEST['json'])) { header("Content-Type: application/json"); echo "{\"results\": ["; $arr = array(); for ($i=0;$i"; for ($i=0;$i"; echo "".$aResults[$i]['info'].""; echo "".$aResults[$i]['value'].""; echo ""; } echo ""; } ?>