FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » This is a total php newbie question
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
This is a total php newbie question [message #175626] Thu, 13 October 2011 22:29 Go to next message
justaguy is currently offline  justaguy
Messages: 16
Registered: December 2010
Karma: 0
Junior Member
Hi,

I sort of touched php at a very beginner's level a while ago...

Here' what I intended to do with some php scripts.
Business wise,
b1: take the user to PayPal to make a payment.
b2. take the user back from PayPal to download a program.

Technically with php.
Have a base php script that performs the following task:
Send a form to PayPal
The Action line is tricky...

Another php script addresses the PayPal's Return link.
it does two things:
a) create another php script on the fly.
In it, it embed a link with a parameter.
b) it expires in 24 hours (remove the current context of the php file
or replace it with the following statement:
"The link has expired. Please contact info(at)knowledgenotebook(dot)com for
assistance."

Next.

1) how to create a php file on the fly?
With the content in the following 2)

<?php
$ourFileName = "go2download.html";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");

// place holder;
$content = "";

/* Here's the Quesion,
How could I pass all the content in the following 2) into this
$content var, do it one by one is simply stupid?
Please advise. Thanks.

*/
fwrite($ourFileHandle, $content);

fclose($ourFileHandle);

?>


2) How to set the link var, note var and display them

<?php
$link = "http://bla.bla.bal/myProgram.exe";

$note = "Please go to the Knowledge NoteBook website's Download page
for Installation Instructions,

$date1 = new DateTime("now");
$date2 = new DateTime("tomorrow");
$interval = date_diff($date1, $date2);

if ($interval) > 0
{
$link = "";
$note = "Sorry, the link has expired. Please contact
info(at)knowledgenotebook(dot)com for assistance.";
}

<? print($link); ?>
<? print($note); ?>

?>



3) How to expire or change its content?
Sort of, resolved.
Re: This is a total php newbie question [message #175627 is a reply to message #175626] Fri, 14 October 2011 00:17 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/13/2011 6:29 PM, justaguy wrote:
>
> Hi,
>
> I sort of touched php at a very beginner's level a while ago...
>
> Here' what I intended to do with some php scripts.
> Business wise,
> b1: take the user to PayPal to make a payment.

OK

> b2. take the user back from PayPal to download a program.
>

You can't "take the user back". All you can do is send them to a site.
Once they're gone, they're out of your control. It's up to PayPal to
send them back (which the user may or may not do).

> Technically with php.
> Have a base php script that performs the following task:
> Send a form to PayPal

Are you going to send them to PayPal or send a form to PayPal? The two
are entirely different.

> The Action line is tricky...
>
> Another php script addresses the PayPal's Return link.
> it does two things:
> a) create another php script on the fly.

Don't even think of this.

> In it, it embed a link with a parameter.

No problem.

> b) it expires in 24 hours (remove the current context of the php file
> or replace it with the following statement:
> "The link has expired. Please contact info(at)knowledgenotebook(dot)com for
> assistance."
>

Easy enough to do even without creating a script on the fly. That's
what databases are good for.


> Next.
>
> 1) how to create a php file on the fly?
> With the content in the following 2)

As I said before - don't even try. Use a database.

<snip>


> 2) How to set the link var, note var and display them
>
> <?php
> $link = "http://bla.bla.bal/myProgram.exe";
>

If you want people to subscribe to something, don't let them link to it
directly. Otherwise anyone will be able to download it just by knowing
the location. Rather, place the file outside of your website's document
root and serve it with PHP (after validating people's information).

> $note = "Please go to the Knowledge NoteBook website's Download page
> for Installation Instructions,
>
> $date1 = new DateTime("now");
> $date2 = new DateTime("tomorrow");
> $interval = date_diff($date1, $date2);
>
> if ($interval)> 0
> {
> $link = "";
> $note = "Sorry, the link has expired. Please contact
> info(at)knowledgenotebook(dot)com for assistance.";
> }
>
> <? print($link); ?>
> <? print($note); ?>
>
> ?>
>
>
>

Again, use a database.

> 3) How to expire or change its content?
> Sort of, resolved.
>
>
>

Once again, use a database.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: This is a total php newbie question [message #175628 is a reply to message #175627] Fri, 14 October 2011 01:12 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
On 10/13/2011 8:17 PM, Jerry Stuckle wrote:
> On 10/13/2011 6:29 PM, justaguy wrote:
>>
>> Hi,
>>
>> I sort of touched php at a very beginner's level a while ago...
>>
>> Here' what I intended to do with some php scripts.
>> Business wise,
>> b1: take the user to PayPal to make a payment.
>
> OK
>
>> b2. take the user back from PayPal to download a program.
>>
>
> You can't "take the user back". All you can do is send them to a site.
> Once they're gone, they're out of your control. It's up to PayPal to
> send them back (which the user may or may not do).

That's not entirely correct: PayPal's interface does permit the merchant
to specify a URL to which PayPal will transfer control once the business
at PayPal's site is concluded. If the user cancels the transaction at
PayPal, that won't happen, of course, but if he completes the
transaction, PayPal will send him back to whatever URL the merchant
supplied to PayPal as the "return address".
Re: This is a total php newbie question [message #175629 is a reply to message #175627] Fri, 14 October 2011 00:58 Go to previous messageGo to next message
justaguy is currently offline  justaguy
Messages: 16
Registered: December 2010
Karma: 0
Junior Member
Sorry, Jerry, you missed my question.

Send the form to PayPay is to interface with PayPal's API
with the form's ACTION line.
And since it's an API, PayPal has a way to let the user click on
"Return to bla bla".

In essence, the task will accomplish two things:
A) link the user/buyer to PayPal to make a payment
B) back to my site with a special URL that give the buyer the info
including the software download link (but this link would expire in 24
hours).

Absolutely no need whatsoever with a database for this, it would be
totally overkill.

Don

> On Oct 13, 8:17 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> On 10/13/2011 6:29 PM, justaguy wrote:
>
>
>
>> Hi,
>
>> I sort of touched php at a very beginner's level a while ago...
>
>> Here' what I intended to do with some php scripts.
>> Business wise,
>> b1: take the user to PayPal to make a payment.
>
> OK
>
>> b2. take the user back from PayPal to download a program.
>
> You can't "take the user back".  All you can do is send them to a site.
>   Once they're gone, they're out of your control.  It's up to PayPal to
> send them back (which the user may or may not do).
>
>> Technically with php.
>> Have a base php script that performs the following task:
>> Send a form to PayPal
>
> Are you going to send them to PayPal or send a form to PayPal?  The two
> are entirely different.
>
>> The Action line is tricky...
>
>> Another php script addresses the PayPal's Return link.
>> it  does two things:
>> a) create another php script on the fly.
>
> Don't even think of this.
>
>> In it, it embed a link with a parameter.
>
> No problem.
>
>> b) it expires in 24 hours (remove the current context of the php file
>> or replace it with the following statement:
>> "The link has expired.  Please contact i...@knowledgenotebook.com for
>> assistance."
>
> Easy enough to do even without creating a script on the fly.  That's
> what databases are good for.
>
>> Next.
>
>> 1) how to create a php file on the fly?
>> With the content in the following 2)
>
> As I said before - don't even try. Use a database.
>
> <snip>
>
>> 2) How to set the link var, note var and display them
>
>> <?php
>>   $link = "http://bla.bla.bal/myProgram.exe";
>
> If you want people to subscribe to something, don't let them link to it
> directly.  Otherwise anyone will be able to download it just by knowing
> the location.  Rather, place the file outside of your website's document
> root and serve it with PHP (after validating people's information).
>
>
>
>> $note = "Please go to the Knowledge NoteBook website's Download page
>> for Installation Instructions,
>
>> $date1 = new DateTime("now");
>> $date2 = new DateTime("tomorrow");
>> $interval = date_diff($date1, $date2);
>
>> if ($interval)>  0
>> {
>>   $link = "";
>>   $note = "Sorry, the link has expired.  Please contact
>> i...@knowledgenotebook.com for assistance.";
>> }
>
>> <? print($link); ?>
>> <? print($note); ?>
>
>> ?>
>
> Again, use a database.
>
>> 3) How to expire or change its content?
>> Sort of, resolved.
>
> Once again, use a database.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Re: This is a total php newbie question [message #175631 is a reply to message #175626] Fri, 14 October 2011 06:49 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 13 Oct 2011 15:29:02 -0700, justaguy wrote:

> Here' what I intended to do with some php scripts. Business wise,
> b1: take the user to PayPal to make a payment. b2. take the user back
> from PayPal to download a program.

You need to look at the paypal api's. I believe they provide php code
examples.

> 1) how to create a php file on the fly?

You can create a php file on the fly by writing php commands to a file.

> With the content in the following 2)

The content will be whatever you write to the file.

------------------------------------------------

Describe the problem:

You wish a customer to be able to make a paypal payment, after which you
will provide a download link to some content for a period of x hours.

Is this correct?

So you have two issues to resolve:

a) Handling the paypal payment
b) Making the restricted content available for a time limited period

For (a)

Handling the paypal payment is fairly easy once you understand the paypal
apis, although the paypal apis are not always easy to work with. You
should read the paypal developer documentation.

For (b)

Maintain a database of identity / purchased_file_name / expiry time. I'd
set identity up as a non unique index, as a person may have purchased
multiple files at different times.

When someone logs in, access the database and use it to generate a list
of links for those files that they currently have download access to.

Keep the paid for content files outside of the webroot. When they click
on a file, use readfile to deliver it with the relevant content headers.
You should only need a single "delivery" script to handle this.

You may wish to periodically prune expired links from the database. If
the website is lightly used, you could do this every time the table is
accessed. For a more heavily used website, you might want to consider a
cron job for this.

Note that I haven't considered how you verify that someone visiting your
site 6 hours after paying for a file is the person that paid for it. You
didn't ask about that. Nor have I mentioned sessions ... but you will
probably want to use sessions to keep track of users.

Rgds

Denis McMahon
Re: This is a total php newbie question [message #175632 is a reply to message #175629] Fri, 14 October 2011 07:27 Go to previous messageGo to next message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
justaguy, 2011-10-14 02:58:

> Sorry, Jerry, you missed my question.
>
> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.
> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".
>
> In essence, the task will accomplish two things:
> A) link the user/buyer to PayPal to make a payment
> B) back to my site with a special URL that give the buyer the info
> including the software download link (but this link would expire in 24
> hours).
>
> Absolutely no need whatsoever with a database for this, it would be
> totally overkill.

And how can you be sure, that the "special URL" is valid? If there is no
database with verified payments, *everybody* can use generated URLs to
fake valid payments.

Better you look for a provider, who handles payments and downloads for
you - since it seems you neither have experience with PHP nor with
selling stuff online.


--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Re: This is a total php newbie question [message #175635 is a reply to message #175629] Fri, 14 October 2011 08:27 Go to previous messageGo to next message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma: 0
Senior Member
On 10/14/2011 2:58 AM, justaguy wrote:
> Sorry, Jerry, you missed my question.
>

Hi justaguy,

[Please don't toppost]


> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.

That is not interfacing with the paypal-api.
That is just posting a form to paypal.
action="https://www.paypal.com/cgi-bin/webscr"


> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".

You cannot be sure the payment is finished at this point.

To make things complicated Paypal has all kinds of statuses for the
payments, including "pending" and stuff.
SOmetimes they have to wait for some other bank to respond.

You simply don't use paypal like you intend to.
Better to use the IPN messaging of Paypal.
(IPN is an unreliable mess, but it gets the job done, sometimes. I just
filed another bugreport. They told me they will fix in an undisclosed
period of time. Sure...)


>
> In essence, the task will accomplish two things:
> A) link the user/buyer to PayPal to make a payment
> B) back to my site with a special URL that give the buyer the info
> including the software download link (but this link would expire in 24
> hours).

You won't know if the payment succeeded when they arrive back at your site.


>
> Absolutely no need whatsoever with a database for this, it would be
> totally overkill.

If a database is difficult/overkill in your book, I advise you to stay
away from the IPN-messaging I mentioned above.

Maybe your best solution is to contact Paypal and ask them if they have
some preconfigured system for you.

Good luck.
Erwin Moller

>
> Don
>
>> On Oct 13, 8:17 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 10/13/2011 6:29 PM, justaguy wrote:
>>
>>
>>
>>> Hi,
>>
>>> I sort of touched php at a very beginner's level a while ago...
>>
>>> Here' what I intended to do with some php scripts.
>>> Business wise,
>>> b1: take the user to PayPal to make a payment.
>>
>> OK
>>
>>> b2. take the user back from PayPal to download a program.
>>
>> You can't "take the user back". All you can do is send them to a site.
>> Once they're gone, they're out of your control. It's up to PayPal to
>> send them back (which the user may or may not do).
>>
>>> Technically with php.
>>> Have a base php script that performs the following task:
>>> Send a form to PayPal
>>
>> Are you going to send them to PayPal or send a form to PayPal? The two
>> are entirely different.
>>
>>> The Action line is tricky...
>>
>>> Another php script addresses the PayPal's Return link.
>>> it does two things:
>>> a) create another php script on the fly.
>>
>> Don't even think of this.
>>
>>> In it, it embed a link with a parameter.
>>
>> No problem.
>>
>>> b) it expires in 24 hours (remove the current context of the php file
>>> or replace it with the following statement:
>>> "The link has expired. Please contact i...@knowledgenotebook.com for
>>> assistance."
>>
>> Easy enough to do even without creating a script on the fly. That's
>> what databases are good for.
>>
>>> Next.
>>
>>> 1) how to create a php file on the fly?
>>> With the content in the following 2)
>>
>> As I said before - don't even try. Use a database.
>>
>> <snip>
>>
>>> 2) How to set the link var, note var and display them
>>
>>> <?php
>>> $link = "http://bla.bla.bal/myProgram.exe";
>>
>> If you want people to subscribe to something, don't let them link to it
>> directly. Otherwise anyone will be able to download it just by knowing
>> the location. Rather, place the file outside of your website's document
>> root and serve it with PHP (after validating people's information).
>>
>>
>>
>>> $note = "Please go to the Knowledge NoteBook website's Download page
>>> for Installation Instructions,
>>
>>> $date1 = new DateTime("now");
>>> $date2 = new DateTime("tomorrow");
>>> $interval = date_diff($date1, $date2);
>>
>>> if ($interval)> 0
>>> {
>>> $link = "";
>>> $note = "Sorry, the link has expired. Please contact
>>> i...@knowledgenotebook.com for assistance.";
>>> }
>>
>>> <? print($link); ?>
>>> <? print($note); ?>
>>
>>> ?>
>>
>> Again, use a database.
>>
>>> 3) How to expire or change its content?
>>> Sort of, resolved.
>>
>> Once again, use a database.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>


--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
Re: This is a total php newbie question [message #175636 is a reply to message #175629] Fri, 14 October 2011 09:45 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/13/2011 8:58 PM, justaguy wrote:
>> On Oct 13, 8:17 pm, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 10/13/2011 6:29 PM, justaguy wrote:
>>
>>
>>
>>> Hi,
>>
>>> I sort of touched php at a very beginner's level a while ago...
>>
>>> Here' what I intended to do with some php scripts.
>>> Business wise,
>>> b1: take the user to PayPal to make a payment.
>>
>> OK
>>
>>> b2. take the user back from PayPal to download a program.
>>
>> You can't "take the user back". All you can do is send them to a site.
>> Once they're gone, they're out of your control. It's up to PayPal to
>> send them back (which the user may or may not do).
>>
>>> Technically with php.
>>> Have a base php script that performs the following task:
>>> Send a form to PayPal
>>
>> Are you going to send them to PayPal or send a form to PayPal? The two
>> are entirely different.
>>
>>> The Action line is tricky...
>>
>>> Another php script addresses the PayPal's Return link.
>>> it does two things:
>>> a) create another php script on the fly.
>>
>> Don't even think of this.
>>
>>> In it, it embed a link with a parameter.
>>
>> No problem.
>>
>>> b) it expires in 24 hours (remove the current context of the php file
>>> or replace it with the following statement:
>>> "The link has expired. Please contact i...@knowledgenotebook.com for
>>> assistance."
>>
>> Easy enough to do even without creating a script on the fly. That's
>> what databases are good for.
>>
>>> Next.
>>
>>> 1) how to create a php file on the fly?
>>> With the content in the following 2)
>>
>> As I said before - don't even try. Use a database.
>>
>> <snip>
>>
>>> 2) How to set the link var, note var and display them
>>
>>> <?php
>>> $link = "http://bla.bla.bal/myProgram.exe";
>>
>> If you want people to subscribe to something, don't let them link to it
>> directly. Otherwise anyone will be able to download it just by knowing
>> the location. Rather, place the file outside of your website's document
>> root and serve it with PHP (after validating people's information).
>>
>>
>>
>>> $note = "Please go to the Knowledge NoteBook website's Download page
>>> for Installation Instructions,
>>
>>> $date1 = new DateTime("now");
>>> $date2 = new DateTime("tomorrow");
>>> $interval = date_diff($date1, $date2);
>>
>>> if ($interval)> 0
>>> {
>>> $link = "";
>>> $note = "Sorry, the link has expired. Please contact
>>> i...@knowledgenotebook.com for assistance.";
>>> }
>>
>>> <? print($link); ?>
>>> <? print($note); ?>
>>
>>> ?>
>>
>> Again, use a database.
>>
>>> 3) How to expire or change its content?
>>> Sort of, resolved.
>>
>> Once again, use a database.
>>
> Sorry, Jerry, you missed my question.
>
> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.
> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".
>
> In essence, the task will accomplish two things:
> A) link the user/buyer to PayPal to make a payment
> B) back to my site with a special URL that give the buyer the info
> including the software download link (but this link would expire in 24
> hours).
>
> Absolutely no need whatsoever with a database for this, it would be
> totally overkill.
>
> Don
>

<top posting fixed>

Yes, I'm familiar with how it works. You can use PayPal's API to send
the data to PayPal (and get a result back) or you can direct the person
to PayPal and hope they click on the "Return to...." link.

And a database is the best way to do this. If you think it's overkill
you don't understand how to use databases correctly.

Also - please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: This is a total php newbie question [message #175640 is a reply to message #175636] Fri, 14 October 2011 10:41 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
I'll give up top-posting if you learn how to snip. Deal?

In article <j790bt$2pj$1(at)dont-email(dot)me>,
Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:

[snip large amounts]

> Also - please don't top post. Thanks.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: This is a total php newbie question [message #175642 is a reply to message #175640] Fri, 14 October 2011 14:19 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/14/2011 6:41 AM, Tim Streater wrote:
> I'll give up top-posting if you learn how to snip. Deal?
>
> In article <j790bt$2pj$1(at)dont-email(dot)me>,
> Jerry Stuckle <jstucklex(at)attglobal(dot)net> wrote:
>
> [snip large amounts]
>
>> Also - please don't top post. Thanks.
>

Stuff it, top-posting troll.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: This is a total php newbie question [message #175649 is a reply to message #175629] Sat, 15 October 2011 16:53 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 10/13/2011 8:58 PM, justaguy wrote:
> Sorry, Jerry, you missed my question.
>
> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.
> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".

You can do this either by naming the return URL from with PayPal, or by
adding a hidden field to your form.

I think, from your overall description, that you will want to read up on
the PayPal Listener Script, which listens for data sent from PayPal to
your server with information about the purchase.

There is a ton of documentation about this on PayPal, albeit in the most
disorganized manner you could imagine. Have a look in http://www.x.com.

Bill B
Re: This is a total php newbie question [message #175681 is a reply to message #175629] Tue, 18 October 2011 22:42 Go to previous messageGo to next message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma: 0
Senior Member
On 10/13/2011 8:58 PM, justaguy wrote:
> Sorry, Jerry, you missed my question.
>
> Send the form to PayPay is to interface with PayPal's API
> with the form's ACTION line.
> And since it's an API, PayPal has a way to let the user click on
> "Return to bla bla".
>
> In essence, the task will accomplish two things:
> A) link the user/buyer to PayPal to make a payment
> B) back to my site with a special URL that give the buyer the info
> including the software download link (but this link would expire in 24
> hours).
>
> Absolutely no need whatsoever with a database for this, it would be
> totally overkill.

Here is a scenario:
1 - User does this and gets a page with a link to a download which does
the download.
2 - He doesn't click the that link on that page until 25 hours later.
Note, he has not closed his browser or that page.

How are you going to know that more than 24 hours have passed? You need
to do something that will be similar to a timed logout.

Something to think about.

--
Shelly
Re: This is a total php newbie question [message #175682 is a reply to message #175681] Wed, 19 October 2011 11:21 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 10/18/2011 6:42 PM, sheldonlg wrote:
> Here is a scenario:
> 1 - User does this and gets a page with a link to a download which does
> the download.
> 2 - He doesn't click the that link on that page until 25 hours later.
> Note, he has not closed his browser or that page.
>
> How are you going to know that more than 24 hours have passed? You need
> to do something that will be similar to a timed logout.
>
> Something to think about.

I do not know the answer to that specific question, but it raises, for
me, the question of how much extreme testing ought to be done to test
the limits of code and browser behavior.

Is there a generally accepted standard, does it vary by circumstance,
does anyone have personal practices that have served them well?

Bill B
Re: This is a total php newbie question [message #175683 is a reply to message #175682] Wed, 19 October 2011 15:27 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/19/2011 7:21 AM, Bill B wrote:
> On 10/18/2011 6:42 PM, sheldonlg wrote:
>> Here is a scenario:
>> 1 - User does this and gets a page with a link to a download which does
>> the download.
>> 2 - He doesn't click the that link on that page until 25 hours later.
>> Note, he has not closed his browser or that page.
>>
>> How are you going to know that more than 24 hours have passed? You need
>> to do something that will be similar to a timed logout.
>>
>> Something to think about.
>
> I do not know the answer to that specific question, but it raises, for
> me, the question of how much extreme testing ought to be done to test
> the limits of code and browser behavior.
>
> Is there a generally accepted standard, does it vary by circumstance,
> does anyone have personal practices that have served them well?
>
> Bill B

You test enough to ensure your code works properly. One of the reasons
a database will help you tremendously.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: This is a total php newbie question [message #175684 is a reply to message #175682] Wed, 19 October 2011 16:21 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Bill B wrote:
> On 10/18/2011 6:42 PM, sheldonlg wrote:
>> Here is a scenario:
>> 1 - User does this and gets a page with a link to a download which does
>> the download.
>> 2 - He doesn't click the that link on that page until 25 hours later.
>> Note, he has not closed his browser or that page.
>>
>> How are you going to know that more than 24 hours have passed? You need
>> to do something that will be similar to a timed logout.
>>
>> Something to think about.
>
> I do not know the answer to that specific question, but it raises, for
> me, the question of how much extreme testing ought to be done to test
> the limits of code and browser behavior.
>
its simple: you set a cookie and time it to expire.

If they come back with a valid cooklie, they are still 'in a live session'

Pretty sure this is all wrapped up inside the php session structures.


Ye. You can do all that with PHP sessions. All in the manual.

> Is there a generally accepted standard, does it vary by circumstance,
> does anyone have personal practices that have served them well?
>
Sessions.

> Bill B
Re: This is a total php newbie question [message #175685 is a reply to message #175683] Wed, 19 October 2011 16:22 Go to previous messageGo to next message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 10/19/2011 11:27 AM, Jerry Stuckle wrote:
> On 10/19/2011 7:21 AM, Bill B wrote:
>> On 10/18/2011 6:42 PM, sheldonlg wrote:
>>> Here is a scenario:
>>> 1 - User does this and gets a page with a link to a download which does
>>> the download.
>>> 2 - He doesn't click the that link on that page until 25 hours later.
>>> Note, he has not closed his browser or that page.
>>>
>>> How are you going to know that more than 24 hours have passed? You need
>>> to do something that will be similar to a timed logout.
>>>
>>> Something to think about.
>>
>> I do not know the answer to that specific question, but it raises, for
>> me, the question of how much extreme testing ought to be done to test
>> the limits of code and browser behavior.
>>
>> Is there a generally accepted standard, does it vary by circumstance,
>> does anyone have personal practices that have served them well?
>>
>> Bill B
>
> You test enough to ensure your code works properly. One of the reasons a
> database will help you tremendously.
>

Jerry I was asking in the context of practices that you, for example,
might use that would, for you, embody what "test enough" means. I design
serious games that use computer simulation as the underlying engine. The
decision a player is responding to might expect an answer between 5 and
10. For testing I would answer 500,000 just to see how the engine reacts
to the number.

I was looking for some practices that were more specific, if you are
inclined to share them (and "no" is a real plausible answer).

Bill B
Re: This is a total php newbie question [message #175686 is a reply to message #175685] Wed, 19 October 2011 19:12 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
On 10/19/2011 12:22 PM, Bill B wrote:
> On 10/19/2011 11:27 AM, Jerry Stuckle wrote:
>> On 10/19/2011 7:21 AM, Bill B wrote:
>>> On 10/18/2011 6:42 PM, sheldonlg wrote:
>>>> Here is a scenario:
>>>> 1 - User does this and gets a page with a link to a download which does
>>>> the download.
>>>> 2 - He doesn't click the that link on that page until 25 hours later.
>>>> Note, he has not closed his browser or that page.
>>>>
>>>> How are you going to know that more than 24 hours have passed? You need
>>>> to do something that will be similar to a timed logout.
>>>>
>>>> Something to think about.
>>>
>>> I do not know the answer to that specific question, but it raises, for
>>> me, the question of how much extreme testing ought to be done to test
>>> the limits of code and browser behavior.
>>>
>>> Is there a generally accepted standard, does it vary by circumstance,
>>> does anyone have personal practices that have served them well?
>>>
>>> Bill B
>>
>> You test enough to ensure your code works properly. One of the reasons a
>> database will help you tremendously.
>>
>
> Jerry I was asking in the context of practices that you, for example,
> might use that would, for you, embody what "test enough" means. I design
> serious games that use computer simulation as the underlying engine. The
> decision a player is responding to might expect an answer between 5 and
> 10. For testing I would answer 500,000 just to see how the engine reacts
> to the number.

Test boundary conditions and invalid input. If the answer is supposed to
be between 5 and 10, I might test using these values in addition to the
obvious 5 thru 10: "A", " ", "5A", "5 ", " 5", 4, 11, 105, 0, -1, -5,
-10, 2^16, 2^16 + 5, 2^32, and 2^32 + 5.
Re: This is a total php newbie question [message #175688 is a reply to message #175685] Thu, 20 October 2011 12:53 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 10/19/2011 12:22 PM, Bill B wrote:
> On 10/19/2011 11:27 AM, Jerry Stuckle wrote:
>> On 10/19/2011 7:21 AM, Bill B wrote:
>>> On 10/18/2011 6:42 PM, sheldonlg wrote:
>>>> Here is a scenario:
>>>> 1 - User does this and gets a page with a link to a download which does
>>>> the download.
>>>> 2 - He doesn't click the that link on that page until 25 hours later.
>>>> Note, he has not closed his browser or that page.
>>>>
>>>> How are you going to know that more than 24 hours have passed? You need
>>>> to do something that will be similar to a timed logout.
>>>>
>>>> Something to think about.
>>>
>>> I do not know the answer to that specific question, but it raises, for
>>> me, the question of how much extreme testing ought to be done to test
>>> the limits of code and browser behavior.
>>>
>>> Is there a generally accepted standard, does it vary by circumstance,
>>> does anyone have personal practices that have served them well?
>>>
>>> Bill B
>>
>> You test enough to ensure your code works properly. One of the reasons a
>> database will help you tremendously.
>>
>
> Jerry I was asking in the context of practices that you, for example,
> might use that would, for you, embody what "test enough" means. I design
> serious games that use computer simulation as the underlying engine. The
> decision a player is responding to might expect an answer between 5 and
> 10. For testing I would answer 500,000 just to see how the engine reacts
> to the number.
>
> I was looking for some practices that were more specific, if you are
> inclined to share them (and "no" is a real plausible answer).
>
> Bill B

Good testing practices are pretty much the same no matter what language
you're working with. You test with valid and invalid values, and even
if there is an answer at all. Check for combinations (valid and
invalid) of answers. Ensure numeric answers are numeric, etc.

Good testing is not dependent on the platform or the language.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: This is a total php newbie question [message #175689 is a reply to message #175688] Thu, 20 October 2011 13:46 Go to previous message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 10/20/2011 8:53 AM, Jerry Stuckle wrote:
> On 10/19/2011 12:22 PM, Bill B wrote:
>> On 10/19/2011 11:27 AM, Jerry Stuckle wrote:
>>> On 10/19/2011 7:21 AM, Bill B wrote:
>>>> On 10/18/2011 6:42 PM, sheldonlg wrote:
>>>> > Here is a scenario:
>>>> > 1 - User does this and gets a page with a link to a download which
>>>> > does
>>>> > the download.
>>>> > 2 - He doesn't click the that link on that page until 25 hours later.
>>>> > Note, he has not closed his browser or that page.
>>>> >
>>>> > How are you going to know that more than 24 hours have passed? You
>>>> > need
>>>> > to do something that will be similar to a timed logout.
>>>> >
>>>> > Something to think about.
>>>>
>>>> I do not know the answer to that specific question, but it raises, for
>>>> me, the question of how much extreme testing ought to be done to test
>>>> the limits of code and browser behavior.
>>>>
>>>> Is there a generally accepted standard, does it vary by circumstance,
>>>> does anyone have personal practices that have served them well?
>>>>
>>>> Bill B
>>>
>>> You test enough to ensure your code works properly. One of the reasons a
>>> database will help you tremendously.
>>>
>>
>> Jerry I was asking in the context of practices that you, for example,
>> might use that would, for you, embody what "test enough" means. I design
>> serious games that use computer simulation as the underlying engine. The
>> decision a player is responding to might expect an answer between 5 and
>> 10. For testing I would answer 500,000 just to see how the engine reacts
>> to the number.
>>
>> I was looking for some practices that were more specific, if you are
>> inclined to share them (and "no" is a real plausible answer).
>>
>> Bill B
>
> Good testing practices are pretty much the same no matter what language
> you're working with. You test with valid and invalid values, and even if
> there is an answer at all. Check for combinations (valid and invalid) of
> answers. Ensure numeric answers are numeric, etc.
>
> Good testing is not dependent on the platform or the language.
>

Thank you, Jerry.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Mass Twitter Account Creator (PHP)
Next Topic: declaring private variable in class
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 03:26:09 GMT 2024

Total time taken to generate the page: 0.02558 seconds