RE: [PHP] Broken ip2long and long2ip?

2001-05-20 Thread Jorg Krause

> From: Sean Cazzell [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, May 20, 2001 8:41 AM
[...]
> It appears that the integer type being used by these functions is not able
> to store the entire 32 bits (4 bytes).  It can only handle up to 31 bits -
> my guess is the type is signed when it should be unsigned.
>
> In any case,I'm running PHP 4.0.5 on Linux 2.4.3 on an x86 machine.  I
> would appreciate it if a someone can verify this before I submit it as a
> bug.
>
[...]
You're right. Integers are allways signed and therefore 31 Bit. Use this:

$ip = '192.168.100.102';
$lo = ip2long($ip);
if ($lo < 0) $lo += pow(2,32);

$lo does now contain the right value, PHP internally converts the data type
to double.
BTW, long2ip() accepts both values, a signed integer or a double value.

I think this isn't a bug, it is due to the pure type concept of PHP,
where no real long-values or bigint (like MySQL) are possible.
Put a better type concept on your wishlist for PHP 5.

Joerg
[EMAIL PROTECTED]
www.php.comzept.de


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] regexp question - extracting wanted ascii characters only?

2001-04-04 Thread Jorg Krause

> From: Erick Papadakis [mailto:[EMAIL PROTECTED]]
> 
> Hi,
> 
> I need to do a simple thing. I want to read a binary
> file (e.g., microsoft word, excel etc) and then
> extract only the text from it. I am using simple
> fopen() and fread() and when I print out the contents
> of the file, it returns me the text but apart from the
> text, there is some junk which is probably because of
> the file being binary. 
> 
> Is it possible through the regexp to specify that I
> only want some of the ASCII characters from the binary
> stream? Here is the perl equivalent: 
> 
> /([\040-\176\s]{3,})/g
> 
> I want only those words that are minimum 3 characters
> and I want the characters to match the ASCII numbers
> from 40 to 176. 
> 
You can use the regex likewise to perl. Try it here:

http://www.php.comzept.de/rexpr/index.php4

Instead of the /g option use the function preg_grep() in PHP.
Read the file in an array with file(), then grep through
the array with the regex to get the right lines. Want a 
string? implode() without delimiter.

Joerg Krause
**
E-Mail: [EMAIL PROTECTED] Info:www.joerg.krause.net
German Reference Handbook: www.php.comzept.de/referenz
**

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] search for a better php source code viewer

2001-06-26 Thread Jorg Krause

Hi,

I'think anybody knows highlight_file, highlight_string
or show_source, but these are not good enough.

For an application I need a more advanced technique,
which includes line numbers and let me control all
formatting instructions (not only ).

Is there any script out, written in PHP (and supports PHP
and HTML), that can be expanded by highlighting my own
functions/classes, my own XML-Tags etc.?

Thanx for any idea,

Joerg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search for a better php source code viewer

2001-06-26 Thread Jorg Krause

> -Original Message-
> From: Miles Thompson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 7:42 PM
> To: [EMAIL PROTECTED]; php
> Subject: Re: [PHP] search for a better php source code viewer 
> 
> 
> Windows or Linux? These are editors, not viewers, though.
> 
> If Windows - UltraEdit; there are predefined files whihc are used to 
> colourize PHP & HTML markup. You can add to then and extend them. 
> Possible 
> HTMLKit as well.
> 
Thanx for the answers...
[...]
No, I'll view source code in a PHP application, not 
edit it in an editor. So it should work like highlight_string() and
shows the source colorized, but with more features. What I
really searching for is a class which is easy expandable.
I want to show users the code of scripts I've written, but
some functions and classes should be highlighted and shown as
links, others don't. 
Sorry, if my previous post was misleading.

Joerg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] search for a better php source code viewer

2001-06-27 Thread Jorg Krause

Hi,

> -Original Message-
> From: Jason Lotito [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 11:05 PM
> To: 'Tyler Longren'; [EMAIL PROTECTED]; 'php'
> Subject: RE: [PHP] search for a better php source code viewer 
> 
> 
> You mean something like this:
> 
> http://www.newbienetwork.net/phpcodems.php?as=viewcode&id=14
> 
> Jason Lotito
> www.NewbieNetwork.net
> PHP Newsletter: http://www.newbienetwork.net/ciao.php
> PHP, MySQL, PostgreSQL Tutorials, Code Snippets, and so much more
> 
[...]
Yes, that's I mean, but this I've allready. The usage of
the output buffer is interesting, but it is still based on
highlight_string(). What I want is a function, in plain PHP,
which runs on the server, not on the client, act as a 
pretty printer for php code, expandable for my own functions.
Has nobody ever written a better/customizable
highlight_file()-function?

Joerg


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] email counter

2001-07-17 Thread Jorg Krause

Hi,

> Brian White [mailto:[EMAIL PROTECTED]] wrote on Tuesday, July 17, 2001
5:52 AM
> To: Jack; [EMAIL PROTECTED]
> Subject: Re: [PHP] email counter
>
>
> How about changing link to
>
>  Big George 
>
> Where mymailer.php is something like
>
>  /*
> Do whatever it is you need to do with $email
>   */
>
> header("Location: mailto:$email"; );
>
> ?>
>

Works, but changes the previous open window into a empty sheet
and displays "mailto:[EMAIL PROTECTED]";, so the old page
disappears (the user has to click the back button). I think this
solution is not really good for common usage.

Try to use javascript:


x = window.open("mailto:", "Site");


It's easy to combine it with PHP to count the send mails.

Joerg
www.php.comzept.de


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]