Board index » delphi » Passing a parameter via link

Passing a parameter via link


2005-11-15 08:53:07 PM
delphi32
I need to have a link from a web site or an HTML email that contains a
clients ID number. eg 1234
We need to be able to change this number for each client and send him the
link to place in his site / email.
When the link arrives at the web page I need to display that number.
eg
Welcome your client number is "1234"
Any help appreciated
 
 

Re:Passing a parameter via link

"SteveW" <XXXX@XXXXX.COM>writes
Quote
When the link arrives at the web page I need to display that number.
Welcome your client number is "1234"
www.yoursite.com/yourpage.php&clientnumber=1234
then in yourpage.php:
<?PHP
{
echo "Welcome $clientnumber";
}
?>
That should do it. This is really off-topic though, and should be in a .php
forum.
 

Re:Passing a parameter via link

David J Taylor writes:
Quote
Can it be done purely at the client?
depends, you can also use javascript to pick up parameters from the URL
and do things too
--
Liz the Brit
Delphi things I have released: www.xcalibur.co.uk/DelphiThings
 

Re:Passing a parameter via link

Chris Thornton writes:
Quote
"SteveW" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>When the link arrives at the web page I need to display that number.
>Welcome your client number is "1234"

www.yoursite.com/yourpage.php&clientnumber=1234

then in yourpage.php:

<?PHP
{
echo "Welcome $clientnumber";
}
>

That should do it. This is really off-topic though, and should be in
a .php forum.
Well, it has nothing to do with PHP specifically - it is part of a URL
called the query string:
en.wikipedia.org/wiki/Query_string
PHP is but one method of handling query strings. Perl, ASP, JSP etc. are
others. You need some method of running code at your Web server, and you
will find 3rd party tools to help with that. What Web server are you
running?
Can it be done purely at the client?
David
 

Re:Passing a parameter via link

I am running IIS on windows 2000 Server.
Any sample of javascript to do this?
I have delphi7, intraweb.
Front page 2000.
Cheers
"Liz" <XXXX@XXXXX.COM>writes
Quote
David J Taylor writes:

>Can it be done purely at the client?

depends, you can also use javascript to pick up parameters from the URL
and do things too

--
Liz the Brit
Delphi things I have released: www.xcalibur.co.uk/DelphiThings
 

Re:Passing a parameter via link

Your code is actually non-secure and should never be run. You forgot to
show off the extraction of the field, or you are relying upon
registerglobals being set to true (Major security NO NO). Properly (in PHP
that is) the code should look more like:
<?php
function ValidateUIN($UIN){
// Validation code with return here
}
if(isset($_REQUEST['ClientID'])&&ValidateUIN($_REQUEST['ClientID'])){
$ClientNumber = $_REQUEST['ClientID'];
}else{
$ClientNumber = "Error, possiable hack attempt with invalid ClientID,
please contact the system administrator.";
}
print "Your number: $ClientNumber";
//Notice no use of Echo, echo can not be redirected in some versions of php
?>
Now in Delphi you can do this also with a server side NSAPI, ISAPI, or other
integration solution. Typically you can use the TPageProducer and template
files, thus a field such as <#ClientID>will be replaced (in code) with the
client id. You can also hand generate the page.
This would be done in the Response or Request objects.
Finally actually, for security this should be done in a Session Variable and
not in the request/response headers. (If on a webpage) and de-crypted via
JS on the web page. In an e-mail its another story, and should probiably
just be presented normally, or via a link with validation code that takes
the user to a page that double checks the validation code, then presents the
user with their Client ID.
Jeremy
PS: Steve, Assuming that you already generate your random client ID's to
send them to the client Via and E-Mail is easy enough. Just about any 3rd
Party TCP/IP library (Indy, ICS, ect) can do this. On the server page side
what software do you want to use, I will be happy to post up (online or
offline in e-mail) samples for you to use.
"Chris Thornton" <XXXX@XXXXX.COM>writes
Quote
"SteveW" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>When the link arrives at the web page I need to display that number.
>Welcome your client number is "1234"

www.yoursite.com/yourpage.php&clientnumber=1234

then in yourpage.php:

<?PHP
{
echo "Welcome $clientnumber";
}
?>

That should do it. This is really off-topic though, and should be in a
.php forum.
--
Chris



 

Re:Passing a parameter via link

I have Delphi 7 & intraweb, Front page 2000. I know very little about server
side 'stuff' so be gentle with me.
The client number is already known. What we are trying to achieve is an
affiliate scheme whereby an affiliate i.e. client no 1234 advertises our
services via a link of his web site or within an email. We need to know when
a new customer orders which affiliate has introduced the client (so we can
pay his initial fee and ongoing payments).
I have found www.yoursite.com/yourpage,clientnumber=1234 is supposed
to send the variable clientnumber := 1234. But how do I read this on the
server end.
Cheers for the help so far.
"Jeremy Darling" <XXXX@XXXXX.COM>writes
Quote
Your code is actually non-secure and should never be run. You forgot to
show off the extraction of the field, or you are relying upon
registerglobals being set to true (Major security NO NO). Properly (in
PHP that is) the code should look more like:

<?php
function ValidateUIN($UIN){
// Validation code with return here
}

if(isset($_REQUEST['ClientID'])&&ValidateUIN($_REQUEST['ClientID'])){
$ClientNumber = $_REQUEST['ClientID'];
}else{
$ClientNumber = "Error, possiable hack attempt with invalid ClientID,
please contact the system administrator.";
}

print "Your number: $ClientNumber";
//Notice no use of Echo, echo can not be redirected in some versions of php
?>

Now in Delphi you can do this also with a server side NSAPI, ISAPI, or
other integration solution. Typically you can use the TPageProducer and
template files, thus a field such as <#ClientID>will be replaced (in
code) with the client id. You can also hand generate the page.

This would be done in the Response or Request objects.

Finally actually, for security this should be done in a Session Variable
and not in the request/response headers. (If on a webpage) and de-crypted
via JS on the web page. In an e-mail its another story, and should
probiably just be presented normally, or via a link with validation code
that takes the user to a page that double checks the validation code, then
presents the user with their Client ID.

Jeremy

PS: Steve, Assuming that you already generate your random client ID's to
send them to the client Via and E-Mail is easy enough. Just about any 3rd
Party TCP/IP library (Indy, ICS, ect) can do this. On the server page
side what software do you want to use, I will be happy to post up (online or
offline in e-mail) samples for you to use.


"Chris Thornton" <XXXX@XXXXX.COM>writes
news:437a036a$XXXX@XXXXX.COM...
>"SteveW" <XXXX@XXXXX.COM>writes
>news:XXXX@XXXXX.COM...
>>When the link arrives at the web page I need to display that number.
>>Welcome your client number is "1234"
>
>www.yoursite.com/yourpage.php&clientnumber=1234
>
>then in yourpage.php:
>
><?PHP
>{
>echo "Welcome $clientnumber";
>}
>?>
>
>That should do it. This is really off-topic though, and should be in a
>.php forum.
>--
>Chris
>
>
>


 

Re:Passing a parameter via link

"STEVE WARBURTON" writes:
Quote
I have found www.yoursite.com/yourpage,clientnumber=1234 is
supposed to send the variable clientnumber := 1234. But how do I read this
on the server end.
In RTC, you would access request query parameter with:
myclient := Request.Query['clientnumber'];
... but, I don't know anything about IntraWeb.
--
Danijel Tkalcec
www.deltasoft.hr/rtc/author.htm
RealThinClient components
-------------------------------------------
* The Easiest way to build Internet-enabled applications
- Clients, Stand-alone Servers, ISAPI extensions -
Quote
Write and Call Remote Functions
Download and Upload Files
Single- and Multi-Threaded mode
Firewall friendly - all over HTTP
Stress-tested for highest stability
www.realthinclient.com
or www.deltasoft.hr/rtc
 

Re:Passing a parameter via link

Btw ... correct URL would be:
mydomain.com/myscript
You have to use '?' to separate the file name from query parameters,
then you can use ';' or '&' to separate multiple query parameters, like
this:
mydomain.com/myscript
With RTC, on the server-side, you would use this to read parameters:
mycustomer := Request.Query['custid'];
myproduct := Request.Query['product'];
myaffiliate := Request.Query['affiliate'];
--
Danijel Tkalcec
www.deltasoft.hr/rtc/author.htm
RealThinClient components
-------------------------------------------
* The Easiest way to build Internet-enabled applications
- Clients, Stand-alone Servers, ISAPI extensions -
Quote
Write and Call Remote Functions
Download and Upload Files
Single- and Multi-Threaded mode
Firewall friendly - all over HTTP
Stress-tested for highest stability
www.realthinclient.com
or www.deltasoft.hr/rtc
"Danijel Tkalcec [RTC]" <XXXX@XXXXX.COM>writes
Quote
"STEVE WARBURTON" writes:
>I have found www.yoursite.com/yourpage,clientnumber=1234 is
>supposed to send the variable clientnumber := 1234. But how do I read
>this on the server end.

In RTC, you would access request query parameter with:

myclient := Request.Query['clientnumber'];

... but, I don't know anything about IntraWeb.

--
Danijel Tkalcec
www.deltasoft.hr/rtc/author.htm

RealThinClient components
-------------------------------------------
* The Easiest way to build Internet-enabled applications
- Clients, Stand-alone Servers, ISAPI extensions -
>Write and Call Remote Functions
>Download and Upload Files
>Single- and Multi-Threaded mode
>Firewall friendly - all over HTTP
>Stress-tested for highest stability

news://news.realthinclient.com

www.realthinclient.com
or www.deltasoft.hr/rtc

 

Re:Passing a parameter via link

STEVE WARBURTON writes:
Quote
I have Delphi 7 & intraweb, Front page 2000. I know very little about server
side 'stuff' so be gentle with me.

The client number is already known. What we are trying to achieve is an
affiliate scheme whereby an affiliate i.e. client no 1234 advertises our
services via a link of his web site or within an email. We need to know when
a new customer orders which affiliate has introduced the client (so we can
pay his initial fee and ongoing payments).

I have found www.yoursite.com/yourpage,clientnumber=1234 is supposed
to send the variable clientnumber := 1234. But how do I read this on the
server end.

Cheers for the help so far.



"Jeremy Darling" <XXXX@XXXXX.COM>writes
news:437a2826$XXXX@XXXXX.COM...

>Your code is actually non-secure and should never be run. You forgot to
>show off the extraction of the field, or you are relying upon
>registerglobals being set to true (Major security NO NO). Properly (in
>PHP that is) the code should look more like:
>
><?php
>function ValidateUIN($UIN){
>// Validation code with return here
>}
>
>if(isset($_REQUEST['ClientID'])&&ValidateUIN($_REQUEST['ClientID'])){
>$ClientNumber = $_REQUEST['ClientID'];
>}else{
>$ClientNumber = "Error, possiable hack attempt with invalid ClientID,
>please contact the system administrator.";
>}
>
>print "Your number: $ClientNumber";
>//Notice no use of Echo, echo can not be redirected in some versions of php
>?>
>
>Now in Delphi you can do this also with a server side NSAPI, ISAPI, or
>other integration solution. Typically you can use the TPageProducer and
>template files, thus a field such as <#ClientID>will be replaced (in
>code) with the client id. You can also hand generate the page.
>
>This would be done in the Response or Request objects.
>
>Finally actually, for security this should be done in a Session Variable
>and not in the request/response headers. (If on a webpage) and de-crypted
>via JS on the web page. In an e-mail its another story, and should
>probiably just be presented normally, or via a link with validation code
>that takes the user to a page that double checks the validation code, then
>presents the user with their Client ID.
>
>Jeremy
>
>PS: Steve, Assuming that you already generate your random client ID's to
>send them to the client Via and E-Mail is easy enough. Just about any 3rd
>Party TCP/IP library (Indy, ICS, ect) can do this. On the server page
>side what software do you want to use, I will be happy to post up (online or
>offline in e-mail) samples for you to use.
>
>
>"Chris Thornton" <XXXX@XXXXX.COM>writes
Steve,
I would really give RTC(RealThinClient Components) a good look. It
makes this kind of stuff super easy, see if you can try the eval. I
have been using it with great results...
www.realthinclient.com
Walter Fordham
SmartQuest Technology, Inc.
Quote
>news:437a036a$XXXX@XXXXX.COM...
>
>>"SteveW" <XXXX@XXXXX.COM>writes
>>news:XXXX@XXXXX.COM...
>>
>>>When the link arrives at the web page I need to display that number.
>>>Welcome your client number is "1234"
>>
>>www.yoursite.com/yourpage.php&clientnumber=1234
>>
>>then in yourpage.php:
>>
>><?PHP
>>{
>>echo "Welcome $clientnumber";
>>}
>>?>
>>
>>That should do it. This is really off-topic though, and should be in a
>>.php forum.
>>--
>>Chris
>>
>>
>>
>
>


 

Re:Passing a parameter via link

Steve,
I would really give RTC(RealThinClient Components) a good look. It
makes this kind of stuff super easy, see if you can try the eval. I
have been using it with great results...
www.realthinclient.com
Walter Fordham
SmartQuest Technology, Inc.
 

Re:Passing a parameter via link

Do you have a simple step by step example?
"Danijel Tkalcec [RTC]" <XXXX@XXXXX.COM>writes
Quote
Btw ... correct URL would be:
mydomain.com/myscript

You have to use '?' to separate the file name from query parameters,
then you can use ';' or '&' to separate multiple query parameters, like
this:
mydomain.com/myscript

With RTC, on the server-side, you would use this to read parameters:

mycustomer := Request.Query['custid'];
myproduct := Request.Query['product'];
myaffiliate := Request.Query['affiliate'];

--
Danijel Tkalcec
www.deltasoft.hr/rtc/author.htm

RealThinClient components
-------------------------------------------
* The Easiest way to build Internet-enabled applications
- Clients, Stand-alone Servers, ISAPI extensions -
>Write and Call Remote Functions
>Download and Upload Files
>Single- and Multi-Threaded mode
>Firewall friendly - all over HTTP
>Stress-tested for highest stability

news://news.realthinclient.com

www.realthinclient.com
or www.deltasoft.hr/rtc
"Danijel Tkalcec [RTC]" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>"STEVE WARBURTON" writes:
>>I have found www.yoursite.com/yourpage,clientnumber=1234 is
>>supposed to send the variable clientnumber := 1234. But how do I read
>>this on the server end.
>
>In RTC, you would access request query parameter with:
>
>myclient := Request.Query['clientnumber'];
>
>... but, I don't know anything about IntraWeb.
>
>--
>Danijel Tkalcec
>www.deltasoft.hr/rtc/author.htm
>
>RealThinClient components
>-------------------------------------------
>* The Easiest way to build Internet-enabled applications
>- Clients, Stand-alone Servers, ISAPI extensions -
>>Write and Call Remote Functions
>>Download and Upload Files
>>Single- and Multi-Threaded mode
>>Firewall friendly - all over HTTP
>>Stress-tested for highest stability
>
>news://news.realthinclient.com
>
>www.realthinclient.com
>or www.deltasoft.hr/rtc
>


 

Re:Passing a parameter via link

"STEVE WARBURTON" writes:
Quote
Do you have a simple step by step example?
Yes, there are step-by-step examples in the Quick-Start guide:
www.deltasoft.hr/rtc/quickstart.htm
You might take a closer look at Server Lesson 2b,
which handles using Request Query parameters.
--
Danijel Tkalcec
www.deltasoft.hr/rtc/author.htm
RealThinClient components
-------------------------------------------
* The Easiest way to build Internet-enabled applications
- Clients, Stand-alone Servers, ISAPI extensions -
Quote
Write and Call Remote Functions
Download and Upload Files
Single- and Multi-Threaded mode
Firewall friendly - all over HTTP
Stress-tested for highest stability
www.realthinclient.com
or www.deltasoft.hr/rtc
 

Re:Passing a parameter via link

Walter Fordham writes:
Quote
Steve,

I would really give RTC(RealThinClient Components) a good look. It
makes this kind of stuff super easy, see if you can try the eval. I
have been using it with great results...

www.realthinclient.com
The support has been excellent as well.
--
Kevin Powick
 

Re:Passing a parameter via link

Well to do this in IWS you would be best to ask it on their NG's:
For frontpage it should look something like this:
<%=Request("uid")%>
Of course thats if I am remembering FP properly. For reference you might
check this page out:
home.att.net/~codeLibrary/FrontPage/tweaks.htm
Its the one I use for FP reference when I am forced to use it :)
Jeremy
"STEVE WARBURTON" <XXXX@XXXXX.COM>writes
Quote
I have Delphi 7 & intraweb, Front page 2000. I know very little about
server side 'stuff' so be gentle with me.

The client number is already known. What we are trying to achieve is an
affiliate scheme whereby an affiliate i.e. client no 1234 advertises our
services via a link of his web site or within an email. We need to know
when a new customer orders which affiliate has introduced the client (so
we can pay his initial fee and ongoing payments).

I have found www.yoursite.com/yourpage,clientnumber=1234 is
supposed to send the variable clientnumber := 1234. But how do I read this
on the server end.

Cheers for the help so far.



"Jeremy Darling" <XXXX@XXXXX.COM>writes
news:437a2826$XXXX@XXXXX.COM...
>Your code is actually non-secure and should never be run. You forgot to
>show off the extraction of the field, or you are relying upon
>registerglobals being set to true (Major security NO NO). Properly (in
>PHP that is) the code should look more like:
>
><?php
>function ValidateUIN($UIN){
>// Validation code with return here
>}
>
>if(isset($_REQUEST['ClientID'])&&ValidateUIN($_REQUEST['ClientID'])){
>$ClientNumber = $_REQUEST['ClientID'];
>}else{
>$ClientNumber = "Error, possiable hack attempt with invalid ClientID,
>please contact the system administrator.";
>}
>
>print "Your number: $ClientNumber";
>//Notice no use of Echo, echo can not be redirected in some versions of php
>?>
>
>Now in Delphi you can do this also with a server side NSAPI, ISAPI, or
>other integration solution. Typically you can use the TPageProducer and
>template files, thus a field such as <#ClientID>will be replaced (in
>code) with the client id. You can also hand generate the page.
>
>This would be done in the Response or Request objects.
>
>Finally actually, for security this should be done in a Session Variable
>and not in the request/response headers. (If on a webpage) and
>de-crypted via JS on the web page. In an e-mail its another story, and
>should probiably just be presented normally, or via a link with
>validation code that takes the user to a page that double checks the
>validation code, then presents the user with their Client ID.
>
>Jeremy
>
>PS: Steve, Assuming that you already generate your random client ID's to
>send them to the client Via and E-Mail is easy enough. Just about any
>3rd Party TCP/IP library (Indy, ICS, ect) can do this. On the server
>page side what software do you want to use, I will be happy to post up
>(online or offline in e-mail) samples for you to use.
>
>
>"Chris Thornton" <XXXX@XXXXX.COM>writes
>news:437a036a$XXXX@XXXXX.COM...
>>"SteveW" <XXXX@XXXXX.COM>writes
>>news:XXXX@XXXXX.COM...
>>>When the link arrives at the web page I need to display that number.
>>>Welcome your client number is "1234"
>>
>>www.yoursite.com/yourpage.php&clientnumber=1234
>>
>>then in yourpage.php:
>>
>><?PHP
>>{
>>echo "Welcome $clientnumber";
>>}
>>?>
>>
>>That should do it. This is really off-topic though, and should be in a
>>.php forum.
>>--
>>Chris
>>
>>
>>
>
>