Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Javascript - Multiple Users with Multiple Redirects  (Read 598 times)

0 Members and 1 Guest are viewing this topic.

Drakathas

    Topic Starter


    Newbie

    • Experience: Experienced
    • OS: Windows 10
    Javascript - Multiple Users with Multiple Redirects
    « on: December 15, 2017, 03:16:45 PM »
    First, let me say that I know javascript for logins isn't secure, but it's just so people can go to their own photo gallery, it's not like I am storing any sensitive information.
    Second, thank you in advance to those who respond, this is driving me nuts :-)

    Here is the dilemma, I would like a javascript code that allows multiple users to login.  This would be fine:

    function Login(form) {
    username = new Array("u1","u2","u3","u4","u5","u6","u7","u8","u9","u10");
    password = new Array("p1","p2","p3","p4","p5","p6","p7","p8","p9","p10");
    page =  new Array ("www.watcomechanical.net/applebees610.html";)
    if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] || form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] || form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] || form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] || form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) {
    self.location.href = page;
    }
    else {
    alert("Either the username or password you entered is incorrect.\nPlease try again.");
    form.username.focus();
    }
    return true;
    }


    but the problem is that all users who login go to the same page. I need something like:

    user1->gallery1.html
    user2->gallery2.html
    user3->gallery3.html

    is this even possible? I'm still new to coding, I know very little about php and mysql, i would like to get this system implemented until i learn.

    Thank you!