Links With ID

They have: 3 posts

Joined: Nov 2002

Suppose I have links in one page called showlinks.asp . The other page have links like showlinks.asp?ID=101.How to open the links from such ID?I really liked this because it's secure.Also How can we make the page not viewable from simply typing http://someurl.com/showlinks.asp ?
Please Advice
Dibyendra

Dibyendra Hyoju

Busy's picture

He has: 6,151 posts

Joined: May 2001

Welcome dibyendra,
I don't know .asp, but PHP is kind of similar, say you have showlinks.php?id=101 on the showlinks.php page you could have an array, if/else, switch options to go through matches to display the result.
example (if/else)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The way to do that is to create a script in ASP that reads the ID and then delivers the url either through a meta refresh or a header redirect or a new window.

In order to prevent someone from accessing the script directly, you can set the script to redirect empty queries to a page explaining how it work, or back to the page with the links on it, or to display an error message. You can also set it to check for the referring page to be the one on your site, so people cannot abuse the script for their own purposes (which would be hacking your server...)

You will need someone who knows how to program ASP, which is a server-side language.

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

I'm guessing that a Select Case will do the trick-

Select Case ID
  Case 100
    'show what you want for 100

  Case 101
    'show what you want for 101

  Case Else
    'default output - blank

End Select
'

And welcome to TWF. Smiling

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

expanding on Abhi's SELECT CASE..

<%

Select Case ID
  Case 100
    ' redirect to another page
    Response.Redirect "id100.asp"

  Case 101
    ' include contents of another page
    %><!--#include virtual="id101.asp"--><%

  Case Else
    ' print something
    Response.Write "Page not found"

End Select

%>
'

Mark Hensler
If there is no answer on Google, then there is no question.

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

Does this help you at all?

openmind's picture

He has: 945 posts

Joined: Aug 2001

I.m only doing this coz I'm difficult!!

In ColdFusion it would be:

<!---Make sure ID has been passed--->
<cfif NOT IsDefined("ID")>
  <cflocation="index.cfm">
</cfif>

<!---If the ID has been passed, let's assume your URL is in a datbase--->
<!---First get the ID and the link--->

<cfquery datasource="DSN" name="Jump">
  SELECT ID, Link
  FROM LinksTable
  WHERE ID = #ID#
</cfquery>


<!---Now just relocate the user to that link--->

<cfoutput query="Jump">
  <cflocation="#Link">
</cfoutput>
'

Always more than one way to skin an elephant! No thats not it....A racoon, nope,....er...cat? Roll eyes

They have: 3 posts

Joined: Nov 2002

Thank You All Guys For Helping Me.
I really Appreciated Your Help.
Hey zollet yeah I'm A very Beginner but i'm very interested in ASP Programming.Nevermind zollet .
Dibyendra

Dibyendra Hyoju

He has: 1,016 posts

Joined: May 2002

Quote: Originally posted by dibyendra
Hey zollet yeah I'm A very Beginner but i'm very interested in ASP Programming.Nevermind zollet.

That's all I wanted to know Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.