Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 "convert" a querystring?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 19 September 2007 :  08:03:34  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
How can I "convert" a querystring?

I have a modded version of Marcel's blog mod and it use the querystring "log_id". However there are some autogenerated links that point to the blog mod with the old "TOPIC_ID" querystring...

I tried this:

if not Request.QueryString("TOPIC_ID") = "" then
T_ID = Request.QueryString("log_id")
Response.Write(" T_ID ")
Response.Redirect("grarticles.asp?log_id=T_ID")
end if

but that didn't work, why? =)
<

/Tribaliztic
- www.gotlandrace.se -

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 19 September 2007 :  08:28:43  Show Profile  Reply with Quote
T_ID=request.querystring("log_id")
if len(T_ID)=0 or not isnumeric(T_ID) then T_ID=request.querystring("TOPIC_ID")
if len(T_ID)>0 and isnumeric(T_ID) then
'	response.write	T_ID
	response.redirect "grarticles.asp?log_id="&T_ID
else
	response.write	"Error"
end if
<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”

Edited by - Shaggy on 19 September 2007 08:46:28
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 19 September 2007 :  08:45:10  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Hm... when I added that code I got a 404-error on the page =)
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 19 September 2007 :  08:47:27  Show Profile  Reply with Quote
Sure it's a 404 & not a 500? Got Linkage? Deleted the "dim T_ID" line above as it's not really necessary and may be the cause of a 500 error.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 19 September 2007 :  08:58:49  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
The page takes forever to load and then nothing happens. I've mailed link to you..
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 19 September 2007 :  09:12:25  Show Profile  Reply with Quote
Go it, didn't realise you were placing this code on the page you were redirecting to so what I gave you was creating an infinite loop.

Here's the code you need:
T_ID=request.querystring("log_id")
if len(T_ID)=0 or not isnumeric(T_ID) then T_ID=request.querystring("TOPIC_ID")
if len(T_ID)>0 and isnumeric(T_ID) then
	response.write	"Code"
else
	response.write	"Error"
end if
There's actually no need for the redirect, just be sure to reference T_ID everywhere within your code. The "Code" I've highlighted in green above is where you place the code for your page, the "Error" is whatever error you want to present to members if T_ID is not valid, i.e., it's empty or doesn't have a numeric value.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 20 September 2007 :  02:26:42  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Hm.. you mean I should replace all instances of:
cLng(Request.QueryString("log_id")
with
T_ID
?
This will probably mess things up for me, can't I just make cLng(Request.QueryString("log_id") understand what's in the cLng(Request.QueryString("TOPIC_ID") ?
=)
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 20 September 2007 :  03:08:01  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
I did another workaround =)

On topic.asp I added this:

strSQL7 = "SELECT FORUM_ID FROM FORUM_TOPICS WHERE TOPIC_ID = " & cLng(Request.Querystring("TOPIC_ID")) & ""
set ARTrs = Server.CreateObject("ADODB.Recordset")
ARTrs.open strSQL7, strConnString
if not ARTrs.EOF then
if ARTrs("FORUM_ID") = 85 then
Response.Redirect("grarticles.asp?log_id=" & cLng(Request.Querystring("TOPIC_ID")) & "")
end if
end if
ARTrs.close

To check if the topic is supposed to be an article, then redirect to the article mod.

This soled my problem, but maybe not in the best way =)

Thanks Shaggy for your time!
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 20 September 2007 :  04:39:02  Show Profile  Reply with Quote
quote:
Originally posted by tribaliztic
... can't I just make cLng(Request.QueryString("log_id") understand what's in the cLng(Request.QueryString("TOPIC_ID") ?
That's what my code does, assigning the value to a variable. Replacing all occurrences of request.querystring("log_id") with T_ID in your code shouldn't have messed anything up for you but, if you've found another way around it that works for you, fair enough.

<

Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 20 September 2007 :  04:44:03  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Okay, it's just me being a n00b, sorry =)
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07