php-general Digest 8 Apr 2009 15:58:20 -0000 Issue 6056

Topics (messages 291201 through 291225):

how to get the filesize of an online document?
        291201 by: Sebastian Muszytowski
        291202 by: Gevorg Harutyunyan
        291206 by: Sebastian Muszytowski

Re: Best Practices for Hiding Errors
        291203 by: George Langley

Larger fonts...
        291204 by: Peter Ford
        291205 by: Peter Ford

extracting text - regex
        291207 by: Merlin Morgenstern
        291208 by: Per Jessen
        291209 by: George Larson
        291211 by: George Larson
        291219 by: Merlin Morgenstern

Am I being hacked?
        291210 by: julian haffegee
        291212 by: Richard Heyes
        291213 by: Andrew Ballard
        291214 by: Bob McConnell
        291217 by: 9el
        291218 by: Yannick Mortier
        291224 by: Andrew Ballard
        291225 by: Warren Vail

integrating perl and PHP problem
        291215 by: Moses
        291216 by: Thijs Lensselink

Increase your monthly income!
        291220 by: Mary Blackburn

opening utf-8 files - chinese mb characters
        291221 by: Merlin Morgenstern
        291222 by: Merlin Morgenstern
        291223 by: Per Jessen

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello everyone,

i have a little problem. I want to get the filesize of an online document (for example an rss or atom feed). I tried the filesize() function, but this doesn't work. I also search for options with cUrl but i didn't found any solution.

Hope you can give me some hints or code snipplets so that i can work for an solution.

Thanks in advance

Sebastian

--- End Message ---
--- Begin Message ---
Hi,

You must get content-length http header value, but sometimes header is not
set and you don't have any chance to
get size.

For more info see *get_headers* function description.

On Wed, Apr 8, 2009 at 12:31 PM, Sebastian Muszytowski <
s.muszytow...@googlemail.com> wrote:

> Hello everyone,
>
> i have a little problem. I want to get the filesize of an online document
> (for example an rss or atom feed).
> I tried the filesize() function, but this doesn't work. I also search for
> options with cUrl but i didn't found any solution.
>
> Hope you can give me some hints or code snipplets so that i can work for an
> solution.
>
> Thanks in advance
>
> Sebastian
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Best Regards,
Gevorg Harutyunyan

www.soongy.com

--- End Message ---
--- Begin Message ---
Hi,

thanks for the hint, but how can i get the size when the header isn't specified?

is there the possibility to "count the bits and bytes" when i get the file?


Sebastian

Gevorg Harutyunyan schrieb:
Hi,

You must get content-length http header value, but sometimes header is not set and you don't have any chance to
get size.

For more info see **get_headers** function description.

On Wed, Apr 8, 2009 at 12:31 PM, Sebastian Muszytowski <s.muszytow...@googlemail.com <mailto:s.muszytow...@googlemail.com>> wrote:

    Hello everyone,

    i have a little problem. I want to get the filesize of an online
    document (for example an rss or atom feed).
    I tried the filesize() function, but this doesn't work. I also
    search for options with cUrl but i didn't found any solution.

    Hope you can give me some hints or code snipplets so that i can
    work for an solution.

    Thanks in advance

    Sebastian

-- PHP General Mailing List (http://www.php.net/)
    To unsubscribe, visit: http://www.php.net/unsub.php




--
Best Regards,
Gevorg Harutyunyan

www.soongy.com <http://www.soongy.com>


--- End Message ---
--- Begin Message --- Thanks for all the info, everyone! Seems like the @ trick is nice for individual lines, but turning off/on every time may be bit much on a complicated page. The ini_set('display_errors', false); also has a hit, as it turns back on after the entire script has run, but seems the easier way and just the one time may not be too bad. So maybe is best to turn it off in the actual ini, and turn on only for me, based on my IP or some other flag.
        Thanks again!


George Langley
Multimedia Developer, Audio/Video Editor, Musician, Arranger, Composer

http://www.georgelangley.ca


--- End Message ---
--- Begin Message ---
Patrick,

The reason you think the fonts are too small is that you have (un)zoomed the
screen at some point. The proportions of the centre white panel to the side bars
is wrong.
Measuring your screenshots, and assuming you had a full-screen browser window at
1680x1050 resolution (what your monitor does), I work out that the white section
of the screen is only around 800 pixels wide - it is defined to be 1000 pixels
wide at normal magnification. Measuring the icons suggests that your screen is
showing them at 42 pixels, while they are supposed to be 56 pixels. Overall,
your seeing the whole thing at 80% full size - no wonder the fonts look small!

The fonts and icon sizes haven't changed for about a year, and you haven't
really complained before.

In addition, you are using a pretty large screen - the pages are designed to
work on a 1024x768 screen as a minimum. Making the fonts larger would
drastically reduce the amount of information displayed vertically - it's already
pretty tight on some of the design screens.

So, I'll ignore the calls for bigger fonts and icons.

The button icons may also look better at full size, but the main problem is that
they need to be properly designed. Replacing them with just words is not very
good - it makes them all different sizes, which messes up the layout.
I could remove the shaded background and see if that helps.

Other points I will work on.

Cheers

-- 
Peter Ford                              phone: 01580 893333
Developer                               fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

--- End Message ---
--- Begin Message ---
Tom,

You're right - I tried to catch it before it went, but just too late!

To the list - please ignore the message Tom refers to  - it's not too
commercially sensitive, at least.

I probably need more coffee before fielding bug reports in the morning.


Cheers
Pete

Tom Chubb wrote:
> Pete,
> Before you get slated by the list, I'm guessing you meant to send this
> to someone else?
> (It came to me via the PHP-General Mailing List.
>  
> Tom
> 
> 2009/4/8 Peter Ford <p...@justcroft.com <mailto:p...@justcroft.com>>
> 
>     Patrick,
> 
>     The reason you think the fonts are too small is that you have
>     (un)zoomed the
>     screen at some point. The proportions of the centre white panel to
>     the side bars
>     is wrong.
>     Measuring your screenshots, and assuming you had a full-screen
>     browser window at
>     1680x1050 resolution (what your monitor does), I work out that the
>     white section
>     of the screen is only around 800 pixels wide - it is defined to be
>     1000 pixels
>     wide at normal magnification. Measuring the icons suggests that your
>     screen is
>     showing them at 42 pixels, while they are supposed to be 56 pixels.
>     Overall,
>     your seeing the whole thing at 80% full size - no wonder the fonts
>     look small!
> 
>     The fonts and icon sizes haven't changed for about a year, and you
>     haven't
>     really complained before.
> 
>     In addition, you are using a pretty large screen - the pages are
>     designed to
>     work on a 1024x768 screen as a minimum. Making the fonts larger would
>     drastically reduce the amount of information displayed vertically -
>     it's already
>     pretty tight on some of the design screens.
> 
>     So, I'll ignore the calls for bigger fonts and icons.
> 
>     The button icons may also look better at full size, but the main
>     problem is that
>     they need to be properly designed. Replacing them with just words is
>     not very
>     good - it makes them all different sizes, which messes up the layout.
>     I could remove the shaded background and see if that helps.
> 
>     Other points I will work on.
> 
>     Cheers
> 
>     --
>     Peter Ford                              phone: 01580 893333
>     Developer                               fax:   01580 893399
>     Justcroft International Ltd., Staplehurst, Kent
> 
>     --
>     PHP General Mailing List (http://www.php.net/)
>     To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> -- 
> Tom Chubb
> t...@tomchubb.com <mailto:t...@tomchubb.com> | tomch...@gmail.com
> <mailto:tomch...@gmail.com>
> 07912 202846


-- 
Peter Ford, Developer                 phone: 01580 893333 fax: 01580 893399
Justcroft International Ltd.                              www.justcroft.com
Justcroft House, High Street, Staplehurst, Kent   TN12 0AH   United Kingdom
Registered in England and Wales: 2297906
Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

--- End Message ---
--- Begin Message ---
Hello,

I am trying read text out of a text that is inbetween two divs. Somehow this should be possible with regex, I just can't figure out how.

Example:

<div id="test">
bla blub
</div>

I would like to extract the text "bla blub" out of this example.

Has anybody an idea on how to do that? Is there a special php function available for this?

Thank you for any hint,

Merlin

--- End Message ---
--- Begin Message ---
Merlin Morgenstern wrote:

> Hello,
> 
> I am trying read text out of a text that is inbetween two divs.
> Somehow this should be possible with regex, I just can't figure out
> how.
> 
> Example:
> 
> <div id="test">
> bla blub
> </div>
> 
> I would like to extract the text "bla blub" out of this example.
> 

This might do the trick (not tested):

preg_match( "/<div\s+[^>]*>([^<]*)<\/div>", $yourtext, $match );
print $match[1];


/Per


-- 
Per Jessen, Zürich (16.8°C)


--- End Message ---
--- Begin Message ---
I'm what you might consider rather green, myself.
I certainly wouldn't use this code for production but if you're just
debugging or something then how about something like this:

<?php
    $handle = @fopen('page.htm', 'r');
    if ($handle) {
        while (!feof($handle)) {
            $eos = trim(fgets($handle, 4096));
            if (strpos($eos,"<div>") !== FALSE) { $echo_output = TRUE; }
            if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
            if ($echo_output == TRUE) { echo $eos; }
        }
        fclose($handle);
    }
?>



On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen <p...@computer.org> wrote:

> Merlin Morgenstern wrote:
>
> > Hello,
> >
> > I am trying read text out of a text that is inbetween two divs.
> > Somehow this should be possible with regex, I just can't figure out
> > how.
> >
> > Example:
> >
> > <div id="test">
> > bla blub
> > </div>
> >
> > I would like to extract the text "bla blub" out of this example.
> >
>
> This might do the trick (not tested):
>
> preg_match( "/<div\s+[^>]*>([^<]*)<\/div>", $yourtext, $match );
> print $match[1];
>
>
> /Per
>
>
> --
> Per Jessen, Zürich (16.8°C)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Wed, Apr 8, 2009 at 9:13 AM, George Larson <george.g.lar...@gmail.com>wrote:

> I'm what you might consider rather green, myself.
> I certainly wouldn't use this code for production but if you're just
> debugging or something then how about something like this:
>
> <?php
>     $handle = @fopen('page.htm', 'r');
>     if ($handle) {
>         while (!feof($handle)) {
>             $eos = trim(fgets($handle, 4096));
>             if (strpos($eos,"<div>") !== FALSE) { $echo_output = TRUE; }
>             if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
>             if ($echo_output == TRUE) { echo $eos; }
>         }
>         fclose($handle);
>     }
> ?>
>
>
>
>
> On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen <p...@computer.org> wrote:
>
>> Merlin Morgenstern wrote:
>>
>> > Hello,
>> >
>> > I am trying read text out of a text that is inbetween two divs.
>> > Somehow this should be possible with regex, I just can't figure out
>> > how.
>> >
>> > Example:
>> >
>> > <div id="test">
>> > bla blub
>> > </div>
>> >
>> > I would like to extract the text "bla blub" out of this example.
>> >
>>
>> This might do the trick (not tested):
>>
>> preg_match( "/<div\s+[^>]*>([^<]*)<\/div>", $yourtext, $match );
>> print $match[1];
>>
>>
>> /Per
>>
>>
>> --
>> Per Jessen, Zürich (16.8°C)
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
Sorry about the top-post.  I forgot. :)

--- End Message ---
--- Begin Message ---


George Larson wrote:
On Wed, Apr 8, 2009 at 9:13 AM, George Larson <george.g.lar...@gmail.com>wrote:

I'm what you might consider rather green, myself.
I certainly wouldn't use this code for production but if you're just
debugging or something then how about something like this:

<?php
    $handle = @fopen('page.htm', 'r');
    if ($handle) {
        while (!feof($handle)) {
            $eos = trim(fgets($handle, 4096));
            if (strpos($eos,"<div>") !== FALSE) { $echo_output = TRUE; }
            if (strpos($eos,"<\div>") !== FALSE) { $echo_output = FALSE; }
            if ($echo_output == TRUE) { echo $eos; }
        }
        fclose($handle);
    }
?>




On Wed, Apr 8, 2009 at 8:30 AM, Per Jessen <p...@computer.org> wrote:

Merlin Morgenstern wrote:

Hello,

I am trying read text out of a text that is inbetween two divs.
Somehow this should be possible with regex, I just can't figure out
how.

Example:

<div id="test">
bla blub
</div>

I would like to extract the text "bla blub" out of this example.

This might do the trick (not tested):

preg_match( "/<div\s+[^>]*>([^<]*)<\/div>", $yourtext, $match );
print $match[1];


/Per


--
Per Jessen, Zürich (16.8°C)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Sorry about the top-post.  I forgot. :)



Thank you everbody. I figured it out without regex. It's not for production, just testing:
        $pos_1 = strpos($contents, $word1);
        $pos_2 = strpos($contents, $word2, $pos_1);
        $text = strip_tags(substr($contents, $pos_1, $pos_2 - $pos_1));

That works as well.



--- End Message ---
--- Begin Message --- I set up a simple form to save comments on my webpage, and after just one day of going live, i'm getting weird comments up like this

declare @q varchar(8000) select @q = 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)


I don't recognise this code - is this an attempt to do something nefarious, or nothing I should worry about?

Anybody know what this means?

Thanks so much for reading
Jules
--- End Message ---
--- Begin Message ---
> I set up a simple form to save comments on my webpage, and after just one
> day of going live, i'm getting weird comments up like this
>
> declare @q varchar(8000) select @q =
> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>
>
> I don't recognise this code - is this an attempt to do something nefarious,
> or nothing I should worry about?

Looks like it may be. As long as you escape you SQL correctly using
mysql_real_escape_string() or the equivalent, you should be OK.

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

--- End Message ---
--- Begin Message ---
On Wed, Apr 8, 2009 at 9:23 AM, Richard Heyes <rich...@php.net> wrote:
>> I set up a simple form to save comments on my webpage, and after just one
>> day of going live, i'm getting weird comments up like this
>>
>> declare @q varchar(8000) select @q =
>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>
>>
>> I don't recognise this code - is this an attempt to do something nefarious,
>> or nothing I should worry about?
>
> Looks like it may be. As long as you escape you SQL correctly using
> mysql_real_escape_string() or the equivalent, you should be OK.
>
> --
> Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.net (Updated March 28th)
>

It's probably someone testing to see if your site is running SQL
Server and is vulnerable to SQL injection. Effectively all it does is
issue the command WAITFOR DELAY '00:00:10', telling the server to wait
for 10 seconds before allowing the connection to continue.

Andrew

--- End Message ---
--- Begin Message ---
On Behalf Of Richard Heyes
>> I set up a simple form to save comments on my webpage, and after just
one
>> day of going live, i'm getting weird comments up like this
>>
>> declare @q varchar(8000) select @q =
>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>
>>
>> I don't recognise this code - is this an attempt to do something
nefarious,
>> or nothing I should worry about?
> 
> Looks like it may be. As long as you escape you SQL correctly using
> mysql_real_escape_string() or the equivalent, you should be OK.

Let me see if I got this right. The data you got from the form tries to
set up a local variable, assigns it a hex string as a value, then tries
to execute it. That definitely looks like an attempt to crack your
server. It looks like the semi-colons were removed somewhere, so none of
it actually runs. But you would probably need a set of dis-assemblers to
find out what CPU that code was written for and what it actually does.

Next question: You said there are multiple comments like this. How do
they differ, if they do? Possibly they are trying code for different
CPUs.

Did you trace these back to the logs to see if they all come from one IP
or subnet? Is there anywhere to report these attempts that would
actually do any good, or should you just ban that IP.

But this one goes into my journal as something to be prepared for.

Bob McConnell

--- End Message ---
--- Begin Message ---
On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell <r...@cbord.com> wrote:

> On Behalf Of Richard Heyes
> >> I set up a simple form to save comments on my webpage, and after just
> one
> >> day of going live, i'm getting weird comments up like this
> >>
> >> declare @q varchar(8000) select @q =
> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
> >>
> >>
> >> I don't recognise this code - is this an attempt to do something
> nefarious,
> >> or nothing I should worry about?
> >
> > Looks like it may be. As long as you escape you SQL correctly using
> > mysql_real_escape_string() or the equivalent, you should be OK.
>
> Let me see if I got this right. The data you got from the form tries to
> set up a local variable, assigns it a hex string as a value, then tries
> to execute it. That definitely looks like an attempt to crack your
> server. It looks like the semi-colons were removed somewhere, so none of
> it actually runs. But you would probably need a set of dis-assemblers to
> find out what CPU that code was written for and what it actually does.
>
> Next question: You said there are multiple comments like this. How do
> they differ, if they do? Possibly they are trying code for different
> CPUs.
>
> Did you trace these back to the logs to see if they all come from one IP
> or subnet? Is there anywhere to report these attempts that would
> actually do any good, or should you just ban that IP.
>
> But this one goes into my journal as something to be prepared for.
>
> I think the danger these codes have should be discussed well. And how to
resist such attacks in your server and apps should also be discussed in
greater depth.

regards

Lenin

www.twitter.com/nine_L

--- End Message ---
--- Begin Message ---
2009/4/8 9el <le...@phpxperts.net>:
> On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell <r...@cbord.com> wrote:
>
>> On Behalf Of Richard Heyes
>> >> I set up a simple form to save comments on my webpage, and after just
>> one
>> >> day of going live, i'm getting weird comments up like this
>> >>
>> >> declare @q varchar(8000) select @q =
>> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>> >>
>> >>
>> >> I don't recognise this code - is this an attempt to do something
>> nefarious,
>> >> or nothing I should worry about?
>> >
>> > Looks like it may be. As long as you escape you SQL correctly using
>> > mysql_real_escape_string() or the equivalent, you should be OK.
>>
>> Let me see if I got this right. The data you got from the form tries to
>> set up a local variable, assigns it a hex string as a value, then tries
>> to execute it. That definitely looks like an attempt to crack your
>> server. It looks like the semi-colons were removed somewhere, so none of
>> it actually runs. But you would probably need a set of dis-assemblers to
>> find out what CPU that code was written for and what it actually does.
>>
>> Next question: You said there are multiple comments like this. How do
>> they differ, if they do? Possibly they are trying code for different
>> CPUs.
>>
>> Did you trace these back to the logs to see if they all come from one IP
>> or subnet? Is there anywhere to report these attempts that would
>> actually do any good, or should you just ban that IP.
>>
>> But this one goes into my journal as something to be prepared for.
>>
>> I think the danger these codes have should be discussed well. And how to
> resist such attacks in your server and apps should also be discussed in
> greater depth.
>
> regards
>
> Lenin
>
> www.twitter.com/nine_L
>


I just googled for that string. Seems like you are not the only
victim. Sadly, I can't give you any more advice.


-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me on twitter!
http://twitter.com/moortier

--- End Message ---
--- Begin Message ---
On Wed, Apr 8, 2009 at 10:04 AM, Bob McConnell <r...@cbord.com> wrote:
> On Behalf Of Richard Heyes
>>> I set up a simple form to save comments on my webpage, and after just
> one
>>> day of going live, i'm getting weird comments up like this
>>>
>>> declare @q varchar(8000) select @q =
>>> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
>>>
>>>
>>> I don't recognise this code - is this an attempt to do something
> nefarious,
>>> or nothing I should worry about?
>>
>> Looks like it may be. As long as you escape you SQL correctly using
>> mysql_real_escape_string() or the equivalent, you should be OK.
>
> Let me see if I got this right. The data you got from the form tries to
> set up a local variable, assigns it a hex string as a value, then tries
> to execute it. That definitely looks like an attempt to crack your
> server. It looks like the semi-colons were removed somewhere, so none of
> it actually runs. But you would probably need a set of dis-assemblers to
> find out what CPU that code was written for and what it actually does.
>
> Next question: You said there are multiple comments like this. How do
> they differ, if they do? Possibly they are trying code for different
> CPUs.
>
> Did you trace these back to the logs to see if they all come from one IP
> or subnet? Is there anywhere to report these attempts that would
> actually do any good, or should you just ban that IP.
>
> But this one goes into my journal as something to be prepared for.
>
> Bob McConnell
>

You don't need a disassembler; I already said what that string is
intended to do. If it is allowed to run on Microsoft's SQL Server, the
hex value is implicitly converted to the string "WAITFOR DELAY
'00:00:10'", which is then executed. It doesn't require semi-colons,
as SQL Server doesn't need them between statements. This particular
command is relatively harmless by itself. Its value lies in the fact
that if it causes the resulting page to take more than 10 seconds to
load, the attacker knows that your page is wide open to SQL injection
as well as knowing that he can execute anything he wants. If you're
running MySQL, this won't work so you should be unaffected. Just make
sure your code is written to prevent SQL injection and you should be
fine.

I suppose if you get a lot of these requests from the same IP address
you could have the web server block requests from that IP.

Andrew

--- End Message ---
--- Begin Message ---
Looks like an attempt to get your SQL server to execute a command, Microsoft
SQL server will do that(among others), and if not properly set up can do it
with root access.  If you don't properly escape and store this comment in a
database, it could execute (called SQL injection, no?).

Warren Vail

> -----Original Message-----
> From: Yannick Mortier [mailto:mvmort...@googlemail.com] 
> Sent: Wednesday, April 08, 2009 8:07 AM
> To: 9el
> Cc: Bob McConnell; Richard Heyes; julian haffegee; PHP Mailing List
> Subject: Re: [PHP] Am I being hacked?
> 
> 2009/4/8 9el <le...@phpxperts.net>:
> > On Wed, Apr 8, 2009 at 8:04 PM, Bob McConnell <r...@cbord.com> wrote:
> >
> >> On Behalf Of Richard Heyes
> >> >> I set up a simple form to save comments on my webpage, 
> and after 
> >> >> just
> >> one
> >> >> day of going live, i'm getting weird comments up like this
> >> >>
> >> >> declare @q varchar(8000) select @q =
> >> >> 0x57414954464F522044454C4159202730303A30303A313027 exec(@q)
> >> >>
> >> >>
> >> >> I don't recognise this code - is this an attempt to do something
> >> nefarious,
> >> >> or nothing I should worry about?
> >> >
> >> > Looks like it may be. As long as you escape you SQL 
> correctly using
> >> > mysql_real_escape_string() or the equivalent, you should be OK.
> >>
> >> Let me see if I got this right. The data you got from the 
> form tries 
> >> to set up a local variable, assigns it a hex string as a 
> value, then 
> >> tries to execute it. That definitely looks like an attempt 
> to crack 
> >> your server. It looks like the semi-colons were removed 
> somewhere, so 
> >> none of it actually runs. But you would probably need a set of 
> >> dis-assemblers to find out what CPU that code was written 
> for and what it actually does.
> >>
> >> Next question: You said there are multiple comments like 
> this. How do 
> >> they differ, if they do? Possibly they are trying code for 
> different 
> >> CPUs.
> >>
> >> Did you trace these back to the logs to see if they all 
> come from one 
> >> IP or subnet? Is there anywhere to report these attempts 
> that would 
> >> actually do any good, or should you just ban that IP.
> >>
> >> But this one goes into my journal as something to be prepared for.
> >>
> >> I think the danger these codes have should be discussed 
> well. And how 
> >> to
> > resist such attacks in your server and apps should also be 
> discussed 
> > in greater depth.
> >
> > regards
> >
> > Lenin
> >
> > www.twitter.com/nine_L
> >
> 
> 
> I just googled for that string. Seems like you are not the 
> only victim. Sadly, I can't give you any more advice.
> 
> 
> --
> Currently developing a browsergame...
> http://www.p-game.de
> Trade - Expand - Fight
> 
> Follow me on twitter!
> http://twitter.com/moortier
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
Hi Everyone,

I have a perl program which I would like to display its
results in PHP. I have read PHP book and the solution
is to convert the perl program which is not easy. I have
tried a simple example but it is not working. The perl script
is

#! /usr/bin/perl -w
print "hello world"

and the Php script is

<?php
$result = exec("/var/www/hello.pl",$dirout);
foreach($dirout as $line)
{
   echo "$line\n";
}
?>

Thanks.

--- End Message ---
--- Begin Message ---
Moses wrote:
> Hi Everyone,
> 
> I have a perl program which I would like to display its
> results in PHP. I have read PHP book and the solution
> is to convert the perl program which is not easy. I have
> tried a simple example but it is not working. The perl script
> is
> 
> #! /usr/bin/perl -w
> print "hello world"
> 
> and the Php script is
> 
> <?php
> $result = exec("/var/www/hello.pl",$dirout);
> foreach($dirout as $line)
> {
>    echo "$line\n";
> }
> ?>
> 
> Thanks.
> 

I don't think PHP / Apache have the rights to execute a perl script like
this.

Either give hello.pl execute rights. Or change the line in exec to
"/usr/bin/perl /var/www/hello.pl"

--- End Message ---
--- Begin Message ---
Here is a great way to earn some extra money in the comfort of your home!

Our company is recruiting motivated individuals for participating in well-paid 
online surveys. You can get paid from $5 to $100 per survey, from $50 to $200 
for a focus group discussion, and from $30 to $120 per product or service 
evaluation. You choose whether to receive a paycheck by mail or an on-line 
payment. 

You may participate in as many surveys as you can to have fun and earn more! 
Your success depends only on your determination and devotion to the job! 

If you are interested to join this wonderful work-from-home program, reply back 
to keithia.hults1...@gmail.com

With Respect,
Consumer Opinion Administration











------------------------------------------------------------------
This email has been written and proved to be in compliance with the recently 
established can-spam act law in US. We are not provoking or forcing any person 
in any way to participate in our programs. To participate is your own decision 
and you carry the responsibility of taking further part in this promotion. 
Anyway, if you don't want to receive more good offers from us, you can simply 
Unsubscribe by sending us a notification email to out_of_the_l...@yahoo.com 
with a mail-subject and text "Unsubscribe me", and we will get your email out 
of our list within 10 days.

This message is STRICTLY CONFIDENTIAL and is solely for the individual or 
organisation to whom it is addressed. It may contain PRIVILEGED and 
CONFIDENTIAL information. If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication 
and its contents is strictly prohibited. If you are not the intended recipient 
you should not read, copy, distribute, disclose or otherwise use the 
information in this email. Email may be susceptible to data corruption, 
interception and unauthorised amendment, and we do not accept liability for any 
such corruption, interception or amendment or the consequences thereof or your 
reliance on any information contained therein if you are not the intended 
recipient. If you are not interested in the offered promotions, please just 
don't answer. If you think you have received this message and its contents in 
error, please delete it from your computer, or follow the unsubscribing 
procedure shown above.
------------------------------------------------------------------
                

--- End Message ---
--- Begin Message ---
Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes chinese characters and looks ok, when opened in a browser.

Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks or wired characters. To fix it I tried to add:

$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Regards, Merlin

--- End Message ---
--- Begin Message ---


Merlin Morgenstern wrote:
Hello everybody,

I am having some trouble with utf-8 encoding. The html file containes chinese characters and looks ok, when opened in a browser.

Now I want to extract some text from the file. In order to do this I do:

$handle = fopen($file, "r");
$contents = fread($handle, filesize($file));

echo $contents;

The chinese characters are gone by then. They show up as questinomarks or wired characters. To fix it I tried to add:

$contents = utf8_decode($contents);
header("Content-Type: text/html; charset=utf-8");

But still... no luck :-(

Has somebody an idea why??

Regards, Merlin

Something really strange: If I open the file directly from the hard drive inside the browser, the chinese characters show OK. If I open the file through the webserver the characters do not show OK. File encoding is set to utf-8.

Isn't this strange?°?!?

--- End Message ---
--- Begin Message ---
Merlin Morgenstern wrote:

> Hello everybody,
> 
> I am having some trouble with utf-8 encoding. The html file containes
> chinese characters and looks ok, when opened in a browser.
> 
> Now I want to extract some text from the file. In order to do this I
> do:
> 
> $handle = fopen($file, "r");
> $contents = fread($handle, filesize($file));
> 
> echo $contents;
> 
> The chinese characters are gone by then. They show up as questinomarks
> or wired characters. To fix it I tried to add:
> 
> $contents = utf8_decode($contents);
> header("Content-Type: text/html; charset=utf-8");
> 
> But still... no luck :-(
> 
> Has somebody an idea why??

Check that the page really is displayed with the right encoding - in FF,
Ctrl-I. 

/Per


-- 
Per Jessen, Zürich (16.6°C)


--- End Message ---

Reply via email to