Jump to content

jmurch

Members
  • Posts

    82
  • Joined

  • Last visited

Posts 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 have ongoing projects that I need done on a fairly regular basis.

     

    Some of these projects are fairly simple:

    php website / some json/ajax etc.

     

    Some are very complicated and creative:

    php-cli to interface with a shoretel mysql db and perform remote telnet to a vms system and communicate where needed with paypal to enable pay-by-phone on an old dec basic / rms filesystem.

     

    php-cli to automatically merge static templates with datafiles that are ftpd from a mainframe and process per a control file.

     

    I am looking for someone now and will begin with smaller projects until I am confident that you can do the more complicated work. The coding itself is not nearly are important as the ability to see the big picture and layout, code and thoroughly test the project.

     

    I am willing to pay $30 - $50 and up per hour for US, Europe, and English speaking countries and up to $15 hour overseas (India, Pakistan, etc.)

     

    Please IM me with any interest.

  3.  

    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!

  4.  

    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

     

  5.  

    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

     

  6.  

    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

     

  7. 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

  8. 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

  9. 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";

    ?>

×
×
  • 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.