Jump to content

newbie01.php

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by newbie01.php

  1. Hi all, I need to be able to test Apache with PHP4 and PHP5 and multiple versions of MySQL. Can anyone please confirm that in this case, I should be installing several combination of the Apache+PHP+MySQL install, i.e. one for PHP4+MySQL4 and one for PHP5+MySQL5? Any advise will be very much appreciated. Thanks in advance.
  2. HI all. I am having problem populating an option box so I inserted some echo commands within the php script, but I can't see the output from the echo commands that am expecting to see on the web page. Can someone please help on why this is not working or whether it should or should not be working? The two echo lines in question are as below: echo 'filename : ' . $filename; echo 'tnsfile : ' . $tnsfile; The filename extension is .html, does it matter and I should change it to a .php? When I changed the filename extension to .php, the echo commands work and I can see the output of the echo commands but it still does not populate the option box. FYI, I copied this code from an existing Apache-PHP install from another server, that one is PHP5 and am trying to get this running on PHP 4. The original one is working alright with the .html extension, that is, it is populating the option box correctly. So I suppose that eliminates the filename extension as the problem. Does it mean it is because of the PHP version? Any response and feedback will be very much appreciated. Thanks in advance. Complete codes below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Oracle Login - TEST</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css">@import url(calendar-green.css);</style> <script type="text/javascript" src="jscalendar-1.0/calendar.js"></script> <script type="text/javascript" src="jscalendar-1.0/lang/calendar-en.js"></script> <script type="text/javascript" src="jscalendar-1.0/calendar-setup.js"></script> </head> <body> <form id="loginForm" name="loginForm" method="POST" action="main.php?ref=0"> <p><strong></strong></p> <table width="100%" border="0"> <tr> <td align="center"><strong><font color="#FF0000" size="6" face="Arial, Helvetica, sans-serif">ORACLE LOGIN TEST PAGE</font></strong></td> </tr> <tr> <td align="center"><font color="#FF0000" face="Arial, Helvetica, sans-serif"><strong>LOGIN PAGE</strong></font></td> </tr> <tr> <td align="center"> </td> </tr> <tr> <td align="center"><table width="100%" border="0" align="center"> <tr> <td width="44%"> </td> <td width="56%"><font color="#FF0000" face="Arial, Helvetica, sans-serif"> </font></td> </tr> <tr> <td align="right">USERNAME</td> <td align="left"><input type="text" name="username" width="150" /></td> </tr> <tr> <td align="right">PASSWORD</td> <td align="left"><input type="password" name="password" width="150" /></td> </tr> <tr> <td align="right">ORACLE SERVICE</td> <td align="left"><select name="sid"> <?php // Kill any previous session. if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } // Finally, destroy the session. session_destroy(); $filename='C:\oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora'; $tnsfile=file_get_contents($filename); echo 'filename : ' . $filename; echo 'tnsfile : ' . $tnsfile; $count=0; $stline=0; $lbrk_count=0; $rbrk_count=0; $pos=0; $trail=0; $tmpstr=""; $line = explode(PHP_EOL,$tnsfile); foreach ($line as $tns) { $str=str_replace(' ','',$tns); $comm=substr_count($str,'#'); if ($comm == 0 and strlen($str) != 0 ) { $tmpstr=$tmpstr . $str; $lbrk_count=substr_count($str,"("); $rbrk_count=substr_count($str,")"); if ($lbrk_count>0 or $rbrk_count>0) { $trail=$trail+$lbrk_count-$rbrk_count; if ($trail==0) { $trail=0; $pos=strpos($tmpstr,"="); echo '<option value=' . substr($tmpstr,0,$pos) .'>' . substr($tmpstr,0,$pos) . '</option>'; $tmpstr=""; } } } $count++; } // echo $count; ?> </select> </td> </tr> <tr> <td> </td> <td align="left"><input name="submit" type="submit" value="Login" /></td> </tr> <tr> <td colspan="2"><font size="2">This page is to test Oracle login.</font></td> </tr> </table></td> </tr> </table> <p><strong><font color="#FF0000" size="6" face="Arial, Helvetica, sans-serif"></font></strong></p> </form> </body> </html> Sample entries from the $tnsfile: TESTDB01 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = world)(PROTOCOL = TCP)(HOST = TEST01)(PORT = 1521)) ) (CONNECT_DATA = (SID = TEST01) ) ) TESTDB02 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = world)(PROTOCOL = TCP)(HOST = TEST01)(PORT = 1521)) ) (CONNECT_DATA = (SID = TEST02) ) ) TESTDB03 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = world)(PROTOCOL = TCP)(HOST = TEST01)(PORT = 1521)) ) (CONNECT_DATA = (SID = TEST03) ) ) The expected entries of the option box is supposedly TESTDB01, TESTDB02, TESTDB04.
  3. Hi dominicd, That is correct, the one am decoding is commented as well in the actual code. That is what I cut-and-paste to the text area as a test. If you paste that to http://www.tareeinternet.com/scripts/byterun.php, you will see the right decoded text. This is what am aiming to do, to have the same decoding script working, sort of. Didn't quite get what you mean about using function b64dck(), is bd_config PHP function? Can you elaborate on that please if you don't mind? Thanks in advance.
  4. Hi, Need some help with the code below please. Am trying to have a PHP script similar to what is on http://www.tareeinternet.com/scripts/byterun.php. I can't seem to get the right decoding function to work correctly, can someone please advise what could be wrong? Thanks in advance. <?php $text_area1 = null; $text_area2 = null; if( isset($_POST['cutnpaste']) || isset($_POST['copynpaste']) || isset($_POST['decode']) ){ $text_area1 = $_POST['text_area1']; $text_area2 = $_POST['text_area2']; if(isset($_POST['cutnpaste'])) { cutnpaste($text_area1, $text_area2); } else if (isset($_POST['copynpaste'])) { copynpaste($text_area1, $text_area2); } else if (isset($_POST['decode'])) { decode($text_area1, $text_area2); } else { //nothing to do } } function copynpaste(&$text_area1, &$text_area2) { $text_area2 = $text_area1; } function cutnpaste(&$text_area1, &$text_area2) { $text_area2 = $text_area1; $text_area1 = null; } //http://www.tareeinternet.com/scripts/byterun.php function decode(&$text_area1, &$text_area2) { /* // $text_area2 = $text_area1; */ //$text_area2 = "TEXTAREA2 should now have the decoded text"; // // TEST 01, 02 and 04 gives the same result // // TEST 01: // This works - hardcoded - sort of - but some decoded text is not correct //$text_area2=base64_decode('Pz48P3BocCANCiAgIC8vIGMybm41Y3QgdDIgZDF0MWIxczUNCmYzbmN0NDJuIGc1dF9jMm5uNWN0NDJuKCQxLCAkYiwkcykgew0KLy8gICBQM3RFbnYoIk9SQUNMRV9TSUQ9IiAuICRjKTsNCi8vNWNoMiAnY3YxbCAnIC4gJHM7DQogICBQM3RFbnYoIlROU19BRE1JTj1EOlwycjFjbDVccHIyZDNjdFw2MC5hLjBcZGJfNlxORVRXT1JLIik7DQogICAkM24xbTUgPSAkMTsNCiAgICRwd2QgPSAkYjsNCiAgICRkYnMgPSAkczsNCi8vICAgJGM9MmM0X2Mybm41Y3QoJDNuMW01LCAkcHdkLCAkYyk7DQogICAgIDRmICghQCgkYz0yYzRfYzJubjVjdCgkM24xbTUsICRwd2QsICRkYnMpKSkgew0KICAgICAgNWNoMiAiRDF0MWIxczUgQzJubjVjdDQybiBFcnIyciEgUGw1MXM1IGNsNGNrIGg1cjUgdDIgbDJnNG4gMWcxNG4uLi4gIjsNCgkgIDVjaDIgJzwxIGhyNWY9ImwyZzRuLmh0bSI+PGYybnQgYzJsMnI9IiNGRjAwMDAiIGYxYzU9IkFyNDFsLCBINWx2NXQ0YzEsIHMxbnMtczVyNGYiPjxzdHIybmc+TE9HSU48L3N0cjJuZz48L2YybnQ+PC8xPic7DQoJICBkNDUoKTsNCiAgIH0NCiAgIDVsczV7DQogICAkYyA9IDJjNF9jMm5uNWN0KCQzbjFtNSwgJHB3ZCwkZGJzKTsNCiAgIHI1dDNybiAkYzsNCiAgIH0NCn0NCg0KZjNuY3Q0Mm4gNW5jMmQ1XzNybCAoJHN0cjRuZykgew0KICAgJHN0ciA9IHByNWdfcjVwbDFjNSgnL1xzLycsICclYTAnLCAkc3RyNG5nKTsNCiAgIHI1dDNybiAkc3RyOw0KfQ0KPz4NCg=='); // // TEST 02: // This works - sort of - but some decoded text is not correct $text_area2=base64_decode($text_area1); // // TEST 03: // This gives data error // Warning: gzinflate() [function.gzinflate]: data error in I:\MyXAMPP\htdocs\sandbox\test.php on line 41 // //$text_area2=eval(gzinflate(base64_decode($text_area1))); // // TEST 04: // This works - sort of - but some decoded text is not correct //$text_area2 = null; //for ($i=0; $i < ceil(strlen($text_area1)/256); $i++) // $text_area2 = $text_area2 . base64_decode(substr($text_area1,$i*256,256)); } ?> <html> <head><title>Test</title></head> <body> <form method="post" action="test.php"> <textarea cols=100 rows=10 name="text_area1"><?php echo $text_area1?></textarea><br> <input type="submit" name="copynpaste" paste" value="copynpaste"/> <input type="submit" name="cutnpaste" value="cutnpaste"/> <input type="submit" name="decode" value="decode"/> <br> <textarea cols=100 rows=10 cols=20 name="text_area2"><?php echo $text_area2?></textarea> </form> </body> </html> Expected decoded string/text should be as below, more or less. Thanks in advance. <?php // connect to database function get_connection($a, $b,$s) { // PutEnv("ORACLE_SID=" . $c); //echo 'cval ' . $s; PutEnv("TNS_ADMIN=C:/oracle/product/10.2.0/db_1/NETWORK"); $uname = $a; $pwd = $b; $dbs = $s; echo $dbs; // $c=oci_connect($uname, $pwd, $c); if (!@($c=oci_connect($uname, $pwd, $dbs))) { echo "Database Connection Error! Please click here to login again... "; echo '<a href="login.htm"><font color="#FF0000" face="Arial, Helvetica, sans-serif"><strong>LOGIN</strong></font></a>'; die(); } else{ $c = oci_connect($uname, $pwd,$dbs); return $c; } } function encode_url ($string) { $str = preg_replace('/\s/', '%20', $string); return $str; } ?>
  5. Hi, Thanks for your response ... I'll look into your TEXTAREA suggestion ... Darn, had I broken a rule ... hu hu hu ... sorry ... :-\ ... Anyway, thought it may be a breeze if I post and Google at the same time
  6. Hi all, Am very, very, very new to PHP and not sure if I should be posting this to a Javascript or PHP forum so I posed the question on both FORUM. Basically, I am looking for something like an INI editor of sort that I can use to let users modify delimited files which are in actual fact my INI file for my scripts on a UNIX box: Below is an example of what the delimited file may look like: Servername:OS:IPAddress:TypeofServer:Description: SERVER01:AIX:1.2.3.1:PROD:Online Server: SERVER02:Solaris:1.2.3.2:DEV:Online Dev Server: SERVER03:Linux:1.2.3.3:TEST:Online Test Server: SERVER04:Windows:1.2.3.4:PROD:Timesheet PROD Server: SERVER05:HP:1.2.3.5:PROD:Candidate PROD Server: I want to be able to provide the user with the list of directory on the server, and when they click on one of the files on the directory listing, it should allow them to load the file in some kind of form based web page and then they can make the changes and save the file. At the moment, users are going to the server and modifying the file manually via UNIX's vi and it is very prone to errors. Does anyone have an example of what I am wanting to do? Any suggestion will be very much appreciated. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.