php-general Digest 22 Mar 2008 20:30:32 -0000 Issue 5362

2008-03-22 Thread php-general-digest-help

php-general Digest 22 Mar 2008 20:30:32 - Issue 5362

Topics (messages 271964 through 271990):

Re: problem with sessions config.
271964 by: Nilesh Govindrajan

Memory Leaks
271965 by: Nilesh Govindrajan

best method for relative linking in php
271966 by: Sudhakar
271975 by: Brandon Orther

Re: Double click problem [SOLVED]
271967 by: tedd
271968 by: tedd

Re: fwrite/fclose troubles
271969 by: Mark Weaver
271970 by: Mark Weaver
271971 by: Al
271972 by: Mark Weaver

strange list behavior when replying to message on list
271973 by: Mark Weaver
271974 by: Greg Bowser
271976 by: Nilesh Govindrajan
271977 by: Mark Weaver
271979 by: Brandon Orther
271980 by: Nilesh Govindrajan
271981 by: Mark Weaver
271982 by: Mark Weaver
271983 by: Andrew Ballard
271984 by: tedd
271985 by: Mark Weaver
271986 by: Mark Weaver

Comparing file creating dates...
271978 by: Ryan S
271988 by: Jim Lucas

Re: Procmail Recipe to INSERT reply-to header (was: strange list behavior when 
replying to message on list)
271987 by: Mark Weaver
271989 by: tedd

Re: Returned mail: see transcript for details
271990 by: L-Soft list server at AudetteMedia (1.8d)

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]


--
---BeginMessage---

N . Boatswain wrote:

Hello guys; i'm having a problem with session behavior; i'm going straight to 
it, but first some considerations:
PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions at the top of every page. 


A the start of a test page, just as example, i do the assignment:   $_SESSION[username] 
= aaa;

At the end of the same page i print it's value:  echo $_SESSION[username];

And i get the layout: aaa, as expecteed.

Then I redirect to another page. On that one, after initializating the session 
(session_start();) print again the $_SESSION[username] content and the 
result is empty. If i try the same code on a server (all this is on my local machine), the code 
works as expected; so i think it is a configuration problem, here is my php.ini part that 
correspond to session configuration, so you can tell my if i'm doing anything wrong, long comments 
where removed:

[Session]; Handler used to store/retrieve data.session.save_handler = files;session.save_path = 
/tmp BC 13/12/07session.save_path=/tmp; Whether to use 
cookies.session.use_cookies = 1;session.cookie_secure = ; This option enables administrators to 
make their users invulnerable to; attacks which involve passing session ids in URLs; defaults to 
0.session.use_only_cookies = 1; Name of the session (used as cookie name).session.name = PHPSESSID; 
Initialize session on request startup.session.auto_start = 1; Lifetime in seconds of cookie or, if 
0, until browser is restarted.session.cookie_lifetime = 0; The path for which the cookie is 
valid.session.cookie_path = /; The domain for which the cookie is valid.session.cookie_domain =; 
Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser 
scripting languages such as JavaScript.session.cookie_httponly = ; Handler used to serialize data.  
php is the standard serializer of PHP.session.serialize_ha

ndler = php; Define the probability that the 'garbage collection' process is 
started; on every session initialization.; The probability is calculated by 
using gc_probability/gc_divisor,; e.g. 1/100 means there is a 1% chance that 
the GC process starts; on each request.session.gc_probability = 
1session.gc_divisor = 1000; After this number of seconds, stored data will 
be seen as 'garbage' and; cleaned up by the garbage collection 
process.session.gc_maxlifetime = 1440session.bug_compat_42 = 
0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally 
stored URLs containing ids.; HTTP_REFERER has to contain this substring for the 
session to be; considered as valid.session.referer_check =; How many bytes to 
read from the file.session.entropy_length = 0; Specified here to create the 
session id.session.entropy_file =;session.entropy_length = 
16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to 
determine HTTP caching aspects; or leave this empt
y to avoid sending anti-caching headers.session.cache_limiter = nocache; Document expires after n 
minutes.session.cache_expire = 180session.use_trans_sid = 0; Select a hash function; 0: MD5   (128 bits); 1: SHA-1 (160 
bits)session.hash_function = 0; Define how many bits are stored in each character when converting; the binary hash data to 
something readable.;; 4 bits: 0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 0-9, a-z, A-Z, -, 

Re: [PHP] Double click problem [SOLVED]

2008-03-22 Thread Lester Caine

tedd wrote:

Hi gang:

This is probably trivial for most of you, but here's my solution to the 
problem I presented earlier.


The problem was, I just wanted to be certain that if a use clicked a 
button that they could only do it once. Sounds simple enough, huh?


Certainly, one can use javascript, but I wanted something that was basic 
php and html -- here's my solution with code (please provide critical 
review):


I had been tracking an intermittent bug for some considerable time and having 
finally identified the underlying problem - double click sends the page 
request twice, but the second request is processed before first has updated 
things! We have tightened up the server end as much as possible, but not 
eliminated the problem.


The javascript solution is the only reliable one that I've found but some 
sites do not allow it to be enabled. Since having finally identified the 
source of the problem, we have improved education and can now 'spot' a double 
clicker who in many cases does not even know they are doing it! People get so 
used TO double clicking things on the desktop :( But in some case we suspect 
that the BROWSER send two requests perhaps because of a noisy keyboard! On one 
site that we pinned down to a particular counter position, changing the 
keyboard fixed the problem ( enter was pressing the button ).


Just a word of warning that may explain the occasional double order ;)

--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP] Re: problem with sessions config.

2008-03-22 Thread Nilesh Govindrajan

N . Boatswain wrote:

Hello guys; i'm having a problem with session behavior; i'm going straight to 
it, but first some considerations:
PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions at the top of every page. 


A the start of a test page, just as example, i do the assignment:   $_SESSION[username] 
= aaa;

At the end of the same page i print it's value:  echo $_SESSION[username];

And i get the layout: aaa, as expecteed.

Then I redirect to another page. On that one, after initializating the session 
(session_start();) print again the $_SESSION[username] content and the 
result is empty. If i try the same code on a server (all this is on my local machine), the code 
works as expected; so i think it is a configuration problem, here is my php.ini part that 
correspond to session configuration, so you can tell my if i'm doing anything wrong, long comments 
where removed:

[Session]; Handler used to store/retrieve data.session.save_handler = files;session.save_path = 
/tmp BC 13/12/07session.save_path=/tmp; Whether to use 
cookies.session.use_cookies = 1;session.cookie_secure = ; This option enables administrators to 
make their users invulnerable to; attacks which involve passing session ids in URLs; defaults to 
0.session.use_only_cookies = 1; Name of the session (used as cookie name).session.name = PHPSESSID; 
Initialize session on request startup.session.auto_start = 1; Lifetime in seconds of cookie or, if 
0, until browser is restarted.session.cookie_lifetime = 0; The path for which the cookie is 
valid.session.cookie_path = /; The domain for which the cookie is valid.session.cookie_domain =; 
Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser 
scripting languages such as JavaScript.session.cookie_httponly = ; Handler used to serialize data.  
php is the standard serializer of PHP.session.serialize_ha

ndler = php; Define the probability that the 'garbage collection' process is 
started; on every session initialization.; The probability is calculated by 
using gc_probability/gc_divisor,; e.g. 1/100 means there is a 1% chance that 
the GC process starts; on each request.session.gc_probability = 
1session.gc_divisor = 1000; After this number of seconds, stored data will 
be seen as 'garbage' and; cleaned up by the garbage collection 
process.session.gc_maxlifetime = 1440session.bug_compat_42 = 
0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally 
stored URLs containing ids.; HTTP_REFERER has to contain this substring for the 
session to be; considered as valid.session.referer_check =; How many bytes to 
read from the file.session.entropy_length = 0; Specified here to create the 
session id.session.entropy_file =;session.entropy_length = 
16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to 
determine HTTP caching aspects; or leave this empt
y to avoid sending anti-caching headers.session.cache_limiter = nocache; Document expires after n 
minutes.session.cache_expire = 180session.use_trans_sid = 0; Select a hash function; 0: MD5   (128 bits); 1: SHA-1 (160 
bits)session.hash_function = 0; Define how many bits are stored in each character when converting; the binary hash data to 
something readable.;; 4 bits: 0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 0-9, a-z, A-Z, -, 
,session.hash_bits_per_character = 5; The URL rewriter will look for URLs in a defined set of HTML tags.; 
form/fieldset are special; if you include them here, the rewriter will; add a hidden input field with the info which 
is otherwise appended; to URLs.  If you want XHTML conformity, remove the form entry.; Note that all valid entries require a 
=, even if no value follows.url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=


Well, thanks and sorry for my english;

Nicolás.


 
_

Watch “Cause Effect,” a show about real people making a real difference.  Learn 
more.
http://im.live.com/Messenger/IM/MTV/?source=text_watchcause


It works for me; I am using php-5.2.5 with lighttpd and FastCGI.

I called session_start() on both the pages.

and

I have enabled session.use_trans_sid.

You can temporarily override it from the php script by using this -
?
//...other code
ini_set(session.use_trans_sid,1);
//...other code
?

Try and report again.

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



[PHP] Memory Leaks

2008-03-22 Thread Nilesh Govindrajan
I am having 2 memory leaks while calling phpinfo() via FastCGI 
(lighttpd) when session.auto_start is 1. Otherwise there is no memory leak.


Here are the two memory leaks -

[Sat Mar 22 14:07:49 2008]  Script:  '/var/www/lighttpd/test.php'
/root/php-5.2.5/ext/standard/url_scanner_ex.c(305) :  Freeing 0x097BD7E0 
(79 bytes), script=/var/www/lighttpd/test.php

[Sat Mar 22 14:07:50 2008]  Script:  '/var/www/lighttpd/test.php'
/root/php-5.2.5/ext/standard/url_scanner_ex.c(316) :  Freeing 0x097BD85C 
(79 bytes), script=/var/www/lighttpd/test.php


Is this a security threat ?

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



Re: [PHP] relative linking in php

2008-03-22 Thread Nitsan Bin-Nun
Oops, I didnt post it to the list, copy is attached.

On 22/03/2008, Nitsan Bin-Nun [EMAIL PROTECTED] wrote:

 Hi Sudhakar,
 There are 2 solutions,
 You can change the form tag to something like:


  form action=?php echo $_SERVER[PHP_SELF]; ?*#errorsArea*
  method=POST id=test2
  name=registrationform


 Then add the following line before the errors:


  a name=errorsArea/a


 The main problem here is that in case there are no errors it still go
 down.
 If you dont want to get down when there are no errors, you can send it
 without the #errorsArea call, and in your php, check the errors, if there
 are errors you can forward to #errosArea otherwise dont forward.

 HTH
 Nitsan

 BTW
 Personally, I would avoid those things and use AJAX instead.

  On 22/03/2008, Sudhakar [EMAIL PROTECTED] wrote:
 
  i am using a self submitting for using php
  form action=?php echo $_SERVER[PHP_SELF]; ? method=POST
  id=test2
  name=registrationform the registration page starts with a lot of
  terms
  and other details about the registration and then the form fields for
  the
  user to fill the registration page. i have used php to validate the
  form,
  presently when a user clicks the submit button and if there are any
  validateions that need to be displayed to the user, then the user has to
  scroll from the top of the page all the way till they see the form
  elements
  with the validation message ex= Please enter your phone number.
 
  my question is, as in html with relative linking ex a href=#link1
  click
  here/a
  a name=link1 /a
  Text here
 
  the page can be moved to an exact location, can this be done more or
  less
  close to this relative linking using php so that the user need not
  scroll
  from the top of the page to see the validation message.
 
  NOTE = since i am using a self submitting form just before the first
  form
  element i have created a blank table row and in this table row the php
  validation message would appear if the user missed out some information.
  due
  to this the user has to scroll from the top of the page to see the php
  generated validation message. if i use the same php validation at the
  very
  top of the page the error message will be at the top and the form fields
  at
  the bottom and the user will have to scroll up and down to read the
  validation message.
 
  please advice.
 
  thanks.
 




[PHP] best method for relative linking in php

2008-03-22 Thread Sudhakar
i have a registration page where a user fills a form and i display an error
message if a validation message needs to be displayed which i have written
in php. everything works fine. the way the form is made presently is there
is a huge amount of information relating to general information about the
form and its terms and conditions which is compulsory. so if i have to
display any validation message the user has to scroll the page from the top
again all the way till they see the validation message.

i have used relative linking as it is done in html, so that the user does
not have to scroll from the top of the page, rather the page stops where i
want it to so the user see the message and does not have to scroll the page.

following are the 2 methods i have used and both of them work fine. however
in method 2 as it is based on javascript and if
javascript is turned off the relative linking will not work and the user
will have to scroll from the top of the page again and i have tested this
myself.

method 1

form action=?php echo $_SERVER[PHP_SELF]; ?#indrel method=POST
id=test2 name=registrationform 
a name=indrel/a

 if($error)
 {
 echo $error;
 }

method 2

form action=?php echo $_SERVER[PHP_SELF]; ? method=POST id=test2
name=registrationform 
a name=indrel/a

 if($error)
 {
 echo (
 script language='javascript' type='text/javascript'
 window.location.href='http://website.com/filename.php#indrel'
 /script
 );

 echo $error;
 }

please comment if method 1 is correct in terms of the syntax of the form tag
if it is correct or not though i know this method is working the way i want
it to, i wanted to confirm before i implement it for my website.

please advice.

thanks.


Re: [PHP] Double click problem [SOLVED]

2008-03-22 Thread tedd

At 4:23 PM -0700 3/21/08, Jim Lucas wrote:
It would require a little JS, but you could use the onUnload feature 
and pop up a warning that would tell them the problem(s) of leaving 
this page.  Then use the confirm() method from JS to either allow or 
deny them to leave the current page.


I don't know if you can limit this action to only take affect when 
they press the back button, but it might help in any event.


Jim:

I tried that.

The problem is that you'll get that notice if the user submits the 
form as well. IOW, no matter what the user does, as soon as they 
leave that page they get the notice.


I might be able to put a hidden input field to cancel the notice, but 
like everything -- one thing leads to another.


Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Double click problem [SOLVED]

2008-03-22 Thread tedd

At 7:21 AM + 3/22/08, Lester Caine wrote:

tedd wrote:

Hi gang:

This is probably trivial for most of you, but here's my solution to 
the problem I presented earlier.


The problem was, I just wanted to be certain that if a use clicked 
a button that they could only do it once. Sounds simple enough, huh?


Certainly, one can use javascript, but I wanted something that was 
basic php and html -- here's my solution with code (please provide 
critical review):


I had been tracking an intermittent bug for some considerable time 
and having finally identified the underlying problem - double click 
sends the page request twice, but the second request is processed 
before first has updated things! We have tightened up the server end 
as much as possible, but not eliminated the problem.


The javascript solution is the only reliable one that I've found but 
some sites do not allow it to be enabled. Since having finally 
identified the source of the problem, we have improved education and 
can now 'spot' a double clicker who in many cases does not even know 
they are doing it! People get so used TO double clicking things on 
the desktop :( But in some case we suspect that the BROWSER send two 
requests perhaps because of a noisy keyboard! On one site that we 
pinned down to a particular counter position, changing the keyboard 
fixed the problem ( enter was pressing the button ).


Just a word of warning that may explain the occasional double order ;)

--
Lester Caine - G8HFL


Well that sounds good enough reason to use javascript.

I'll add that too.

Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: fwrite/fclose troubles

2008-03-22 Thread Mark Weaver

Dave Goodchild wrote:

Why are you writing a logging class? Why not use error_log and enable error
logging?



two reasons actually,

1. learning OOP for PHP, so the more I practice at it the better I get.

2. the logging that's being done with this class is done primarily for 
debugging during the development phase of the application itself. That 
way during run-time I can tail the log file and see where a portion of 
the app is failing if it fails or simply tell me where it's at and what 
it's doing.


Standard error logging wasn't giving me the feedback that I needed at 
the time and debug logging is a habit I got into when I learned PERL to 
help tell me where things were failing.


Mark

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



Re: [PHP] Re: fwrite/fclose troubles

2008-03-22 Thread Mark Weaver

Al wrote:
int file_put_contents ( string $filename, mixed $data [, int $flags [, 
resource $context]] )


This function is identical to calling fopen(), fwrite() and fclose() 
successively to write data to a file.


This native function does it for you



Very nice! I wasn't aware of this one. Thank you!!

Mark


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



[PHP] Re: fwrite/fclose troubles

2008-03-22 Thread Al

Seems like this does what you are attempting.
if(DEBUG_MODE) // TRUE for debug only
{
ini_set(display_errors, on); //use off if users will see them

error_reporting(E_ALL);

echo 'span style=color:redError display and logging on/span  ';
}


Mark Weaver wrote:

Hi all,

I've been lurking and reading now for some time, but have decided to
come out of the shadows cause I've got an issue that's gonna drive me 
crazy!


I'm developing an application and within this application is a class
that is very simple and only serves a singular purpose - to make log
entries to help with debugging. Problem is, now I'm debugging the damned
logging class that is supposed to be helping me debug the application as
I'm putting it together! sigh I've looked and looked all over the
place, but I don't seem to be able to find an answer to this problem.
The only information that I have found so far deals with permissions and
I don't think that's the problem. At first I was getting an access
denied error but since setting dir perms and log file perms so that both
apache and my user can right to both the directory and the file that one
has gone away.

Log Directory permissions: /mystuff/logs  rwx-rwx-rwx (777)
Log file permissions: /mystuff/logs/run.log   rwx-rwx-rwx
(777)

At any rate, the following is the information I'm getting in the apache
error_log while working on this particular portion of the application:

PHP Warning:  fwrite(): supplied argument is not a valid stream resource
in /mystuff/inc/Log.inc on line 22,
PHP Warning:  fclose(): supplied argument is not a valid stream resource
in /mystuff/inc/Log.inc on line 23,

The Log class:
-
class Log{
public $path, $entry, $logfile;

public function Log(){}

public function setLog($path,$file){

$this-path = $path;
$this-logfile = $file;
}

public function writeLog($entry){

// open the file, in this case the log file
$h = $this-path/$this-logfile;
fopen($h, 'a+');
fwrite($h,$entry);
fclose($h);
}
}

Code snippet where attempting to write log entry from program:
 


$pl_log = new Log;
$pl_log-setLog($logpath,run.log);
   
$usernanme = $_POST['username'];

$password = $_POST['secret'];
   
/**

   * (debugging) logging incoming values from form:
   */
$pl_log-writeLog(getDateTime(): Incoming values from Login Form:
blah...blah...blah\n);

Any help with this would be most appreciated. (be gentle... I'm a PERL
program learning PHP OOP)



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



Re: [PHP] Re: fwrite/fclose troubles

2008-03-22 Thread Mark Weaver

Al wrote:

Seems like this does what you are attempting.
if(DEBUG_MODE) // TRUE for debug only
{
ini_set(display_errors, on); //use off if users will see them

error_reporting(E_ALL);

echo 'span style=color:redError display and logging on/span  ';
}



If I understand this correctly this if statement directs php to check 
the main ini config file and if certain conditions are met then it 
displays the information in the browser window. Useful, but it would 
seem, at least to me at the moment, that if the script fails before it's 
even able to get anything to the screen then nothing gets displayed.


Mark

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



[PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

Hi all,

I'm wondering if anyone else happens to be using Mozilla Thunderbird and 
seeing this behavior, and also if this behavior is a feature or a bug.


When I hit the reply button to respond to a message most of the time the 
actual sender's address is the one the message is being sent to rather 
than the list itself. This is the first mailing list I've been on that 
I've seen this behavior; all other lists I'm on when one hits the reply 
button, or CTRL+R the mailing list's address is inserted as it should be 
and is expected.


I know with some email clients there is a menu item specifically there 
for responding to the list based on whether or not there is a 
list-header in the header information but that isn't an available option 
with Thunderbird. Is anyone else seeing this behavior or is there 
something I'm missing?


Mark

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Greg Bowser
Yeah.  I always forget to reply to all.

The problem is with the headers.  Whereas other lists have a reply-to:
mailing list address in the email headers, this list does not.  It annoys
the hell out of me.

On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED] wrote:

 Hi all,

 I'm wondering if anyone else happens to be using Mozilla Thunderbird and
 seeing this behavior, and also if this behavior is a feature or a bug.

 When I hit the reply button to respond to a message most of the time the
 actual sender's address is the one the message is being sent to rather
 than the list itself. This is the first mailing list I've been on that
 I've seen this behavior; all other lists I'm on when one hits the reply
 button, or CTRL+R the mailing list's address is inserted as it should be
 and is expected.

 I know with some email clients there is a menu item specifically there
 for responding to the list based on whether or not there is a
 list-header in the header information but that isn't an available option
 with Thunderbird. Is anyone else seeing this behavior or is there
 something I'm missing?

 Mark

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




RE: [PHP] best method for relative linking in php

2008-03-22 Thread Brandon Orther
Hello Sudhakar,

I have added #firstError to the end of my script url and then if I have an
error, I add that anchor to the first error on the page.  This way I don't
have to use any javascript to leap the person forward to the first error.

I think this is what you are doing with your first method.  That should be 

Kind Regards,
Brandon Orther

-Original Message-
From: Sudhakar [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 22, 2008 4:26 AM
To: php-general@lists.php.net
Subject: [PHP] best method for relative linking in php

i have a registration page where a user fills a form and i display an error
message if a validation message needs to be displayed which i have written
in php. everything works fine. the way the form is made presently is there
is a huge amount of information relating to general information about the
form and its terms and conditions which is compulsory. so if i have to
display any validation message the user has to scroll the page from the top
again all the way till they see the validation message.

i have used relative linking as it is done in html, so that the user does
not have to scroll from the top of the page, rather the page stops where i
want it to so the user see the message and does not have to scroll the page.

following are the 2 methods i have used and both of them work fine. however
in method 2 as it is based on javascript and if
javascript is turned off the relative linking will not work and the user
will have to scroll from the top of the page again and i have tested this
myself.

method 1

form action=?php echo $_SERVER[PHP_SELF]; ?#indrel method=POST
id=test2 name=registrationform 
a name=indrel/a

 if($error)
 {
 echo $error;
 }

method 2

form action=?php echo $_SERVER[PHP_SELF]; ? method=POST id=test2
name=registrationform 
a name=indrel/a

 if($error)
 {
 echo (
 script language='javascript' type='text/javascript'
 window.location.href='http://website.com/filename.php#indrel'
 /script
 );

 echo $error;
 }

please comment if method 1 is correct in terms of the syntax of the form tag
if it is correct or not though i know this method is working the way i want
it to, i wanted to confirm before i implement it for my website.

please advice.

thanks.


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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Nilesh Govindrajan

Greg Bowser wrote:

Yeah.  I always forget to reply to all.

The problem is with the headers.  Whereas other lists have a reply-to:
mailing list address in the email headers, this list does not.  It annoys
the hell out of me.

On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED] wrote:


Hi all,

I'm wondering if anyone else happens to be using Mozilla Thunderbird and
seeing this behavior, and also if this behavior is a feature or a bug.

When I hit the reply button to respond to a message most of the time the
actual sender's address is the one the message is being sent to rather
than the list itself. This is the first mailing list I've been on that
I've seen this behavior; all other lists I'm on when one hits the reply
button, or CTRL+R the mailing list's address is inserted as it should be
and is expected.

I know with some email clients there is a menu item specifically there
for responding to the list based on whether or not there is a
list-header in the header information but that isn't an available option
with Thunderbird. Is anyone else seeing this behavior or is there
something I'm missing?

Mark

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






Doesn't happen with me because I use Newsgroup type subscription system. 
I.e. I have created a newsgroup account for news.php.net


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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

Nilesh Govindrajan wrote:

Greg Bowser wrote:

Yeah.  I always forget to reply to all.

The problem is with the headers.  Whereas other lists have a reply-to:
mailing list address in the email headers, this list does not.  It 
annoys

the hell out of me.



Why in the bloody hell doesn't the list admin simply add that reply-to 
header. As far as I know Sendmail adds that auto-magically by default. 
(I'm assuming they're not using Sendmail as the lists' MTA). It sure 
would make life easier wouldn't it? How long has it been this way?


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



[PHP] Comparing file creating dates...

2008-03-22 Thread Ryan S
Hey all,

Heres what i am trying to do:

When someone sends a message from my site, i take their ip address and make a 
file with their ip address in a directory called hash-directory, the file 
looks like this: 169.34.534.243.txt

I want to make sure they cant send too many messages because of the potential 
to spam, so I want to limit them to sending a message every X number of 
minutes... heres what i have written (its not working for some damn reason)

# Start PHP file 

if(isset($_SERVER['REMOTE_ADDR']))
{$rem_address=$_SERVER['REMOTE_ADDR'];}

$directory_with_files=hash-directory/;
$threshold = strtotime('-2 minutes');

echo File created on: b.$rem_address ..txt - . date(F d Y H:i:s., 
filectime($directory_with_files.$rem_address..txt)). 
.$file_time_details[0]./bbrbr;

if (file_exists($directory_with_files.$rem_address..txt)) 
{

if (getdate(filectime($directory_with_files.$rem_address..txt))  
$threshold)
{echo bPlease wait more than 1 minute before posting./bbr;}
else{echo bEnough time has elapsed./bbr;}
}

# END PHP file 


Where am I going wrong?

Thanks!
Ryan
 
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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



RE: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Brandon Orther
I just signed back up to the list recently, but it was like this 5 years ago
when I was still on it.  I have always wondered why they didn't have that.
It seems like they are pushing people to submit their solutions to the
person with the question.

Kind Regards,
Brandon Orther


-Original Message-
From: Mark Weaver [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 22, 2008 10:57 AM
To: php-general@lists.php.net
Subject: Re: [PHP] strange list behavior when replying to message on list

Nilesh Govindrajan wrote:
 Greg Bowser wrote:
 Yeah.  I always forget to reply to all.

 The problem is with the headers.  Whereas other lists have a reply-to:
 mailing list address in the email headers, this list does not.  It 
 annoys
 the hell out of me.


Why in the bloody hell doesn't the list admin simply add that reply-to 
header. As far as I know Sendmail adds that auto-magically by default. 
(I'm assuming they're not using Sendmail as the lists' MTA). It sure 
would make life easier wouldn't it? How long has it been this way?

-- 
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.
==
Powered by CentOS5 (RHEL5)

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


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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Nilesh Govindrajan

Brandon Orther wrote:

I just signed back up to the list recently, but it was like this 5 years ago
when I was still on it.  I have always wondered why they didn't have that.
It seems like they are pushing people to submit their solutions to the
person with the question.

Kind Regards,
Brandon Orther


-Original Message-
From: Mark Weaver [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 22, 2008 10:57 AM

To: php-general@lists.php.net
Subject: Re: [PHP] strange list behavior when replying to message on list

Nilesh Govindrajan wrote:

Greg Bowser wrote:

Yeah.  I always forget to reply to all.

The problem is with the headers.  Whereas other lists have a reply-to:
mailing list address in the email headers, this list does not.  It 
annoys

the hell out of me.



Why in the bloody hell doesn't the list admin simply add that reply-to 
header. As far as I know Sendmail adds that auto-magically by default. 
(I'm assuming they're not using Sendmail as the lists' MTA). It sure 
would make life easier wouldn't it? How long has it been this way?




The list admin, if uses a program called ezlm (or something similar), it 
adds the List-Id or the Newsgroups header which also helps.


They must have it.

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

Brandon Orther wrote:

I just signed back up to the list recently, but it was like this 5 years ago
when I was still on it.  I have always wondered why they didn't have that.
It seems like they are pushing people to submit their solutions to the
person with the question.

Kind Regards,
Brandon Orther


Boy! is this tempting...

I've got a sendmail server running with Mailman installed on it that I'm 
already running lists on it.


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

Nilesh Govindrajan wrote:


The list admin, if uses a program called ezlm (or something similar), it 
adds the List-Id or the Newsgroups header which also helps.


They must have it.



hmmm... I wonder if Sylpheed for Windows will handle this? I'll have to 
take a look.


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Andrew Ballard
On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED] wrote:
 Hi all,

  I'm wondering if anyone else happens to be using Mozilla Thunderbird and
  seeing this behavior, and also if this behavior is a feature or a bug.

  When I hit the reply button to respond to a message most of the time the
  actual sender's address is the one the message is being sent to rather
  than the list itself. This is the first mailing list I've been on that
  I've seen this behavior; all other lists I'm on when one hits the reply
  button, or CTRL+R the mailing list's address is inserted as it should be
  and is expected.

  I know with some email clients there is a menu item specifically there
  for responding to the list based on whether or not there is a
  list-header in the header information but that isn't an available option
  with Thunderbird. Is anyone else seeing this behavior or is there
  something I'm missing?

  Mark


It's not specific to Thunderbird or any other mail client. I'm pretty
sure it was configured that way on purpose. Have a look at this
thread:

http://marc.info/?l=php-generalm=105700032521606w=2

Andrew

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread tedd

At 11:22 AM -0400 3/22/08, Greg Bowser wrote:

Yeah.  I always forget to reply to all.


I always reply to all and then cut out everything that isn't 
[EMAIL PROTECTED]


I know, there's probably a better way, but that's what I do.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

Andrew Ballard wrote:

On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED] wrote:

Hi all,

 I'm wondering if anyone else happens to be using Mozilla Thunderbird and
 seeing this behavior, and also if this behavior is a feature or a bug.

 When I hit the reply button to respond to a message most of the time the
 actual sender's address is the one the message is being sent to rather
 than the list itself. This is the first mailing list I've been on that
 I've seen this behavior; all other lists I'm on when one hits the reply
 button, or CTRL+R the mailing list's address is inserted as it should be
 and is expected.

 I know with some email clients there is a menu item specifically there
 for responding to the list based on whether or not there is a
 list-header in the header information but that isn't an available option
 with Thunderbird. Is anyone else seeing this behavior or is there
 something I'm missing?

 Mark



It's not specific to Thunderbird or any other mail client. I'm pretty
sure it was configured that way on purpose. Have a look at this
thread:

http://marc.info/?l=php-generalm=105700032521606w=2

Andrew



well, obviously since the issue still exists it's clear that this never 
got resolved. I just don't understand the obstenant behavior of some 
folks in the presence of clear and plain logic. Especially from a 
programmer. Makes no sense at all.


Guess I'm off to create the necessary recipe for Procmail to do the 
adult thing and make sense of the non-sense.


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Mark Weaver

tedd wrote:

At 11:22 AM -0400 3/22/08, Greg Bowser wrote:

Yeah.  I always forget to reply to all.


I always reply to all and then cut out everything that isn't 
[EMAIL PROTECTED]


I know, there's probably a better way, but that's what I do.

Cheers,

tedd


That's what I've been doing as well until I get procmail setup to do it 
for me.


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] Procmail Recipe to INSERT reply-to header (was: strange list behavior when replying to message on list)

2008-03-22 Thread Mark Weaver

tedd wrote:

At 11:22 AM -0400 3/22/08, Greg Bowser wrote:

Yeah.  I always forget to reply to all.


I always reply to all and then cut out everything that isn't 
[EMAIL PROTECTED]


I know, there's probably a better way, but that's what I do.

Cheers,

tedd


Just in case you Do have access to procmail the recipe below should do 
the trick for fixing this annoying feature. Just keep telling yourself 
it's a feature and not a bug.  :)


-

 # fixing the MISSING reply-to header on PHP list messages
 # This adds a Reply-To: header
:0 fhw
* ^Received:.*from lists.php.net
|formail -I Reply-To: php-general@lists.php.net


--
Mark

If you have found a very wise man, then you've found a man that at one 
time was an idiot and lived long enough to learn from his own stupidity.

==
Powered by CentOS5 (RHEL5)

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



Re: [PHP] Comparing file creating dates...

2008-03-22 Thread Jim Lucas

Ryan S wrote:

Hey all,

Heres what i am trying to do:

When someone sends a message from my site, i take their ip address and make a file with 
their ip address in a directory called hash-directory, the file looks like 
this: 169.34.534.243.txt

I want to make sure they cant send too many messages because of the potential 
to spam, so I want to limit them to sending a message every X number of 
minutes... heres what i have written (its not working for some damn reason)

# Start PHP file 

if(isset($_SERVER['REMOTE_ADDR']))
{$rem_address=$_SERVER['REMOTE_ADDR'];}

$directory_with_files=hash-directory/;
$threshold = strtotime('-2 minutes');

echo File created on: b.$rem_address ..txt - . date(F d Y H:i:s., 
filectime($directory_with_files.$rem_address..txt)). .$file_time_details[0]./bbrbr;

if (file_exists($directory_with_files.$rem_address..txt)) 
{


if (getdate(filectime($directory_with_files.$rem_address..txt))  
$threshold)



From the manual

This returns a timestamp
int strtotime  ( string $time  [, int $now  ] )

This returns an hash array with all the date/time info in it.
array getdate  ([ int $timestamp  ] )

You are trying to compare two things that are completely different.

Get rid of the getdate() function.  All you need is the filectime() 
call, it returns a unix timestamp.



{echo bPlease wait more than 1 minute before posting./bbr;}
else{echo bEnough time has elapsed./bbr;}
}

# END PHP file 


Where am I going wrong?

Thanks!
Ryan
 
--

- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping





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



Re: [PHP] Procmail Recipe to INSERT reply-to header (was: strange list behavior when replying to message on list)

2008-03-22 Thread tedd

At 2:30 PM -0400 3/22/08, Mark Weaver wrote:

tedd wrote:

At 11:22 AM -0400 3/22/08, Greg Bowser wrote:

Yeah.  I always forget to reply to all.


I always reply to all and then cut out everything that isn't 
[EMAIL PROTECTED]


I know, there's probably a better way, but that's what I do.

Cheers,

tedd


Just in case you Do have access to procmail the recipe below 
should do the trick for fixing this annoying feature. Just keep 
telling yourself it's a feature and not a bug.  :)


-

 # fixing the MISSING reply-to header on PHP list messages
 # This adds a Reply-To: header
:0 fhw
* ^Received:.*from lists.php.net
|formail -I Reply-To: php-general@lists.php.net



I use Eudora, so I haven't a clue.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: Returned mail: see transcript for details

2008-03-22 Thread L-Soft list server at AudetteMedia (1.8d)
 JOIN I-WINSOFT
Sorry, the  I-WINSOFT list  is closed.  Contact the  list owner
([EMAIL PROTECTED]) for more information.


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



[PHP] sprintf problem...

2008-03-22 Thread Richard
Hello, I'm trying to write a invoice script but I have encountered a 
slight problem.
Each product needs to be listed without tax, and at the end of the file 
I need to show the VAT. In France VAT is 19.6%

So €10.03 without vat = €12.00 with vat.
So I do this :

$totalwithoutvat = 0;
$totalwithoutvat = 0;
$totalvat =0;
while ( $itemwithoutvat) = each( $px ) )
{
$totalwithoutvat += $itemwithoutvat;
$totalwithoutvat += sprintf(%0.2f, $itemwithoutvat * ( 1 + 19.6/100 ));
$totalvat += sprintf(%0.2f,$itemwithoutvat * 19.6/100);
}
print (Total Vat =.sprintf(%0.2f,$totalvat). - Total without vat = 
.sprintf(%0.2f,$totalwithoutvat). - Total with vat = 
.sprintf(%0.2f,$totalwithvat));


But I'm not sure I am using sprintf correctly, maybe I should use a 
different function because :
When I have one item at 10.03, the result is : Total Vat = 1.97 - Total 
without vat = 10.03 Total with vat = 12.00
but if I have two items at 10.03 the result is : Total vat = 3.93 - 
Total without vat = 20.06 Total with vat = 23.99
but I need it to be : Total vat = 3.94 - Total without vat = 20.06 Total 
with vat = 24.00
So from what I can see, sprintf only seems to work for printing and the 
actual result is kept in memory, is this correct ? if so what function 
should I use instead?


Thanks in advance :)

Richard









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



Re: [PHP] sprintf problem... (with simplified code )

2008-03-22 Thread Richard

Here is a simplifie version of my code :

?php
$total = 0;
$ht = 10.03;
$vat = 19.6;
$total += $ht*($vat/100+1);
print(Total = .sprintf(%0.2f, $total));
$total += $ht*($vat/100+1);
print( - Total 2 = .sprintf(%0.2f, $total));
?

I get 12.00 and 23.99 ... what should I do to get 12.00 and 24.00 ?


Richard a écrit :
Hello, I'm trying to write a invoice script but I have encountered a 
slight problem.
Each product needs to be listed without tax, and at the end of the 
file I need to show the VAT. In France VAT is 19.6%

So €10.03 without vat = €12.00 with vat.
So I do this :

$totalwithoutvat = 0;
$totalwithoutvat = 0;
$totalvat =0;
while ( $itemwithoutvat) = each( $px ) )
{
$totalwithoutvat += $itemwithoutvat;
$totalwithoutvat += sprintf(%0.2f, $itemwithoutvat * ( 1 + 19.6/100 ));
$totalvat += sprintf(%0.2f,$itemwithoutvat * 19.6/100);
}
print (Total Vat =.sprintf(%0.2f,$totalvat). - Total without vat 
= .sprintf(%0.2f,$totalwithoutvat). - Total with vat = 
.sprintf(%0.2f,$totalwithvat));


But I'm not sure I am using sprintf correctly, maybe I should use a 
different function because :
When I have one item at 10.03, the result is : Total Vat = 1.97 - 
Total without vat = 10.03 Total with vat = 12.00
but if I have two items at 10.03 the result is : Total vat = 3.93 - 
Total without vat = 20.06 Total with vat = 23.99
but I need it to be : Total vat = 3.94 - Total without vat = 20.06 
Total with vat = 24.00
So from what I can see, sprintf only seems to work for printing and 
the actual result is kept in memory, is this correct ? if so what 
function should I use instead?


Thanks in advance :)

Richard



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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Shawn McKenzie
Mark Weaver wrote:
 Andrew Ballard wrote:
 On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED]
 wrote:
 Hi all,

  I'm wondering if anyone else happens to be using Mozilla Thunderbird
 and
  seeing this behavior, and also if this behavior is a feature or a bug.

  When I hit the reply button to respond to a message most of the time
 the
  actual sender's address is the one the message is being sent to rather
  than the list itself. This is the first mailing list I've been on that
  I've seen this behavior; all other lists I'm on when one hits the reply
  button, or CTRL+R the mailing list's address is inserted as it
 should be
  and is expected.

  I know with some email clients there is a menu item specifically there
  for responding to the list based on whether or not there is a
  list-header in the header information but that isn't an available
 option
  with Thunderbird. Is anyone else seeing this behavior or is there
  something I'm missing?

  Mark


 It's not specific to Thunderbird or any other mail client. I'm pretty
 sure it was configured that way on purpose. Have a look at this
 thread:

 http://marc.info/?l=php-generalm=105700032521606w=2

 Andrew

 
 well, obviously since the issue still exists it's clear that this never
 got resolved. I just don't understand the obstenant behavior of some
 folks in the presence of clear and plain logic. Especially from a
 programmer. Makes no sense at all.
 
 Guess I'm off to create the necessary recipe for Procmail to do the
 adult thing and make sense of the non-sense.
 
I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail.  I
have news.php.net setup as a news account.  I do receive and have
received frequent timeouts contacting the news server though.  Has been
a pain for quite awhile.

-Shawn

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



[PHP] Re: strange list behavior when replying to message on list

2008-03-22 Thread Shawn McKenzie
Mark Weaver wrote:
 Hi all,
 
 I'm wondering if anyone else happens to be using Mozilla Thunderbird and
 seeing this behavior, and also if this behavior is a feature or a bug.
 
 When I hit the reply button to respond to a message most of the time the
 actual sender's address is the one the message is being sent to rather
 than the list itself. This is the first mailing list I've been on that
 I've seen this behavior; all other lists I'm on when one hits the reply
 button, or CTRL+R the mailing list's address is inserted as it should be
 and is expected.
 
 I know with some email clients there is a menu item specifically there
 for responding to the list based on whether or not there is a
 list-header in the header information but that isn't an available option
 with Thunderbird. Is anyone else seeing this behavior or is there
 something I'm missing?
 
 Mark
Thunderbird 2.x on Kubuntu, If I 'reply all' I get:

to: [EMAIL PROTECTED]
cc: php-general@lists.php.net
newsgroup: php.general

If I right click and reply to newsgroup I get newsgroup: php.general

-Shawn

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



Re: [PHP] Comparing file creating dates...

2008-03-22 Thread Al

you may need to use filemtime() and not filectime();

Jim Lucas wrote:

Ryan S wrote:

Hey all,

Heres what i am trying to do:

When someone sends a message from my site, i take their ip address and 
make a file with their ip address in a directory called 
hash-directory, the file looks like this: 169.34.534.243.txt


I want to make sure they cant send too many messages because of the 
potential to spam, so I want to limit them to sending a message every 
X number of minutes... heres what i have written (its not working for 
some damn reason)


# Start PHP file 

if(isset($_SERVER['REMOTE_ADDR']))
{$rem_address=$_SERVER['REMOTE_ADDR'];}

$directory_with_files=hash-directory/;
$threshold = strtotime('-2 minutes');

echo File created on: b.$rem_address ..txt - . date(F d Y 
H:i:s., filectime($directory_with_files.$rem_address..txt)). 
.$file_time_details[0]./bbrbr;


if (file_exists($directory_with_files.$rem_address..txt)) {

if 
(getdate(filectime($directory_with_files.$rem_address..txt))  
$threshold)



 From the manual

This returns a timestamp
int strtotime  ( string $time  [, int $now  ] )

This returns an hash array with all the date/time info in it.
array getdate  ([ int $timestamp  ] )

You are trying to compare two things that are completely different.

Get rid of the getdate() function.  All you need is the filectime() 
call, it returns a unix timestamp.


{echo bPlease wait more than 1 minute before 
posting./bbr;}

else{echo bEnough time has elapsed./bbr;}
}

# END PHP file 


Where am I going wrong?

Thanks!
Ryan
 
--

- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




  
 

Looking for last minute shopping deals?  Find them fast with Yahoo! 
Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping






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



Re: [PHP] strange list behavior when replying to message on list

2008-03-22 Thread Nilesh Govindrajan

Shawn McKenzie wrote:

Mark Weaver wrote:

Andrew Ballard wrote:

On Sat, Mar 22, 2008 at 11:13 AM, Mark Weaver [EMAIL PROTECTED]
wrote:

Hi all,

 I'm wondering if anyone else happens to be using Mozilla Thunderbird
and
 seeing this behavior, and also if this behavior is a feature or a bug.

 When I hit the reply button to respond to a message most of the time
the
 actual sender's address is the one the message is being sent to rather
 than the list itself. This is the first mailing list I've been on that
 I've seen this behavior; all other lists I'm on when one hits the reply
 button, or CTRL+R the mailing list's address is inserted as it
should be
 and is expected.

 I know with some email clients there is a menu item specifically there
 for responding to the list based on whether or not there is a
 list-header in the header information but that isn't an available
option
 with Thunderbird. Is anyone else seeing this behavior or is there
 something I'm missing?

 Mark


It's not specific to Thunderbird or any other mail client. I'm pretty
sure it was configured that way on purpose. Have a look at this
thread:

http://marc.info/?l=php-generalm=105700032521606w=2

Andrew


well, obviously since the issue still exists it's clear that this never
got resolved. I just don't understand the obstenant behavior of some
folks in the presence of clear and plain logic. Especially from a
programmer. Makes no sense at all.

Guess I'm off to create the necessary recipe for Procmail to do the
adult thing and make sense of the non-sense.


I use Thunderbird 2.x on Kubuntu and I just hit reply to this mail.  I
have news.php.net setup as a news account.  I do receive and have
received frequent timeouts contacting the news server though.  Has been
a pain for quite awhile.

-Shawn


That's what I also do. :D I have thunderbird 2.x on Fedora 8. So, it 
works. :)


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



[PHP] Re: pulling text from a file

2008-03-22 Thread Nilesh Govindrajan

Richard Kurth wrote:
I have a text file that looks like the one below. I need to read the 
file into a database.

I was trying the script below but is not working can you help?

$lines = file_get_contents('clientlist1.txt');

$find=Address:;
$f= strstr($f,$find);
$separat=City:;
$ADDRESS = substr($f, 0, strpos($f,$separat));
$ADDRESS=ltrim($ADDRESS,Address:);
$ADDRESS=trim($ADDRESS);
echo $ADDRESS;
echo br;

$find=City:;
$f= strstr($f,$find);
$separat=State:;
$CITY = substr($f, 0, strpos($f,$separat));
$CITY=ltrim($CITY,City:);
$CITY=trim($CITY);
echo $CITY;
echo br;

Text File

Address:  5070 myaddress.
City: mycity State: mystateZip: 97268
County:
Signers

Name: my name

Address:  3925 myaddress.
City: mycity2 State: mystate2 Zip: 97268
County:
Signers

Name: my name2


If the place where you run this script has PHP  5.1 installed, then you 
could use SimpleXML for this purpose. If the document MUST be in XML 
format. I don't know such methods in PHP 4, etc. On my server, I have 
PHP 5.2.5


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



[PHP] Re: spider

2008-03-22 Thread Nilesh Govindrajan

tedd wrote:

Hi gang:

How do you spider a remote web site in php?

I get the general idea, which is to take the root page, strip out the 
links and repeat the process on those links. But, what's the code? Does 
anyone have an example they can share or a direction for me to take?


Also, is there a way to spider through a remote web site gathering 
directory permissions?


I know there are applications, such as Site-sucker, that will travel a 
remote web site looking for anything that it can download and if found, 
do so. But is there a way to determine what the permissions are for 
those directories?


If not, can one attempt to write a file and record the 
failures/successes (0777 directories)?


What I am trying to do is to develop a way to test if a web site is 
secure or not. I'm not trying to develop evil code, but if it can be 
done then I want to know how.


Thanks and Cheers,

tedd



There is a complete search engine called Mihalism Search Engine which 
uses PHP to spider websites. Its available for free download. You could 
explore its source code and make your own. :)


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



[PHP] Re: question about customized error

2008-03-22 Thread Nilesh Govindrajan

Sudhakar wrote:

if a user by mistake types the wrong url directly in the address bar ex=
www.website.com/abou.php instead of
typing www.website.com/aboutus.php instead of the browser displaying File
not found or a 404 error message i would like to display a customized page
which will still have the same look and feel of my website in terms of the
layout and i would like to
a) display a message such as = Page could not be found and b) the url that
the user originally typed should remain in the browser = I guess this would
be the case anyway but i was wondering if something needs to be done in
order to reatin the original address the user typed.

Does this have to be done from apache perspective or can it be done using
php. please suggest the procedure in either case apache OR php.

please advice.

thanks.



.htaccess:

ErrorDocument 404 /404-error.php

404-error.php:

?php

soem code

?

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



[PHP] Re: selling gpl software?

2008-03-22 Thread Nilesh Govindrajan

Colin Guthrie wrote:

Larry Garfield wrote:
If the code is work for hire and the initial ownership is with the 
client/company, then there is no distribution and so you are not required to 
do anything.  That includes if you are a full time employee of the company.


OK, that's more or less my understanding.

It is my understanding that, by default, contracting law states that any
work done under contract is your (the contractor's) copyright (e.g. on a
very loose contract that is the default case). Many employers of
contractors will typically change this default stance.

So in the OP's case, if he takes an existing GPLed project, modifies it in 
whatever way (including removing mention of the original project), and gives 
a copy to his client, his only legal obligation is to provide the client with 
the code under the GPL so that the client can, if he wants, pass the code on 
to someone else under the GPL.  Someone else could be a public FTP server 
or not.


I was half assuming the stance of the employer here was that he did not
want the changes shared.

So assuming this and the above note about contract law etc., then my
original statement is correct.

Whether these assumptions are correct in themselves (and this my whole
thread of assumption breaks down!), I'll leave for future research and
happily live in my bubble of ignorance ;)

Col




Larry, read the GPL license. It has can be used, distributed, modified 
under GPL only.


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



RE: [PHP] Re: problem with sessions config.

2008-03-22 Thread N . Boatswain

Thanks for your answers people; but i'm still having the problem, ¿any approach 
to the reason?. Remember everything works fine in on-line servers, so it may 
not be a problem of the code, but a config. one;cheers,
Nicolas.


 To: php-general@lists.php.net
 Date: Sat, 22 Mar 2008 13:58:15 +0530
 From: [EMAIL PROTECTED]
 Subject: [PHP] Re: problem with sessions config.
 
 N . Boatswain wrote:
  Hello guys; i'm having a problem with session behavior; i'm going straight 
  to it, but first some considerations:
  PHP Version 5.2.5IIF 5.1Running on localhost (XP machine)I start sessions 
  at the top of every page. 
  
  A the start of a test page, just as example, i do the assignment:   
  $_SESSION[username] = aaa;
  
  At the end of the same page i print it's value:  echo $_SESSION[username];
  
  And i get the layout: aaa, as expecteed.
  
  Then I redirect to another page. On that one, after initializating the 
  session (session_start();) print again the $_SESSION[username] content 
  and the result is empty. If i try the same code on a server (all this is on 
  my local machine), the code works as expected; so i think it is a 
  configuration problem, here is my php.ini part that correspond to session 
  configuration, so you can tell my if i'm doing anything wrong, long 
  comments where removed:
  
  [Session]; Handler used to store/retrieve data.session.save_handler = 
  files;session.save_path = /tmp BC 13/12/07session.save_path=/tmp; 
  Whether to use cookies.session.use_cookies = 1;session.cookie_secure = ; 
  This option enables administrators to make their users invulnerable to; 
  attacks which involve passing session ids in URLs; defaults to 
  0.session.use_only_cookies = 1; Name of the session (used as cookie 
  name).session.name = PHPSESSID; Initialize session on request 
  startup.session.auto_start = 1; Lifetime in seconds of cookie or, if 0, 
  until browser is restarted.session.cookie_lifetime = 0; The path for which 
  the cookie is valid.session.cookie_path = /; The domain for which the 
  cookie is valid.session.cookie_domain =; Whether or not to add the httpOnly 
  flag to the cookie, which makes it inaccessible to browser scripting 
  languages such as JavaScript.session.cookie_httponly = ; Handler used to 
  serialize data.  php is the standard serializer of PHP.session.serialize_ha
 ndler = php; Define the probability that the 'garbage collection' process is 
 started; on every session initialization.; The probability is calculated by 
 using gc_probability/gc_divisor,; e.g. 1/100 means there is a 1% chance that 
 the GC process starts; on each request.session.gc_probability = 
 1session.gc_divisor = 1000; After this number of seconds, stored data 
 will be seen as 'garbage' and; cleaned up by the garbage collection 
 process.session.gc_maxlifetime = 1440session.bug_compat_42 = 
 0session.bug_compat_warn = 1; Check HTTP Referer to invalidate externally 
 stored URLs containing ids.; HTTP_REFERER has to contain this substring for 
 the session to be; considered as valid.session.referer_check =; How many 
 bytes to read from the file.session.entropy_length = 0; Specified here to 
 create the session id.session.entropy_file =;session.entropy_length = 
 16;session.entropy_file = /dev/urandom; Set to {nocache,private,public,} to 
 determine HTTP caching aspects; or leave this empt
 y to avoid sending anti-caching headers.session.cache_limiter = nocache; 
 Document expires after n minutes.session.cache_expire = 
 180session.use_trans_sid = 0; Select a hash function; 0: MD5   (128 bits); 1: 
 SHA-1 (160 bits)session.hash_function = 0; Define how many bits are stored in 
 each character when converting; the binary hash data to something readable.;; 
 4 bits: 0-9, a-f; 5 bits: 0-9, a-v; 6 bits: 0-9, a-z, A-Z, -, 
 ,session.hash_bits_per_character = 5; The URL rewriter will look for URLs 
 in a defined set of HTML tags.; form/fieldset are special; if you include 
 them here, the rewriter will; add a hidden input field with the info which 
 is otherwise appended; to URLs.  If you want XHTML conformity, remove the 
 form entry.; Note that all valid entries require a =, even if no value 
 follows.url_rewriter.tags = 
 a=href,area=href,frame=src,input=src,form=,fieldset=
  
  Well, thanks and sorry for my english;
  
  Nicolás.
  
  
   
  _
  Watch “Cause Effect,” a show about real people making a real difference.  
  Learn more.
  http://im.live.com/Messenger/IM/MTV/?source=text_watchcause
 
 It works for me; I am using php-5.2.5 with lighttpd and FastCGI.
 
 I called session_start() on both the pages.
 
 and
 
 I have enabled session.use_trans_sid.
 
 You can temporarily override it from the php script by using this -
 ?
 //...other code
 ini_set(session.use_trans_sid,1);
 //...other code
 ?
 
 Try and report again.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php