Forum Moderators: open

Message Too Old, No Replies

Javascript User Verification (?)

I need help verifying the user coming in and redirecting his clicked link

         

shimeal

3:56 pm on Aug 5, 2004 (gmt 0)

10+ Year Member



Hey,

Please forgive me if I have used the wrong terminology to describe my question. Here is what I am trying to do; any and all suggestions are appreciated.

I have a site, <snip>, that has about 20 pages open to anyone on the web and then a catalog that you must log-in to in order to place orders. I want to create buttons on the open pages to specific products in the catalog. My problem is that I don't know how to build a user-verification pop-up window that will prompt the user for the ID and Password and, once entered, will then take them directly to the product in my catalog that corresponds to the link they originally clicked. In other words, I don't want someone to click a link for a specific product brand that is listed on the open portion of my site (let's say it is an HP icon), be prompted to enter their ID and password, and then, once verified, be dumped into the general catalog. I want them to go directly to the HP section of the catalog. Is this possible to do with a pop-up screen for user verification?

Any links to tutorials would be really appreciated! Thanks!

[edited by: korkus2000 at 1:10 pm (utc) on Aug. 6, 2004]
[edit reason] No personal URLs please [/edit]

thegingerbreadman

12:53 am on Aug 10, 2004 (gmt 0)



Here you go dude, I don't have more time to test it because the quitting whistle is about to blow and I want to get a good spot in the brontosaurus line.

Make two pages, the first has this code:

<script language="JavaScript"><!--
var loginname = '';
var loginpassword = '';

function windowOpen(itemname) {
var myWindow=window.open('popup.html','windowRef','width=200,height=200');
myWindow.location.href = 'popup.html';
myWindow.myForm.itemid.value = itemname;
alert(itemname);
alert(myWindow.myForm.itemid.value);
if(!myWindow.opener)
myWindow.opener = self;
}

//--></script>

<a href="javascript:windowOpen('gloves')">click me to buy gloves</a>

Now make a second page called popup.html:

<script language="JavaScript"><!--
function continueshopping() {
opener.location.href = "http://yoursite.com/loginredir.php?login=" +

document.myForm.login.value + "&pass=" + document.myForm.pass.value + "&itemid=" +

document.myForm.itemid.value;
self.close();
}
//--></script>

<form name="myForm">
Name: <input type="text" name="login">
Password: <input type="password" name="pass">
<input type=hidden name=itemid>
<input type="button" value="can I just buy something?" onClick="continueshopping()">
</form>

clicking the "buy gloves" link launches a pop up with some form fields and a hidden field that holds the itemid for your clicked on item (or category). Then it redirects the main window to loginredir.php, which is a page that you build that grabs the login and password parameters, logs them in, and then redirects to the correct item based on the &itemid (use Header: Location).

first post
hello everyone

TGM

shimeal

12:44 pm on Aug 12, 2004 (gmt 0)

10+ Year Member



TGM,

Thanks for the reply! I will be working on my site this weekend and will post any other questions I have then (which, hopefully, will be none). Anyway, I appreciate your help.

Brian