Re: This is a total php newbie question [message #175636 is a reply to message #175629] |
Fri, 14 October 2011 09:45 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma:
|
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
==================
|
|
|