php-general Digest 26 Aug 2011 00:33:17 -0000 Issue 7455

2011-08-25 Thread php-general-digest-help

php-general Digest 26 Aug 2011 00:33:17 - Issue 7455

Topics (messages 314603 through 314612):

Re: eaccelerator gone?
314603 by: Sharl.Jimh.Tsin

Re: Dealing with multiple form submissions
314604 by: Mike Mackintosh
314605 by: Andreas
314606 by: John Black
314607 by: Ashley Sheridan
314609 by: John Black

PHP within XML?
314608 by: Ron Piggott
314610 by: John Black
314611 by: Ken Robinson

How to catch an irregular end of an application?
314612 by: Andreas

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


--
---BeginMessage---
在 2011-08-24三的 16:31 +0100,Lester Caine写道:
 Anybody know what has happened to http://www.eaccelerator.net/
 
 Just trying to sort out the 5.3.8 updates, and I found I cant see the 
 eaccelerator site :(
 
 -- 
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php
 
no idea.if you want to get the source tarball,see its project page on
SF.net - http://sourceforge.net/projects/eaccelerator/;.
-- 
Best regards,
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**)

Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?10073.

---End Message---
---BeginMessage---
On Aug 25, 2011, at 5:01, John Black s...@network-technologies.org wrote:

 On 24.08.2011 21:38, Mike Mackintosh wrote:
 On Aug 24, 2011, at 11:52, John Blacks...@network-technologies.org  wrote:
 On 08/24/2011 03:04 AM, Jason Pruim wrote:
 Wondering what everyone does to prevent multiple form submissions?
 My form is simply getting emailed to my email, and it redirects to a 
 success page when submitted...
 Would it be as simple as doing something with the cache control? Basically 
 I'm trying to avoid someone submitting a form... Then hitting back, and 
 submitting again, then hitting back I think you get the idea...
 What do you all do?
 Jason Pruim
 I am using $_SESSION for this. Set a value on the initial page, a timestamp 
 is a good choice, then validate the value on the receiving script and clear 
 the value.
 I like to use a timestamp because it will allow you to deny a comment which 
 took too long to submit.
 I've always tended to stay away from session for that, as when the browser 
 closes/restarts, the page is accessible again.
 
 True, a SESSION can be reset by closing the browser but I am not trying to 
 deny a user from submitting different information again. I want to prevent 
 them from submitting the same data again by accident (back button or refresh).
 
 A visitor, enters on the form UI page, the session is set, user submits and 
 the form will reset the value in session to null or destroy it.
 
 If the visitor attempts to resubmit by using refresh then it will fail 
 because session does not contain an expected value anymore. That value is 
 generated on the UI page.
 
 If the user goes back with the back button then the browser should display 
 the page from cache. The script will not be called and it will not create a 
 new session value.
 If the browser does not use the cache it will have to reload the form. This 
 will create a new session value and an empty form so the user may type a new 
 message. This is like attempting to submit a new message and is something I 
 don't block.
 
 
 I do it this way because I don't want to prevent a visitor to submit new 
 information and I don't think that the original question wanted that.
 --
 John
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Ah, ok. For that I submit the page and do a header location to a thank you 
page. This will clear the post data if the back button us clicked.---End Message---
---BeginMessage---

Am 25.08.2011 11:01, schrieb John Black:


True, a SESSION can be reset by closing the browser but I am not 
trying to deny a user from submitting different information again. I 
want to prevent them from submitting the same data again by accident 
(back button or refresh).


what about storing an md5 of the message body in the db?
that way you could check if the mail is exactly the same.
probaply you could let the md5 stay in the db for hours so that nobody 
could use 2 browser windows to send mail1, mail2, mail1, 
it wouldn't even be necessary to store the identity of the sender since 
its highly inprobable that 2 100% identical messages contain anything 
worth bothering about.



http://php.net/manual/en/function.md5.php
---End 

Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread John Black

On 24.08.2011 21:38, Mike Mackintosh wrote:

On Aug 24, 2011, at 11:52, John Blacks...@network-technologies.org  wrote:

On 08/24/2011 03:04 AM, Jason Pruim wrote:

Wondering what everyone does to prevent multiple form submissions?
My form is simply getting emailed to my email, and it redirects to a success 
page when submitted...
Would it be as simple as doing something with the cache control? Basically I'm 
trying to avoid someone submitting a form... Then hitting back, and submitting 
again, then hitting back I think you get the idea...
What do you all do?
Jason Pruim

I am using $_SESSION for this. Set a value on the initial page, a timestamp is 
a good choice, then validate the value on the receiving script and clear the 
value.
I like to use a timestamp because it will allow you to deny a comment which 
took too long to submit.

I've always tended to stay away from session for that, as when the browser 
closes/restarts, the page is accessible again.


True, a SESSION can be reset by closing the browser but I am not trying 
to deny a user from submitting different information again. I want to 
prevent them from submitting the same data again by accident (back 
button or refresh).


A visitor, enters on the form UI page, the session is set, user submits 
and the form will reset the value in session to null or destroy it.


If the visitor attempts to resubmit by using refresh then it will fail 
because session does not contain an expected value anymore. That value 
is generated on the UI page.


If the user goes back with the back button then the browser should 
display the page from cache. The script will not be called and it will 
not create a new session value.
If the browser does not use the cache it will have to reload the form. 
This will create a new session value and an empty form so the user may 
type a new message. This is like attempting to submit a new message and 
is something I don't block.



I do it this way because I don't want to prevent a visitor to submit new 
information and I don't think that the original question wanted that.

--
John

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



Re: [PHP] eaccelerator gone?

2011-08-25 Thread Sharl.Jimh.Tsin
在 2011-08-24三的 16:31 +0100,Lester Caine写道:
 Anybody know what has happened to http://www.eaccelerator.net/
 
 Just trying to sort out the 5.3.8 updates, and I found I cant see the 
 eaccelerator site :(
 
 -- 
 Lester Caine - G8HFL
 -
 Contact - http://lsces.co.uk/wiki/?page=contact
 L.S.Caine Electronic Services - http://lsces.co.uk
 EnquirySolve - http://enquirysolve.com/
 Model Engineers Digital Workshop - http://medw.co.uk//
 Firebird - http://www.firebirdsql.org/index.php
 
no idea.if you want to get the source tarball,see its project page on
SF.net - http://sourceforge.net/projects/eaccelerator/;.
-- 
Best regards,
Sharl.Jimh.Tsin (From China **Obviously Taiwan INCLUDED**)

Using Gmail? Please read this important notice:
http://www.fsf.org/campaigns/jstrap/gmail?10073.


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



Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread Mike Mackintosh
On Aug 25, 2011, at 5:01, John Black s...@network-technologies.org wrote:

 On 24.08.2011 21:38, Mike Mackintosh wrote:
 On Aug 24, 2011, at 11:52, John Blacks...@network-technologies.org  wrote:
 On 08/24/2011 03:04 AM, Jason Pruim wrote:
 Wondering what everyone does to prevent multiple form submissions?
 My form is simply getting emailed to my email, and it redirects to a 
 success page when submitted...
 Would it be as simple as doing something with the cache control? Basically 
 I'm trying to avoid someone submitting a form... Then hitting back, and 
 submitting again, then hitting back I think you get the idea...
 What do you all do?
 Jason Pruim
 I am using $_SESSION for this. Set a value on the initial page, a timestamp 
 is a good choice, then validate the value on the receiving script and clear 
 the value.
 I like to use a timestamp because it will allow you to deny a comment which 
 took too long to submit.
 I've always tended to stay away from session for that, as when the browser 
 closes/restarts, the page is accessible again.
 
 True, a SESSION can be reset by closing the browser but I am not trying to 
 deny a user from submitting different information again. I want to prevent 
 them from submitting the same data again by accident (back button or refresh).
 
 A visitor, enters on the form UI page, the session is set, user submits and 
 the form will reset the value in session to null or destroy it.
 
 If the visitor attempts to resubmit by using refresh then it will fail 
 because session does not contain an expected value anymore. That value is 
 generated on the UI page.
 
 If the user goes back with the back button then the browser should display 
 the page from cache. The script will not be called and it will not create a 
 new session value.
 If the browser does not use the cache it will have to reload the form. This 
 will create a new session value and an empty form so the user may type a new 
 message. This is like attempting to submit a new message and is something I 
 don't block.
 
 
 I do it this way because I don't want to prevent a visitor to submit new 
 information and I don't think that the original question wanted that.
 --
 John
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Ah, ok. For that I submit the page and do a header location to a thank you 
page. This will clear the post data if the back button us clicked.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread Andreas

Am 25.08.2011 11:01, schrieb John Black:


True, a SESSION can be reset by closing the browser but I am not 
trying to deny a user from submitting different information again. I 
want to prevent them from submitting the same data again by accident 
(back button or refresh).


what about storing an md5 of the message body in the db?
that way you could check if the mail is exactly the same.
probaply you could let the md5 stay in the db for hours so that nobody 
could use 2 browser windows to send mail1, mail2, mail1, 
it wouldn't even be necessary to store the identity of the sender since 
its highly inprobable that 2 100% identical messages contain anything 
worth bothering about.



http://php.net/manual/en/function.md5.php

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



Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread John Black

On 25.08.2011 15:00, Andreas wrote:

Am 25.08.2011 11:01, schrieb John Black:

True, a SESSION can be reset by closing the browser but I am not
trying to deny a user from submitting different information again. I
want to prevent them from submitting the same data again by accident
(back button or refresh).

what about storing an md5 of the message body in the db?


Sure you can do all kinds of things with a database but I try to avoid 
unnecessary connection to the db because they are expensive.
It all comes down to how badly you want to prevent the same message to 
be sent twice.


I have seen bots submit the same message from multiple IPs and some will 
even modify the message a bit by adding some random data to the end. So 
I am not sure how effective a simple md5 check will be.

--
John

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



Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread Ashley Sheridan


John Black s...@network-technologies.org wrote:

On 25.08.2011 15:00, Andreas wrote:
 Am 25.08.2011 11:01, schrieb John Black:
 True, a SESSION can be reset by closing the browser but I am not
 trying to deny a user from submitting different information again. I
 want to prevent them from submitting the same data again by accident
 (back button or refresh).
 what about storing an md5 of the message body in the db?

Sure you can do all kinds of things with a database but I try to avoid
unnecessary connection to the db because they are expensive.
It all comes down to how badly you want to prevent the same message to
be sent twice.

I have seen bots submit the same message from multiple IPs and some
will
even modify the message a bit by adding some random data to the end. So

I am not sure how effective a simple md5 check will be.
--
John

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


So its the same message except for the bits at the bottom that are different? 
Sounds like its not the same message then.

Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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



[PHP] PHP within XML?

2011-08-25 Thread Ron Piggott

I am trying to figure out if it is possible to have PHP work within an XML 
document.

The application is tracking RSS subscribers IP addresses within the database.

I have wrote functions so the PHP code required is below is minimal, after the 
XML declaration line.  

Prior to posting this question I tried to have the PHP at the very start, but 
that doesn’t work, the declaration line needs to be first.

Right now the PHP is displayed as a comment.

Thoughts anyone?

Ron

===

?xml version=1.0 encoding=utf-8?
?php

#load RSS XML function

require_once(rss_subscribers_xml.php);

$ip_address = _ip;
rss_subscriber_update($ip_address);

?

RSS content starts here 

===

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info  


Re: [PHP] Dealing with multiple form submissions

2011-08-25 Thread John Black

On 25.08.2011 15:48, Ashley Sheridan wrote:

So its the same message except for the bits at the bottom that are different? 
Sounds like its not the same message then.
Ash


True, it is a message which has been intentionally modified to appear 
different even though 99.9% of the content is the same. Most humans will 
view the message as the same but it is not.


Anyway, the OP should have a few ideas now how to implement something 
that may work for his scenario.

--
John



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



Re: [PHP] PHP within XML?

2011-08-25 Thread John Black

On 25.08.2011 16:06, Ron Piggott wrote:

I am trying to figure out if it is possible to have PHP work within an XML 
document.
Right now the PHP is displayed as a comment.
Thoughts anyone?
Ron


How are you executing the XML file? By calling it with your browser?
You may need to tell your webserver that you want to treat your xml file 
as a PHP document.


You can use .htaccess for this and add something like this:
Files YourXMLFile
 ForceType application/x-httpd-php
/Files

Hope this helps.
--
John



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



Re: [PHP] PHP within XML?

2011-08-25 Thread Ken Robinson

Quoting Ron Piggott ron.pigg...@actsministries.org:



I am trying to figure out if it is possible to have PHP work within  
an XML document.


The application is tracking RSS subscribers IP addresses within the database.

I have wrote functions so the PHP code required is below is minimal,  
after the XML declaration line.


Prior to posting this question I tried to have the PHP at the very  
start, but that doesn’t work, the declaration line needs to be first.


Right now the PHP is displayed as a comment.


In order for your PHP code to be processed the file should be named  
with a .php extension. Since you're writing XML code, you need to send  
an XML header type first:

?php
header (Content-Type:text/xml);

#load RSS XML function

require_once(rss_subscribers_xml.php);

$ip_address = _ip;
rss_subscriber_update($ip_address);

echo '?xml version=1.0 encoding=utf-8?' . \n;
?
Rest of your XML content.


This should work.

Ken


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



[PHP] How to catch an irregular end of an application?

2011-08-25 Thread Andreas

Hi,
what is the best practice to catch an irregular end of an application?
The browser might crash or the user closes accidently the browser window 
decides to jump away to his favourite bloq without loging out of my 
application.
Is there some way to let an javascript event trigger some ajax to store 
an exit time into my DB or make it mandatory to at least visit the 
logout.php before someone can surf away?



regards

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



Re: [PHP] PhpMyAdmin in EasyPHP cannot run DROP DATABASE

2011-08-25 Thread Nam Gi VU
Hi Bastien,
I've create new user but cannot find where to log out to change logged-in
user.
This is strange...

On Thu, Aug 25, 2011 at 12:32 AM, Bastien Koert phps...@gmail.com wrote:

 On Wed, Aug 24, 2011 at 1:30 PM, Nam Gi VU nam.gi...@gmail.com wrote:
  Thanks Bastien for your suggestion.
  Though, I use the `root` account with `All privileges' but it still not
  allowing me to call `drop database'.
  What should I do next?
 
  On Wed, Aug 24, 2011 at 6:25 PM, Bastien phps...@gmail.com wrote:
 
  On 2011-08-23, at 6:44 AM, Nam Gi VU nam.gi...@gmail.com wrote:
 
   Hi every one,
   When trying to run my database script with `drop database` command,
 the
   server refuse and said as below screenshot.
   What should I do to enable this command?
  
   Regards,
   Nam
  
  
  
 
 
  Check that you phpmyadmin user account has the drop privilege. If not,
  grant that privilege or create another user account that does have more
  privileges
 
  Bastien
 
 
  --
  Nam
 

 try creating another user account, that isn't root (always a good
 habit) and giving that account the needed privileges and then
 configure PMA to use that account.

 --

 Bastien

 Cat, the other other white meat




-- 
Nam


Re: [PHP] PhpMyAdmin in EasyPHP cannot run DROP DATABASE

2011-08-25 Thread Bastien


On 2011-08-26, at 12:05 AM, Nam Gi VU nam.gi...@gmail.com wrote:

 Hi Bastien,
 I've create new user but cannot find where to log out to change logged-in 
 user.
 This is strange...
 
 On Thu, Aug 25, 2011 at 12:32 AM, Bastien Koert phps...@gmail.com wrote:
 On Wed, Aug 24, 2011 at 1:30 PM, Nam Gi VU nam.gi...@gmail.com wrote:
  Thanks Bastien for your suggestion.
  Though, I use the `root` account with `All privileges' but it still not
  allowing me to call `drop database'.
  What should I do next?
 
  On Wed, Aug 24, 2011 at 6:25 PM, Bastien phps...@gmail.com wrote:
 
  On 2011-08-23, at 6:44 AM, Nam Gi VU nam.gi...@gmail.com wrote:
 
   Hi every one,
   When trying to run my database script with `drop database` command, the
   server refuse and said as below screenshot.
   What should I do to enable this command?
  
   Regards,
   Nam
  
  
  
 
 
  Check that you phpmyadmin user account has the drop privilege. If not,
  grant that privilege or create another user account that does have more
  privileges
 
  Bastien
 
 
  --
  Nam
 
 
 try creating another user account, that isn't root (always a good
 habit) and giving that account the needed privileges and then
 configure PMA to use that account.
 
 --
 
 Bastien
 
 Cat, the other other white meat
 
 
 
 -- 
 Nam

You don't. Change the config.in.php file to use the new account

Bastien

Re: [PHP] PhpMyAdmin in EasyPHP cannot run DROP DATABASE

2011-08-25 Thread Nam Gi VU
And in which section Bastien. Please be more specific.

On Fri, Aug 26, 2011 at 11:14 AM, Bastien phps...@gmail.com wrote:



 On 2011-08-26, at 12:05 AM, Nam Gi VU nam.gi...@gmail.com wrote:

 Hi Bastien,
 I've create new user but cannot find where to log out to change logged-in
 user.
 This is strange...

 On Thu, Aug 25, 2011 at 12:32 AM, Bastien Koert  phps...@gmail.com
 phps...@gmail.com wrote:

 On Wed, Aug 24, 2011 at 1:30 PM, Nam Gi VU  nam.gi...@gmail.com
 nam.gi...@gmail.com wrote:
  Thanks Bastien for your suggestion.
  Though, I use the `root` account with `All privileges' but it still not
  allowing me to call `drop database'.
  What should I do next?
 
  On Wed, Aug 24, 2011 at 6:25 PM, Bastien  phps...@gmail.com
 phps...@gmail.com wrote:
 
  On 2011-08-23, at 6:44 AM, Nam Gi VU  nam.gi...@gmail.com
 nam.gi...@gmail.com wrote:
 
   Hi every one,
   When trying to run my database script with `drop database` command,
 the
   server refuse and said as below screenshot.
   What should I do to enable this command?
  
   Regards,
   Nam
  
  
  
 
 
  Check that you phpmyadmin user account has the drop privilege. If not,
  grant that privilege or create another user account that does have more
  privileges
 
  Bastien
 
 
  --
  Nam
 

 try creating another user account, that isn't root (always a good
 habit) and giving that account the needed privileges and then
 configure PMA to use that account.

 --

 Bastien

 Cat, the other other white meat




 --
 Nam


 You don't. Change the config.in.php file to use the new account

 Bastien




-- 
Nam


[PHP] Dreaded Premature end of script headers

2011-08-25 Thread tamouse mailing lists
I'm encountering this on a script, but I can't figure out where it's
actually failing. How do I debug this problem???

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