Forum Moderators: coopster

Message Too Old, No Replies

PHP redirection and Javascript

         

dave1236

8:57 pm on Apr 16, 2008 (gmt 0)

10+ Year Member



All:

i am trying to spruce up my affiliate site using CJ Smartzones, but I am having issues getting the Javascript to do what I want.

In short, I am able to pass a user name properly to the javascript, and am also able to query my database fine.

What I am trying to do is something like the following:

<a href='validatelogin.php'><SCRIPT type="text/javascript" LANGUAGE="javascript" src="http://www.example.com/1g-e36f?SID=login"> </SCRIPT>

So, to explain, the script serves the images I want to display. If a user clicks on the image presented by the script, I want to check to ensure they have logged-in, and 'validatelogin.php' does that.

But for some reason, my <a href> is ignored, and a click sends the person to the merchant.

Maybe I can't do such a thing, so I ask the group.

Thanks,

[edited by: dreamcatcher at 7:43 am (utc) on April 18, 2008]
[edit reason] Use example.com, thanks. [/edit]

coopster

11:35 pm on Apr 17, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How do you know that your href is being ignored? Have you tried an exit [php.net] at the very beginning of the validatelogin.php script to make sure?

dave1236

6:07 pm on Apr 18, 2008 (gmt 0)

10+ Year Member



I believe that it is ignoring the <a href> because if I change the link to other pages, clicking the link still goes to the link that comes from the <SCRIPT>

coopster

2:37 pm on Apr 21, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Then I would have a look at the code in that <script> you have to see if it is doing a redirect, which is likely the case.

dave1236

1:30 am on Apr 23, 2008 (gmt 0)

10+ Year Member



Yeah...I thought as much.

So, I went back and actually simply created a table myself and used the rand() to rotate some various image links.