Help with Password Login Script

  • Thread starter julietta carpentieri
  • Start date
J

julietta carpentieri

I would like to know if we could modify the script below to have
different usernames and passwords which, depending on which company
they are with would take them to their company page. For example:

A person from company ABC would have a username of : XXX
and a password : 123
It would then take them to the ABC webpage created for them
(abcprograms.html)

A person from company DEF would have a username of : YYY
and a password : 456
It would then take them to the DEF webpage created for them.
(defprograms.html)

A person from company GHI would have a username of : UUU
and a password : 789
It would take them to their company webpage we created for them.
(ghiprograms.html)

I want to do this from one central login page. Would I be able to do
this with the script below, or would we need to use something else?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Valero Login</title>
</head>

<body bgcolor="#336699">
<script language = "javascript">

/*
Script by Anubhav Misra ([email protected])
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/

function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('programs.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
<table width="50%" border="0" cellspacing="0" cellpadding="4"
align="center" bgcolor="#FFFFFF">
<tr>
<td height="2" bgcolor="#333366"><font size="2" face="Verdana,
Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font face="Arial,
Helvetica, sans-serif" size="3">Welcome!</font></b></font></td>
</tr>
<tr>
<td height="149"><div align="left">
<form>
<p><font color="#000000" size="2" face="Arial, Helvetica,
sans-serif">Username :</font>
<input type="text" name="text2">
</p>
<p> <font color="#000000" size="2" face="Arial, Helvetica,
sans-serif">Password :</font>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit"
onClick=javascript:validate(text2.value,"Antonio",text1.value,"bluebonnet")</p>
</form>
</div></td>
</tr>
<tr>
<td height="2"><div align="left">
<table width="80%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td height="2"><div align="center"><font size="1"
face="Verdana, Arial, Helvetica, sans-serif" color="#5B7D99">If you
experience any problems with xxx.com please contact the <a
href="mailto:[email protected]">webmaster</a></font></div></td>
</tr>
<tr>
<td height="2">&nbsp;</td>
</tr>
</table>
</div></td>
</tr>
</table>
</body>
</html>


I appreciate your help.

Thanks,

Julie Carpenter
 
M

McKirahan

julietta carpentieri said:
I would like to know if we could modify the script below to have
different usernames and passwords which, depending on which company
they are with would take them to their company page. For example:

A person from company ABC would have a username of : XXX
and a password : 123
It would then take them to the ABC webpage created for them
(abcprograms.html)

A person from company DEF would have a username of : YYY
and a password : 456
It would then take them to the DEF webpage created for them.
(defprograms.html)

A person from company GHI would have a username of : UUU
and a password : 789
It would take them to their company webpage we created for them.
(ghiprograms.html)

I want to do this from one central login page. Would I be able to do
this with the script below, or would we need to use something else?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Valero Login</title>
</head>

<body bgcolor="#336699">
<script language = "javascript">

/*
Script by Anubhav Misra ([email protected])
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/

function validate(text1,text2,text3,text4)
{
if (text1==text2 && text3==text4)
load('programs.html');
else
{
load('failure.html');
}
}
function load(url)
{
location.href=url;
}
</script>
<table width="50%" border="0" cellspacing="0" cellpadding="4"
align="center" bgcolor="#FFFFFF">
<tr>
<td height="2" bgcolor="#333366"><font size="2" face="Verdana,
Arial, Helvetica, sans-serif" color="#FFFFFF"><b><font face="Arial,
Helvetica, sans-serif" size="3">Welcome!</font></b></font></td>
</tr>
<tr>
<td height="149"><div align="left">
<form>
<p><font color="#000000" size="2" face="Arial, Helvetica,
sans-serif">Username :</font>
<input type="text" name="text2">
</p>
<p> <font color="#000000" size="2" face="Arial, Helvetica,
sans-serif">Password :</font>
<input type="password" name="text1">
<input type="button" value="Login" name="Submit"
onClick=javascript:validate(text2.value,"Antonio",text1.value,"bluebonnet")
</p>
</form>
</div></td>
</tr>
<tr>
<td height="2"><div align="left">
<table width="80%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr>
<td height="2"><div align="center"><font size="1"
face="Verdana, Arial, Helvetica, sans-serif" color="#5B7D99">If you
experience any problems with xxx.com please contact the <a
href="mailto:[email protected]">webmaster</a></font></div></td>
</tr>
<tr>
<td height="2">&nbsp;</td>
</tr>
</table>
</div></td>
</tr>
</table>
</body>
</html>


I appreciate your help.

Thanks,

Julie Carpenter

So the above will only load "Antonioprograms.html"?

Basically, you just need to change
load("programs.html");
to
load(text1 + "programs.html");

It's not a good idea to have the username and password hardcoded.
You should probably use a database to validate these fields.

Here's a variation that uses CSS.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Valero Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
/*
Script by Anubhav Misra ([email protected])
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/
function validate(text1,text2,text3,text4) {
alert("validate("+text1+","+text2+","+text3+","+text4+")");
if (text1 == text2 && text3 == text4) {
load(text1 + "programs.html");
} else {
load("failure.html");
}
}
function load(url) {
location.href = url;
}
</script>
<style type="text/css">
..style1 { color:#FFFFFF; font-family:Arial, Helvetica, sans-serif;
font-size:12pt; font-weight:bold }
..style2 { color:#000000; font-family:Arial, Helvetica, sans-serif;
font-size:10pt }
..style3 { color:#5B7D99; font-family:Arial, Helvetica, sans-serif;
font-size:8pt }
</style>
</head>
<body bgcolor="#336699">
<table align="center" bgcolor="#FFFFFF" border="0"
cellpadding="4" cellspacing="0" width="50%">
<tr>
<td bgcolor="#333366" class="style1">Welcome!</td>
</tr>
<tr>
<td class="style2" height="149" >
<form>
<p> &nbsp; &nbsp; Username :
<input type="text" name="text2" size="20" maxlength="20" value="">
</p>
<p> &nbsp; &nbsp; Password :
<input type="password" name="text1" size="20" maxlength="20" value="">
<input type="button" value="Login"
onclick="validate(text2.value,'Antonio',text1.value,'bluebonnet')">
</p>
</form>
</td>
</tr>
<tr>
<td align="center" class="style3">
If you experience any problems with xxx.com
<br>please contact the
<a href="mailto:[email protected]">webmaster</a>
<br><br>
</td>
</tr>
</table>
</body>
</html>
 
J

julietta carpentieri

I'm not familiar with what you are trying to do.

I want something simple right now, so the hardcoating is okay. Anyone
from any company will have the same username and password. They are
just going to some pages that link together that shows their specific
branding colors: like ConocoPhillips, CircleK, Valero, etc. I want
Valero to login and go to their pages, Conoco to go to their pages,
etc. Could you be more specific. If you have something that would
work, we would be willing to pay you for your time. Let me know how to
get in touch with you.

Thanks,

Julie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top