Forum Moderators: open

Message Too Old, No Replies

Linking within "links"

         

dave1236

8:37 pm on Aug 17, 2006 (gmt 0)

10+ Year Member



Here is a question whose answer is lilely staring me in the face, but I am so close, I cannot figure it out.

I have a bunch of articles on my home page whose headlines are available to all visitors. When a user clicks on a link, they will need to sign in or register, and then they are brought to the page (i.e. "A" as below). so, how do i inject a validation rule to execute prior to the user being brought to the destination?

For example, with:

<a href="A">A</a>
<a href="B">B</a>
<a href="C">C</a>

before the users sees A, B, or C - they need to login. Can anyone suggest a means to accomplish this?

Thanks!

LifeinAsia

9:12 pm on Aug 17, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Have A, B, C in a password protected directory. If they are not logged in, they will need to login before being able to access those pages.

The exact implementation depends on your O/S, web server, and any scripting languages.

encyclo

9:18 pm on Aug 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you need to check login status on the landing pages not on the index page - once the user's browser requests the article page, use an authentication mechanism powered by a server-side scripting language of your choice (PHP, Perl, ASP...) or use Apache basic authentication.

dave1236

12:52 am on Aug 18, 2006 (gmt 0)

10+ Year Member



That is what i thought...maybe i am not thinking about your answers properly...

does this mean that i need to edit each of the links to the articles and create a copy of the page that points to the authenication?

In other words, does this mean my main page has to be something like this:

<a href="login">A</a>
<a href="login">B</a>
<a href="login">C</a>

and after they login, the "proper" links show up?
<a href="A">A</a>
<a href="B">B</a>
<a href="C">C</a>

if so, that is what i am trying to avoid, as the more articles I get, the more annoying the duplication becomes! but if it is what it is, so be it!

dave1236

12:53 am on Aug 18, 2006 (gmt 0)

10+ Year Member



one additional piece of info...

the article links

<a href="A">A</a>
<a href="B">B</a>
<a href="C">C</a>

tend to be external to my site.

dave1236

1:13 am on Aug 18, 2006 (gmt 0)

10+ Year Member



and i use php

LifeinAsia

3:33 pm on Aug 18, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



So you want to force someone to register before they can go to an EXTERNAL site?

Fotiman

3:51 pm on Aug 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




does this mean that i need to edit each of the links to the articles and create a copy of the page that points to the authenication?

In other words, does this mean my main page has to be something like this:

<a href="login">A</a>
<a href="login">B</a>
<a href="login">C</a>

and after they login, the "proper" links show up?
<a href="A">A</a>
<a href="B">B</a>
<a href="C">C</a>

No, this is the exact opposite of what was said. You do NOT need to modify the links themselves. The browser would send a request to the actual link page, where some authentication check would be performed to see if the user was logged in.


the article links

<a href="A">A</a>
<a href="B">B</a>
<a href="C">C</a>

tend to be external to my site.

Uh... that doesn't really make sense. You can't really force someone to authenticate against your site to view content that is served from some other site.

Fotiman

3:54 pm on Aug 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Also, if you do a Google search for php authentication, you should find plenty of examples and tutorials, including free scripts that will handle the authentication for you.

But like I said, it doesn't really make sense for an external page.

dave1236

4:11 pm on Aug 18, 2006 (gmt 0)

10+ Year Member



yes. the links they request are 3rd party destinations - I compile resources of interest (aka research reports and such)

dave1236

4:16 pm on Aug 18, 2006 (gmt 0)

10+ Year Member



Thanks guys. I currently use sessions for authenication for content within my site, and this works fine. I guess I was hoping that there would be a way to simply 'inject' a landing page prior to going out to the external content.
i appreciate the feedback