This is a total php newbie question [message #175626] |
Thu, 13 October 2011 22:29 |
justaguy
Messages: 16 Registered: December 2010
Karma:
|
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.
|
|
|