473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Querystring issue

Hi all,

is there anyway of separating a string by either a space or + sign, I have
an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...ext=19%2Bdavid

the last part text= I need to split into 2 parts I need to read the first
part 19 and match that to the db and then deal with the name David, I have
tried everything, is there anyway of doing this even if the string read
text=19+david if there was a way of separating the two.

Thanks in advance.

Regards
Simon Gare
The Gare Group Limited

website: www.thegaregroup.co.uk
website: www.privatehiresolutions.co.uk
Apr 8 '07 #1
6 2491
Simon Gare wrote on 08 apr 2007 in
microsoft.public.inetserver.asp.general:
Hi all,

is there anyway of separating a string by either a space or + sign, I
have an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...id=2920893&fro
m=447912956700&to=447624813579×tamp=2007-04-07+03%3A56%3A42&text=19%2Bd
avid

the last part text= I need to split into 2 parts I need to read the
first part 19 and match that to the db and then deal with the name
David, I have tried everything, is there anyway of doing this even if
the string read text=19+david if there was a way of separating the
two.

============= test.asp ======================
<% 'vbscript

if request.querystring("text").count=1 then
a = split(request.querystring("text"),"%2B")
response.write a(0) & "<br>"
response.write a(1) & "<br>"
end if

%>

<form method='get'>
<input name='text' value='19%2Bdavid'>
<input type='submit'>
</form>
==============================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 8 '07 #2
Thanks Evertjan,

how would the insert query look, below is what I have now but how would I
split that when entering the data 19 into 1 field and David into another?

Dim api_id
Dim sentfrom
Dim timestamp
Dim text
api_id = ParseString(Request.Querystring("api_id"))
from = ParseString(Request.Querystring("from"))
timestamp = Request.Querystring("timestamp")

text = ParseString(Request.Querystring("text"))
sql = "insert into dbo.SMSAPI (api_id,SentFrom,text,timestamp) values ("&
api_id &","& from &",'"& text &"','"& paxname &"',getdate())"
Thanks in Advance

Simon
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Simon Gare wrote on 08 apr 2007 in
microsoft.public.inetserver.asp.general:
Hi all,

is there anyway of separating a string by either a space or + sign, I
have an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...id=2920893&fro
m=447912956700&to=447624813579×tamp=2007-04-07+03%3A56%3A42&text=19%2Bd
avid

the last part text= I need to split into 2 parts I need to read the
first part 19 and match that to the db and then deal with the name
David, I have tried everything, is there anyway of doing this even if
the string read text=19+david if there was a way of separating the
two.


============= test.asp ======================
<% 'vbscript

if request.querystring("text").count=1 then
a = split(request.querystring("text"),"%2B")
response.write a(0) & "<br>"
response.write a(1) & "<br>"
end if

%>

<form method='get'>
<input name='text' value='19%2Bdavid'>
<input type='submit'>
</form>
==============================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Apr 8 '07 #3
Simon Gare wrote on 09 apr 2007 in
microsoft.public.inetserver.asp.general:
Thanks Evertjan,
[Please do not toppost on usenet]
>
how would the insert query look, below is what I have now but how
would I split that when entering the data 19 into 1 field and David
into another?

Dim api_id
Dim sentfrom
Dim timestamp
Dim text
api_id = ParseString(Request.Querystring("api_id"))
What is ParseString() ?????????
from = ParseString(Request.Querystring("from"))
timestamp = Request.Querystring("timestamp")

text = ParseString(Request.Querystring("text"))
sql = "insert into dbo.SMSAPI (api_id,SentFrom,text,timestamp) values
("& api_id &","& from &",'"& text &"','"& paxname &"',getdate())"
DANGEROUS! entering querystring strings directly in a SQL
is asking for SQL Injection/Insertion Attacks.
[read up on Insertion Attacks on the web!]

Do as I showed you extracting the two strings:

a = split(request.querystring("text"),"%2B")

Then test the resulting strings for Insertion Attack characters,
and if all is well set them into the SQL strings as you do above with
"from" etc.
Thanks in Advance

Simon
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>Simon Gare wrote on 08 apr 2007 in
microsoft.public.inetserver.asp.general:
Hi all,

is there anyway of separating a string by either a space or + sign,
I have an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...pi_id=2920893&
fro
m=447912956700&to=447624813579×tamp=2007-04-07+03%3A56%3A42&text=19%
2Bd avid

the last part text= I need to split into 2 parts I need to read the
first part 19 and match that to the db and then deal with the name
David, I have tried everything, is there anyway of doing this even
if the string read text=19+david if there was a way of separating
the two.


============= test.asp ======================
<% 'vbscript

if request.querystring("text").count=1 then
a = split(request.querystring("text"),"%2B")
response.write a(0) & "<br>"
response.write a(1) & "<br>"
end if

%>

<form method='get'>
<input name='text' value='19%2Bdavid'>
<input type='submit'>
</form>
==============================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)




--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 9 '07 #4
Sorry Evertjan its not working, need to match the first part of the
querystring against one table i.e. 19 and enter the second part i.e. David
into another table along with other info.

Sorry to be a pain but cannot separate the 2 apart even with your solution,
more assistance would be greatly appreciated.

Regards
Simon
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Simon Gare wrote on 09 apr 2007 in
microsoft.public.inetserver.asp.general:
Thanks Evertjan,

[Please do not toppost on usenet]

how would the insert query look, below is what I have now but how
would I split that when entering the data 19 into 1 field and David
into another?

Dim api_id
Dim sentfrom
Dim timestamp
Dim text
api_id = ParseString(Request.Querystring("api_id"))

What is ParseString() ?????????
from = ParseString(Request.Querystring("from"))
timestamp = Request.Querystring("timestamp")

text = ParseString(Request.Querystring("text"))
sql = "insert into dbo.SMSAPI (api_id,SentFrom,text,timestamp) values
("& api_id &","& from &",'"& text &"','"& paxname &"',getdate())"

DANGEROUS! entering querystring strings directly in a SQL
is asking for SQL Injection/Insertion Attacks.
[read up on Insertion Attacks on the web!]

Do as I showed you extracting the two strings:

a = split(request.querystring("text"),"%2B")

Then test the resulting strings for Insertion Attack characters,
and if all is well set them into the SQL strings as you do above with
"from" etc.
Thanks in Advance

Simon
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Simon Gare wrote on 08 apr 2007 in
microsoft.public.inetserver.asp.general:

Hi all,

is there anyway of separating a string by either a space or + sign,
I have an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...pi_id=2920893&
fro
m=447912956700&to=447624813579×tamp=2007-04-07+03%3A56%3A42&text=19%
2Bd avid

the last part text= I need to split into 2 parts I need to read the
first part 19 and match that to the db and then deal with the name
David, I have tried everything, is there anyway of doing this even
if the string read text=19+david if there was a way of separating
the two.
============= test.asp ======================
<% 'vbscript

if request.querystring("text").count=1 then
a = split(request.querystring("text"),"%2B")
response.write a(0) & "<br>"
response.write a(1) & "<br>"
end if

%>

<form method='get'>
<input name='text' value='19%2Bdavid'>
<input type='submit'>
</form>
==============================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Apr 9 '07 #5
Simon Gare wrote on 10 apr 2007 in
microsoft.public.inetserver.asp.general:
Sorry Evertjan its not working, need to match the first part of the
querystring against one table i.e. 19 and enter the second part i.e.
David into another table along with other info.

Sorry to be a pain but cannot separate the 2 apart even with your
solution, more assistance would be greatly appreciated.

Regards
Simon
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>Simon Gare wrote on 09 apr 2007 in
microsoft.public.inetserver.asp.general:
Thanks Evertjan,

[Please do not toppost on usenet]
If you keep on toposting I will not go on with this thread.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 9 '07 #6

"Simon Gare" <si***@simongare.comwrote in message
news:uh****************@TK2MSFTNGP06.phx.gbl...
Hi all,

is there anyway of separating a string by either a space or + sign, I have
an sms.asp page that receives a string in this format below

http://acompany.co.uk/online/interna...ext=19%2Bdavid
>
the last part text= I need to split into 2 parts I need to read the first
part 19 and match that to the db and then deal with the name David, I have
tried everything, is there anyway of doing this even if the string read
text=19+david if there was a way of separating the two.

Thanks in advance.

Regards
Simon Gare
The Gare Group Limited

website: www.thegaregroup.co.uk
website: www.privatehiresolutions.co.uk

aText = Split(Request.QueryString("text"), "+")

aText(0) will be "19" and aText(1) will be "david"

The %2B is an escape code for + because + is used converted to space by some
url encoders.

I think what you really need to do is make sure the code that generated the
URL in the first place does so in a consitent manner.

Apr 10 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: braindead | last post by:
Hi All Is 1. dopage.asp?<% =SessionID=value_here%> is different tha 2. dopage.asp?<%=SessionID=value_here%> ?? Please note that there is a space between the asp tags and the = sign in the...
5
by: John | last post by:
I have the following line in my ASP code. If UCase(Trim(CStr(oRset("Suburb"))))=UCase(Trim(CStr(Request.QueryString("link")))) then etc etc end if
11
by: VK | last post by:
Folks, An aspx page has some querystring variables in the URL. In the code beind file, I tried requesting these variables and setting as public variables, so it is not specific to a sub. ...
5
by: thomas | last post by:
I'm having a bit of trouble using Request.QueryString(). I want to click on the link to browse all <artist> records in an xml file begining with a particular letter. Any ideas where I'm going...
0
by: scott | last post by:
Below, I'm trying to remove the querystring name& value of "catID=12". I mananged to isolate the RESULTS part, but I need to be able to strip the querystring name and it's value, no matter if the...
12
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... ...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
3
by: Simon Gare | last post by:
Hi All, I have a querystring that contains the + sign as a separator, I need to read these values individually in a select statement, for example. &text=Single+205 where single is the type...
5
by: magix8 | last post by:
Hi, I have form GET method, example: index.asp?Type=1&Type=3&Type=4&.... So, I have something like this at the receiver side to retrieve multiple Type value and insert into tables.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.