php-windows Digest 19 Sep 2006 20:58:17 -0000 Issue 3039

Topics (messages 27151 through 27156):

Re: cookies time? - now it doesn't write
        27151 by: German Piqué

Re: cookies time? - now it doesn't write [SOLVED]
        27152 by: German Piqué

Reverse DNS/IP
        27153 by: Daniel Anderson
        27154 by: Mitch Miller
        27155 by: Daniel Anderson
        27156 by: Stut

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
I found the problem... and the solution

To test it, i set a group of messages in the code of the class cookie when
the variable "debug" is active. That was leading to all the errors. It's
like the script was generating html code and after that it tries to modify
the cookies.

I set the debug variable to false and only show the cookies' contents after
the writing to it, and it works with all the strings length I tested.

BTW, how many bytes a caracter in a string consume? In C a char is equal to
one byte, but I don't know if in php is the same. I want to know to limit in
the class the cookies' size.

Thanks to all :)

2006/9/19, German Piqué <[EMAIL PROTECTED]>:



---------- Forwarded message ----------
From: German Piqué <[EMAIL PROTECTED]>
Date: 19-sep-2006 10:38
Subject: Re: [PHP-WIN] cookies time? - now it doesn't write
To: "Frank M. Kromann" <[EMAIL PROTECTED]>

 Now works... Oo

But i have another problem.

My script must check a DB and inform of the changes that have been
produced since the last update. I tried two different ways to do it:

1) Use a file in the server to store the diferences

2) Use cookies to store the info.

The first solution has the problem that the update will take place for all
the users that access the script. I think that would be risky for the
integrity of the file or the info retrieved in a case of to much accesses...


The second option i think that is better. But i encounter problems.
Depending on the content, the setcookie returns an error. The idea of the
code is that first search if the cookie exists. If yes, shows it. otherwise,
no. After that, when the access to the DB is made, it stores the results in
the cookie to be reused again. I tried to avoid the 4 KBs limit problem by
creating a class that controls the lenght of the string and if it surpases
the limit, creates another cookie, with the increment of a counter attatchet
to the base name of the cookie.

It's curious that if I put the string manually, it can be larger than one
string created through the union of one array's cells.

Could it be a memory problem, like the class is taking all of it leaving
nothing to the cookies? I think that this sentence has no sense but i don't
know what it could be.

I tried to destroy the cookies after reading them, too. But when I try to
re-create it later in order to insert the new info causes an error, and in
the next refresh, there are no cookies and I can write to the cookies!!
Then, in the next refresh, again I can read the cookie, but I can't write to
it. In the next, there are no cookis and I can write again... Why? Why if
the cookie is destroyed I can write it but if it's create I can't rewrite
it?

That's the cause that leade me to think that it's a memory problem.

Well... any ideas?



2006/9/19, German Piqué <[EMAIL PROTECTED]>:
>
> So, it's another problem. -_- I'll give it a try.
>
> 2006/9/18, Frank M. Kromann <[EMAIL PROTECTED]>:
>
> > both time() and mktime() works fine on Windows.
> >
> > - Frank
> >
> > > Well, reading the documentation about cookies i saw that the
> > function
> > time()
> > > works using UNIX epochs. If I try to use this function (or mktime)
> > in
> > > windows, the php shows a white page, like there's an error
> > somewhere.
> > >
> > > It's a problem with windows machine's or there's another solution to
> >
> > this?
> > >
> > > Meanwhile, I put no time option (so cookie expires at the end of the
> > > session) but i would like to try to set up a timeout.
> > >
> > > I don't demand absolute solutions, I only want a clue to work on.
> > >
> > > Thank you :)
> > >
> >
> >
> >
> >
>
>




--- End Message ---
--- Begin Message ---
Now I found why under some sizes it worked. It was because in the config
file php.ini, the variable output_buffering was set to "4096". When the
buffer reached that size the rest of the cookie cannot be stored and failed
:)

well, that's what I suppose reading the documentation of this option:

; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit.  You can enable output buffering during runtime by calling the output
; buffering functions.  You can also enable output buffering for all files
by
; setting this directive to On.  If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On',
as
; a value for this directive (e.g., output_buffering=4096).

Thank you all :)

2006/9/19, German Piqué <[EMAIL PROTECTED]>:

 I found the problem... and the solution

To test it, i set a group of messages in the code of the class cookie when
the variable "debug" is active. That was leading to all the errors. It's
like the script was generating html code and after that it tries to modify
the cookies.

I set the debug variable to false and only show the cookies' contents
after the writing to it, and it works with all the strings length I tested.

BTW, how many bytes a caracter in a string consume? In C a char is equal
to one byte, but I don't know if in php is the same. I want to know to limit
in the class the cookies' size.

Thanks to all :)

 2006/9/19, German Piqué <[EMAIL PROTECTED]>:
>
>
>
> ---------- Forwarded message ----------
> From: German Piqué < [EMAIL PROTECTED]>
> Date: 19-sep-2006 10:38
> Subject: Re: [PHP-WIN] cookies time? - now it doesn't write
> To: "Frank M. Kromann" < [EMAIL PROTECTED]>
>
>  Now works... Oo
>
> But i have another problem.
>
> My script must check a DB and inform of the changes that have been
> produced since the last update. I tried two different ways to do it:
>
> 1) Use a file in the server to store the diferences
>
> 2) Use cookies to store the info.
>
> The first solution has the problem that the update will take place for
> all the users that access the script. I think that would be risky for the
> integrity of the file or the info retrieved in a case of to much accesses...
>
>
> The second option i think that is better. But i encounter problems.
> Depending on the content, the setcookie returns an error. The idea of the
> code is that first search if the cookie exists. If yes, shows it. otherwise,
> no. After that, when the access to the DB is made, it stores the results in
> the cookie to be reused again. I tried to avoid the 4 KBs limit problem by
> creating a class that controls the lenght of the string and if it surpases
> the limit, creates another cookie, with the increment of a counter attatchet
> to the base name of the cookie.
>
> It's curious that if I put the string manually, it can be larger than
> one string created through the union of one array's cells.
>
> Could it be a memory problem, like the class is taking all of it leaving
> nothing to the cookies? I think that this sentence has no sense but i don't
> know what it could be.
>
> I tried to destroy the cookies after reading them, too. But when I try
> to re-create it later in order to insert the new info causes an error, and
> in the next refresh, there are no cookies and I can write to the cookies!!
> Then, in the next refresh, again I can read the cookie, but I can't write to
> it. In the next, there are no cookis and I can write again... Why? Why if
> the cookie is destroyed I can write it but if it's create I can't rewrite
> it?
>
> That's the cause that leade me to think that it's a memory problem.
>
> Well... any ideas?
>
>
>
> 2006/9/19, German Piqué <[EMAIL PROTECTED]>:
> >
> > So, it's another problem. -_- I'll give it a try.
> >
> > 2006/9/18, Frank M. Kromann <[EMAIL PROTECTED]>:
> >
> > > both time() and mktime() works fine on Windows.
> > >
> > > - Frank
> > >
> > > > Well, reading the documentation about cookies i saw that the
> > > function
> > > time()
> > > > works using UNIX epochs. If I try to use this function (or mktime)
> > > in
> > > > windows, the php shows a white page, like there's an error
> > > somewhere.
> > > >
> > > > It's a problem with windows machine's or there's another solution
> > > to
> > > this?
> > > >
> > > > Meanwhile, I put no time option (so cookie expires at the end of
> > > the
> > > > session) but i would like to try to set up a timeout.
> > > >
> > > > I don't demand absolute solutions, I only want a clue to work on.
> > > >
> > > > Thank you :)
> > > >
> > >
> > >
> > >
> > >
> >
> >
>
>
>



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

Question:
I was wondering if anyone knows if it is possible to find the reverse IP/DNS 
address of a computer please?

Reason:
I ask this because I wish to produce a 'ban' list of users on a forum who 
persistantly cause problems, banning specific IPs is an option, but at the 
moment is not effective because the IP address of one specific user changes, 
they have a dynamic IP which means they are either using Dial-Up, or 
specifically paying with their ISP to have their IP refreshed every computer 
log-in (or Internet box reset).

IT's all well and good using $_SERVER["REMOTE_ADDR"]; to help use as a "ban" 
function, but if the IP keeps moving all the time, it isn't working. So we need 
to result to a Reverse DNS which doesn't change, it remains the same.

Question:
Is there a way of finding the Reverse DNS address through PHP please?

Thanks for you

--- End Message ---
--- Begin Message ---
Daniel,

I don't think this is going to help you much. Most ISPs assign unique DNS names to each IP address, so you'd end up with something like:
  92-18-36-1.wsip.mysip.com
the first time they come in, and
  92-18-36-2.wsip.mysip.com
the next time ... if you ban based on DNS name, you're still hosed since they correlate exactly (1:1) to the respective IP addresses.

-- Mitch



Daniel Anderson wrote:
Hi guys,

Question:
I was wondering if anyone knows if it is possible to find the reverse IP/DNS 
address of a computer please?

Reason:
I ask this because I wish to produce a 'ban' list of users on a forum who 
persistantly cause problems, banning specific IPs is an option, but at the 
moment is not effective because the IP address of one specific user changes, 
they have a dynamic IP which means they are either using Dial-Up, or 
specifically paying with their ISP to have their IP refreshed every computer 
log-in (or Internet box reset).

IT's all well and good using $_SERVER["REMOTE_ADDR"]; to help use as a "ban" 
function, but if the IP keeps moving all the time, it isn't working. So we need to result to a 
Reverse DNS which doesn't change, it remains the same.

Question:
Is there a way of finding the Reverse DNS address through PHP please?

Thanks for you

--- End Message ---
--- Begin Message --- Hmm... perhaps, yeah, but as long as I can get the Reverse DNS/IP address found, I can work on planning a banner that 'estimates' certain values.

I see what you mean though, but it would still be handy to find out how to find the Reverse IP/DNS anyway.

Does anyone know?

Maribeth, thanks for your suggestion, but I need to know the PHP code in which I can do that myself, as I need it desparately to improve a user ban system.

Thanks for your help guys!

Regards,
Dan

----- Original Message ----- From: "Mitch Miller" <[EMAIL PROTECTED]>
To: "Daniel Anderson" <[EMAIL PROTECTED]>
Cc: "php-windows" <[email protected]>
Sent: Tuesday, September 19, 2006 8:53 PM
Subject: Re: [PHP-WIN] Reverse DNS/IP


Daniel,

I don't think this is going to help you much. Most ISPs assign unique DNS names to each IP address, so you'd end up with something like:
  92-18-36-1.wsip.mysip.com
the first time they come in, and
  92-18-36-2.wsip.mysip.com
the next time ... if you ban based on DNS name, you're still hosed since they correlate exactly (1:1) to the respective IP addresses.

-- Mitch



Daniel Anderson wrote:
Hi guys,

Question:
I was wondering if anyone knows if it is possible to find the reverse IP/DNS address of a computer please?

Reason:
I ask this because I wish to produce a 'ban' list of users on a forum who persistantly cause problems, banning specific IPs is an option, but at the moment is not effective because the IP address of one specific user changes, they have a dynamic IP which means they are either using Dial-Up, or specifically paying with their ISP to have their IP refreshed every computer log-in (or Internet box reset).

IT's all well and good using $_SERVER["REMOTE_ADDR"]; to help use as a "ban" function, but if the IP keeps moving all the time, it isn't working. So we need to result to a Reverse DNS which doesn't change, it remains the same.

Question:
Is there a way of finding the Reverse DNS address through PHP please?

Thanks for you

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



--- End Message ---
--- Begin Message ---
Daniel Anderson wrote:
I see what you mean though, but it would still be handy to find out how to find the Reverse IP/DNS anyway.

Does anyone know?

http://php.net/gethostbyaddr

-Stut

--- End Message ---

Reply via email to