Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to forward a URL with a Username into a URL with an ID?How to forward a URL with a Username into a URL with an ID?
Previous
 
Next
New Post
3/20/2009 3:35 PM
 

Hey All,

Huge thanks for the tip! I must admit that my SQL programming skills aren't that great (I usually live in the PHP world), and any thoughts you have would be great. So far, based upon your example, I have:

declare @tmpId nvarchar(4);
set @tmpId = (select userid from users where username = '[QUERYSTRING:uname]');

select @tmpId

A couple questions... let's my my URL were: http://www.dnn.com/YourProfile/tabid/137/ID/45/Default.aspx
 

How would I integrate the @tmpId into the URL string in the editor? I've tried a couple options, but what seems most probable is that there's a way to write the opening javascript and first part of the URL string, and then concant the second (ID) and third (Default.aspx and closing javascript).  However -- if there is, I can't seem to figure it out!

THe other question I have is about this esRedirect script - is that something I need to install, or is it included by default? I've tried running it alone, included into my header tags (as suggested) and embedded into the Query - but no forwarding action seems to work.

Any thoughts?

Thanks so much, all!

--Dave

 

 
New Post
3/20/2009 5:56 PM
 

Baatezu wrote

 I haven't used it, or played with it at all - and this is basing it off of your SQL example (which may have been simplified from how it's actually done) - Do you have SQL Injection prevention inplace to make sure the isn't malicious, or can't behave maliciously?

Advanced Datagrid is not "my" module (I didn't write it), if that's what you're asking.  My post simply shares some sample SQL to plug into it to achive role-based forwarding.
 
By default the ADG module avoids the *worst* injection attacks by disallowing any query / subquery containing the words INSERT, DELETE, UPDATE, DROP (so that user that picked "UPDATE" as a username is probably out of luck...).


esmamlin atxgeek.me
 
New Post
3/20/2009 6:16 PM
 

dhcrusoe wrote

Hey All,

Huge thanks for the tip! I must admit that my SQL programming skills aren't that great (I usually live in the PHP world), and any thoughts you have would be great. So far, based upon your example, I have:

declare @tmpId nvarchar(4);
set @tmpId = (select userid from users where username = '[QUERYSTRING:uname]');

select @tmpId

A couple questions... let's my my URL were: http://www.dnn.com/YourProfile/tabid/137/ID/45/Default.aspx
 

How would I integrate the @tmpId into the URL string in the editor? I've tried a couple options, but what seems most probable is that there's a way to write the opening javascript and first part of the URL string, and then concant the second (ID) and third (Default.aspx and closing javascript).  However -- if there is, I can't seem to figure it out!

THe other question I have is about this esRedirect script - is that something I need to install, or is it included by default? I've tried running it alone, included into my header tags (as suggested) and embedded into the Query - but no forwarding action seems to work.

Any thoughts?

Thanks so much, all!

--Dave


 

Take a look at the last lines of my posted example.  These show how to use the query to pass back inline javascript that will auto-forward the user to whatever URL you specify.  So, for your example, if you want an incoming user to land on a certain page with a querystring "uid" equal to the value in "@tmpId" you'd use:
 
select '< script >window.location="http://{page URL here}?uid='+@tmpId+'"< /script >'
 
(Be sure to remove the extra spaces after the "<" and before the ">" characters.)
 
This will immediately forward the user from the redirect page to the target page.  Note that your redirect page must be an "interim" page -- it cannot be the destination page (unless you add more code to prevent an endless loop).

 
Regarding the "esRedirect" variable -- that's optional but I recommend it so you have an easy way to disable your redirect if it goes awry.  Therefore, you'd need to set esRedirect to "true" in a script block in the page header (as detailed in the posted example) and your "select" statement would be:
 
  select '< script >if(esRedirect){window.location="http://{page URL here}?uid='+@tmpId+'"}< /script >'


Also....Baatezu made a very valid point regarding SQL injection.  Although the module protects against data loss by disallowing DELETE, UPDATE, and DROP, it does allow SELECT (of course!).  Once you believe you have a working solution you'll want to try to injecting a "select" statement to see if you
can force your particular query to return data other than the intended data.
 
-mamlin


esmamlin atxgeek.me
 
New Post
3/23/2009 10:21 AM
 

Mamlin,

Many thanks for helping work out the solution. As you have advised, it works -- perfectly! What you have provided is incredible helpful, because it means that without having to edit the sources, it's possible to link between the "username" fields and the profiling system, such that it's possible to integrate profiles more thoroughly across the site. The code I'm using is: 

<a href='http://ctnation.citizenschools.net/dotnetnuke/Jump/tabid/160/Default.aspx?uname=
<%#GetAuthorName(Container.DataItem("PostLastAuthor").ToString(), Container.DataItem("ThreadCount"))%>
'>
                           
<%#GetAuthorName(Container.DataItem("PostLastAuthor").ToString(), Container.DataItem("ThreadCount"))%>
</a>

for instance, with the Presstopia Forums. I'll be doing something similar for the "newest user" functions of the UsersOnline, and also the Blog pages.

Thanks!

--Dave

 
New Post
3/24/2009 5:04 PM
 

Dave-
I'm glad you figured out a solution for your need.  If you think the functionality would be of benefit to the average DNN user I encourage you to add a feature request ("enhancement") to the appropriate modules' entries on Gemini:

  http://support.dotnetnuke.com/Main.aspx
 
 
Cheers!
-mamlin


esmamlin atxgeek.me
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...How to forward a URL with a Username into a URL with an ID?How to forward a URL with a Username into a URL with an ID?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out