php-general Digest 26 Aug 2011 00:33:17 -0000 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


----------------------------------------------------------------------
--- Begin Message ---
在 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 ---
--- Begin Message ---
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 Black<s...@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 ---
--- Begin Message ---
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 Message ---
--- Begin Message ---
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

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

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.

--- End Message ---
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
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  

--- End Message ---
--- Begin Message ---
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



--- End Message ---
--- Begin Message ---
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


--- End Message ---
--- Begin Message ---
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

--- End Message ---

Reply via email to