Jump to content

jmurch

Members
  • Posts

    82
  • Joined

  • Last visited

Everything posted by jmurch

  1. I am reading a stream using '$input = trim(fread($socket, 16384));' and everything is working fine until the length of data from the stream exceeds 4078. At 4078 I stop for some reason reading the stream. I am wondering why this works (up to 4078): '$input = trim(fread($socket, 16384));' But this does not: '$input = stream_get_contents($socket);' Other parameters for the stream are: stream_set_blocking($con, true); stream_socket_enable_crypto($con, true, STREAM_CRYPTO_METHOD_TLS_SERVER); handle_incoming_connection($con, $client); $res = stream_context_create($streamopts); if ($res === false) { System_Daemon::err('error when creating stream'); System_Daemon::stop(); exit(1); } $master = stream_socket_server( "tcp://$host:$port", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $res ); if ($master === false) { System_Daemon::err('stream_socket_server(): [%s] %s', $errno, $errstr ); System_Daemon::stop(); exit(1); } stream_socket_enable_crypto($master, false); function handle_incoming_connection($socket, $client) { $input = trim(fread($socket, 16384)); if (($input == null) || ($input == 'exit') ) { return; } Any help would be greatly appreciated. TIA, Jeff
  2. I want to explode on \n but not for data within double quotes: currently: explode("\n",$decoded_data); Does anyone have any pointers on how to do this? TIA, Jeff
  3. Thanks guys......................!!!!
  4. I'm rying to find a PHP function that will split a binary file to an fixed length chunk into an array other than just using the linux 'split' functionality. 'explode' would work but I need a fixed length chunk not using a delimeter. TIA, Jeff
  5. As the title says, my script won't continue after the exec when running from a cron (running cron job as root). Tried a bang, 744 etc. no luck. Works fine from cli. Anyone have any suggestions? TIA, Jeff
  6. More missing details: This rule matches this ssh log entry: Log entry: Aug 4 20:59:16 socketserver sshd[21442]: Failed password for root from 98.165.54.217 port 56595 ssh2 Rule: ^%(__prefix_line)sFailed (?:password|publickey) for .* from <HOST>(?: port \d*)?(?: ssh\d*)?$ (Note that this is for use in the iptables module fail2ban. The entry __prefix_line comes from another config file but I figured that leaving it out would be more confusing) This rule does not match this log entry: Log entry: [Aug 04 14:22:02] err: bad or missing CDL header. refused connection from 98.165.54.217:54335 [l:980] Rule: /bad or missing CDL header\. refused connection from ([0-9.:]+)/ Thanks!
  7. Yes your correct I want to capture the log entry less the port info after the ip when it contains 'err: bad or missing CDL header. refused connection from' Thanks
  8. Probably my mistake for not explaining better. I need to match only entries that do contain the string: 'err: bad or missing CDL header. refused connection from' Since there are other log entries. Jeff
  9. I am trying to come up with a regex that will match this log entry: [Aug 04 14:22:02] err: bad or missing CDL header. refused connection from 98.165.54.217:54335 [l:980] Where timestamp and ip address will obviousley be different each time. I dont care about anything after the colon in the ip address. TIA, Jeff
  10. I am configuring fail2ban so that it will capture a log input similar to this: err: bad or missing CDL header refused connect from 98.165.54.217:65174 [l:949] The regex that I have that's not working is this: failregex = err: bad or missing TDL header refused connect from \S+ \(<HOST>\)\s*$ I just want the host address not the full string with the port number. I don't know if fail2ban syntax is different than normal regex syntax. TIA, Jeff
  11. I'm hoping someone has run into this before. I am using the pear system_daemon to run some cli code as a daemon. In Debian it runs great but won't start the daemon in RHEL. TIA, Jeff
  12. I am trying to work around something and need to add and subtract one second to the times. I'm using the format: $now = date("Y-m-d H:i:s"); I need to ultimatley have the results such as: $now = (date("Y-m-d H:i:s") - :01); or $now = (date("Y-m-d H:i:s") + :01); TIA, Jeff
  13. Solved! $r_lines = explode(',',$r); $i = 0; while ($i <= sizeof($r_lines)) { $r_lines_string = $r_lines[$i]; $r_detail = explode('~',$r_lines_string); echo "<pre>"; print_r($r_detail); echo "</pre>"; $i++; }
  14. Getting closer: $r_lines = explode(',',$r); $i = 0; while ($i <= sizeof($r_lines)) { $r_lines_string = implode('~',$r_lines); $r_detail = explode('~',$r_lines_string); echo "<pre>"; print_r($r_detail); echo "</pre>"; $i++; echo "var i = ".$i; }
  15. I have a string with two different delimeters that I am trying to explode into a mutli-dimensional array but not having any luck: $r_lines = explode(',',$r); echo "<pre>"; echo print_r(explode('~',$r_lines)); echo "</pre>"; TIA, Jeff
  16. Thanks CV............. I forgot about that now that you mention it. Jeff
  17. Thanks cags I'll give that a try. You were correct about the array structure. When I pasted into the posting the formattiing got messed up. I have not idea whre the [0]s went. Jeff
  18. I have an array with in my session array $_SESSION[discounts] : [discounts] => Array ( [0] => Array ( [0] => .30 [1] => 06200-08186 ) [1] => Array ( [0] => .30 [1] => 03016-11100 ) [2] => Array ( [0] => .30 [1] => 03015-00094 ) [3] => Array ( [0] => .30 [1] => 03015-00122 ) I want to search through the array for the part number [1] and if it is in the array retrieve the discount [0]. TIA, Jeff
  19. I am getting some confusing feedback when trying to send an array within the $_POST array: On site A I am querying a table and get a record set that I use to populate an array: while($get_address_result = oci_fetch_row($s)) { $address_array[] = $get_address_result; } Then I'm posting to a PHP page on server B: <body onload="submitForm()"> <form name="form" id="form" action="https://www.server_b.com/page.php" method="post"> <input type="hidden" name="address_array" value="<? echo $address_array ?>"> </form> </body> If I do a print_r($address_array) at server A the array is fine, 7 rows. If I do a print_r($address_array) or print_r($_POST['address_array']) at server B all I get is 'Array'. If I do a print_r($_POST) at B I get 'Array ( [address_array] => Array'. TIA, Jeff
  20. I am using the same connection to perform selects and it works fine...........
  21. Does anyone know of a way to do this? I am not getting any of my OUT parameters when calling a stored procedure thru OCI8. Besides serveroutput is there anywhere else that may preventing my getting the OUT values? <? $c = oci_connect("jeffm", "welcome1", "10.2.1.25:1524/cdba"); $sql = 'BEGIN apps.sayHello(:name, :message); END;'; $stmt = oci_parse($conn,$sql); // Bind the input parameter oci_bind_by_name($stmt,':name',$name,32); // Bind the output parameter oci_bind_by_name($stmt,':message',$message,32); // Assign a value to the input $name = 'Jeff'; oci_execute($stmt); // $message is now populated with the output value print "$message\n"; ?>
  22. OK thanks. There was supposed to be two loops. The intent was that I would populate an array, loop it to get row 1 for the parent info, then loop a new one to get all the child rows. Jeff
  23. There are two loops. The first is just to get the 'parent info' and then the second to get the 'child' info. Which loop are you referring to? Jeff
  24. PFM, Here is the entire while loop. I have confirmed that there is one row left in the array after the while loop thinks it's done: $s = oci_parse($c, "select * from triton.LOOKUP_SERIAL_NBR_V where LOOKUP_SERIAL_NBR_V.parent_serial_number like '%$serial_number'"); oci_execute($s); $parent_row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS); if($parent_row[0]) { echo "<span class='content_blue_header'>"; echo "<br><b><u>Parent information:</u></b>"; echo "</span>"; echo "<br>"; echo "<br>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Serial number:</div>"; echo "<div class='serial_number_value'>".$parent_row[0]."</div>"; echo "</div>"; $date = $parent_row[1]; $ship_date = date('m-d-Y', strtotime($date)); // //$labor_warranty_date = date('m-d-Y', strtotime($date . ' + 90 DAYS')); // 90 days in the future $parts_warranty_date = date('m-d-Y', strtotime($date . ' + 13 MONTHS')); // 13 months in the future echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Model:</div>"; echo "<div class='serial_number_value'>".$parent_row[2]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Manufacture date:</div>"; echo "<div class='serial_number_value'>".$ship_date."</div>"; echo "</div>"; //echo "<div class='serial_number_row'>"; // echo "<div class='serial_number_title'>Labor warranty good until:</div>"; // echo "<div class='serial_number_value'>".$labor_warranty_date."</b></div>"; //echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Parts warranty good until:</div>"; echo "<div class='serial_number_value'>".$parts_warranty_date."</div>"; echo "</div>"; echo "<br>"; echo "<br>"; echo "<div class='serial_number_row'>"; echo "<span class='content_blue_header'><b><u>Child component information:</u></b></span>"; echo "</div>"; echo "<br>"; echo "<br>"; while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) { echo "<div class='serial_number_output_row'>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Component:</div>"; echo "<div class='serial_number_value'>".str_replace(', ,',',',str_replace('|', ', ', $row[5]))."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Part number:</div>"; echo "<div class='serial_number_value'>".$row[6]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Serial number:</div>"; echo "<div class='serial_number_value'>".$row[3]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Manufacture date:</div>"; echo "<div class='serial_number_value'>".$row[4]."</div>"; echo "</div>"; $part_number_pic = $row[6].".jpg"; $tn_path = 'http://www2.website.compartner/parts_programs/field_replaceable_parts_lists/parts_images/frp_tn/'.$part_number_pic; $pic_path = 'http://www2.website.com/partner/parts_programs/field_replaceable_parts_lists/parts_images/frp/'.$part_number_pic; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Image:</div>"; echo "<div class='serial_number_value'><a href='$pic_path' rel='lightbox'><img src='$tn_path' border='0'></a></div>"; echo "</div>"; echo "<!--[if IE]><br style='clear:both;' /><![endif]-->"; if(!empty($row[7])) { echo "<div class='serial_number_row'>"; echo "<div class='serial_number_child_line'>"; echo "<img src='http://www2.website.com/partner/images/parent_child_line.png'>"; echo "</div>"; echo "<div class='serial_number_child_child'>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_alternate_title'>Alternative part for ".$row[6]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Component:</div>"; echo "<div class='serial_number_value'>".str_replace(', ,',',',str_replace('|', ', ', $row[8]))."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Alt. part number:</div>"; echo "<div class='serial_number_value'>".$row[7]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Reciprocal:</div>"; echo "<div class='serial_number_value'>".$row[9]."</div>"; echo "</div>"; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Alt. Part Manufacture date:</div>"; echo "<div class='serial_number_value'>".$row[10]."</div>"; echo "</div>"; $part_number_pic = $row[7].".jpg"; $part_number_b_pic = $row[7]."b.jpg"; $tn_path = 'http://www2.website.com/partner/parts_programs/field_replaceable_parts_lists/parts_images/frp_tn/'.$part_number_pic; $tn_path_b = 'http://www2.website.com/partner/parts_programs/field_replaceable_parts_lists/parts_images/frp_tn/'.$part_number_b_pic; $pic_path = 'http://www2.website.com/partner/parts_programs/field_replaceable_parts_lists/parts_images/frp/'.$part_number_pic; echo "<div class='serial_number_row'>"; echo "<div class='serial_number_title'>Image:</div>"; echo "<div class='serial_number_value'><a href='$pic_path' rel='lightbox'><img src='$tn_path' border='0'></a></div>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "<!--[if IE]><br style='clear:both;' /><![endif]-->"; } echo "<br style='clear:both;' />"; echo "</div>"; } oci_free_statement($s); } else { echo "<div class='serial_number_row'><font size='3' color='red'>Serial number not found.</font></div>"; }
×
×
  • 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.