Nullified courseimages.php, and made some of the security improvements
[moodle.git] / lib / odbc.php
blobd241322555b0d2cb9a4a93149b0312e938a0dc8c
1 <?php
2 //This is the ODBC Socket Server class PHP client class with sample usage
3 // at bottom.
4 // (c) 1999 Team FXML
5 // Released into the public domain for version 0.90 of ODBC Socket Server
6 // http://odbc.linuxbox.com/
8 class ODBCSocketServer {
9 var $sHostName; //name of the host to connect to
10 var $nPort; //port to connect to
11 var $sConnectionString; //connection string to use
13 //function to parse the SQL
14 function ExecSQL($sSQL) {
16 $fToOpen = fsockopen($this->sHostName, $this->nPort, &$errno, &$errstr, 30);
17 if (!$fToOpen)
19 //contruct error string to return
20 $sReturn = "<?xml version=\"1.0\"?>\r\n<result state=\"failure\">\r\n<error>$errstr</error>\r\n</result>\r\n";
22 else
24 //construct XML to send
25 //search and replace HTML chars in SQL first
26 $sSQL = HTMLSpecialChars($sSQL);
27 $sSend = "<?xml version=\"1.0\"?>\r\n<request>\r\n<connectionstring>$this->sConnectionString</connectionstring>\r\n<sql>$sSQL</sql>\r\n</request>\r\n";
28 //write request
29 fputs($fToOpen, $sSend);
30 //now read response
31 while (!feof($fToOpen))
33 $sReturn = $sReturn . fgets($fToOpen, 128);
35 fclose($fToOpen);
37 return $sReturn;
39 }//class