home *** CD-ROM | disk | FTP | other *** search
- <%
- #include </utility/global.fts>
- #include </utility/theme.fts>
- #include </utility/ftgate.fts>
-
- const ERR_SUCCESS = 0
- const ERR_BADMAILBOX = 1
- const ERR_BADPASSWORD = 2
- const ERR_BADDOMAIN = 3
- const ERR_NOACCESS = 4
- const ERR_BADTYPE = 5
- const ERR_DISABLED = 6
-
- const STR_BADLOGON = "Invalid User name/Password combination. Please re-enter."
- const STR_NOACCESS = "You do not have the privileges to use Web Mail.\n\nPlease contact your System Administrator."
- const STR_BADTYPE = "You cannot access this mailbox type with Web Mail.\n\nPlease contact your System Administrator."
- const STR_DISABLED = "This mailbox has been disabled.\n\nPlease contact your System Administrator."
-
- var err=0
-
- function setDefaults()
- {
- session.addressbook.individuals = 0
- session.addressbook.groups = 0
-
- session.webmail.elements=10
- session.webmail.width=72
- session.webmail.indent=0
- session.webmail.indentchar=">"
- session.webmail.replyto=""
- session.webmail.addsignature=0
- session.webmail.signature=""
-
- }
-
- function readAddrBook()
- {
- var d = new server.domain
- d.domainname=session.webmail.domain
-
- if (d.domainname==session.webmail.domain)
- {
- var m = new d.mailbox
- m.name=session.webmail.mailbox
-
- if (m.name==session.webmail.mailbox)
- {
- var filename = m.path+"\\WebMail\\addrbook.txt"
- var file = new server.file
-
- if (file.open(filename))
- {
- var i
- file.first()
- var line = file.text
- line=line.slice(0, line.length()-1)
-
- if (line=="ab1")
- {
- file.next()
- session.addressbook.individuals = number(file.text)
- file.next()
- session.addressbook.groups = number(file.text)
- var total = number(session.addressbook.individuals+session.addressbook.groups)
-
- for (i=0;i<total;i=i+1)
- {
- file.next()
- line = file.text
- session.addressbook.type[i]=number(line.slice(0, line.length()-1))
- file.next()
- line = file.text
- session.addressbook.nickname[i]=line.slice(0, line.length()-1)
- file.next()
- line = file.text
- session.addressbook.email[i]=line.slice(0, line.length()-1)
- }
- }
-
- file.close()
- }
- }
- }
- }
-
- function readSettings()
- {
- var d = new server.domain
- d.domainname=session.webmail.domain
-
- if (d.domainname==session.webmail.domain)
- {
- var m = new d.mailbox
- m.name=session.webmail.mailbox
-
- if (m.name==session.webmail.mailbox)
- {
- var filename = m.path+"\\WebMail\\settings.txt"
- var file = new server.file
-
- if (file.open(filename))
- {
- var i
- file.first()
- var line = file.text
- line=line.slice(0, line.length()-1)
-
- if (line=="p1")
- {
- file.next()
- session.webmail.elements=number(file.text)
- file.next()
- session.webmail.width=number(file.text)
- file.next()
- session.webmail.indent=number(file.text)
- file.next()
- line = file.text
- session.webmail.indentchar=line.slice(0, line.length()-1)
- file.next()
- line = file.text
- session.webmail.replyto=line.slice(0, line.length()-1)
- file.next()
- session.webmail.addsignature=number(file.text)
- session.webmail.signature=""
- while (file.next())
- {
- session.webmail.signature=session.webmail.signature+file.text
- }
- }
-
- file.close()
- }
- }
- }
- }
-
- if (form.config=="1")
- {
- var s=string(form.mailbox)
- var index=s.indexOf("@",0)
- var domain
-
- session.webmail.user=form.mailbox
-
- if (index>=0)
- {
- session.webmail.mailbox=s.slice(0,index)
- domain=s.slice(index+1,s.length)
- }
- else
- {
- session.webmail.mailbox=form.mailbox
- var d = new server.domain
- var count=0
-
- d.findfirst("*")
- while (d.domainname)
- {
- if (d.description=="Local")
- {
- count=count+1
- domain=d.domainname
- }
-
- d.findnext()
- }
-
- if (count!=1)
- domain=""
- }
-
- var d = new server.domain
- d.domainname=domain
- if (d.domainname)
- {
- var m = new d.mailbox
- m.name=session.webmail.mailbox
- m.name = m.name // dereference possible alias
-
- if (m.name)
- {
- if (m.verifypassword(form.password))
- {
- if (m.status)
- {
- if ((m.type==MBX_LIST)||(m.type==MBX_GROUP))
- {
- session.webmail.mailbox=m.name
- session.webmail.domain=domain
- session.webmail.password=form.password
- %>
- <HTML>
- <HEAD>
- <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
- <!--
- parent.location.href="/mailboxes/index.fts";
- //-->
- </SCRIPT>
- </HEAD>
- <BODY>
- </BODY>
- </HTML>
- <%
- output.end()
- }
-
- var ok=false
- if (m.type==MBX_USER)
- {
- if (m.priv.domaindefaults)
- {
- if (d.priv.webaccess)
- ok=true
- }
- else
- {
- if (m.priv.webaccess)
- ok=true
- }
- }
-
- if (ok)
- {
- session.webmail.mailbox=m.name
- session.webmail.domain=domain
- session.webmail.password=form.password
- setDefaults()
- readAddrBook()
- readSettings()
- %>
- <HTML>
- <HEAD>
- <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
- <!--
- parent.location.href="/main.fts";
- //-->
- </SCRIPT>
- </HEAD>
- <BODY>
- </BODY>
- </HTML>
- <%
- output.end()
- }
- else if (m.type==MBX_USER)
- err=ERR_NOACCESS
- else
- err=ERR_BADTYPE
- }
- else
- err=ERR_DISABLED
- }
- else
- err=ERR_BADPASSWORD
- }
- else
- err=ERR_BADMAILBOX
- }
- else
- err=ERR_BADDOMAIN
- }
- else
- {
- session.webmail.mailbox=""
- session.webmail.domain=""
- session.webmail.password=""
- }
- %>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
- <HTML>
- <HEAD>
- <LINK REL=STYLESHEET HREF="/utility/main<%=nn4%>.css" TYPE="text/css">
- <META NAME="GENERATOR" Content="Microsoft Developer Studio">
- <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
- <TITLE>FTGate Web Mail -- Welcome</TITLE>
- </HEAD>
-
- <SCRIPT LANGUAGE="JavaScript1.2" TYPE="text/javascript">
- <!--
- var dir="<%=buttons%>"
-
- if (!document.images) {}
- else {
- logon0 = new Image();
- logon0.src = dir+"logon.gif";
- logon1 = new Image();
- logon1.src = dir+"logonon.gif";
- }
-
- function change(Name,Image,No)
- {
- if (!document.images) {}
- else document [Name].src = eval(Image + No + ".src");
- }
-
- <%
- if (netscape)
- {
- %>
- document.captureEvents(Event.KEYPRESS);
- document.onkeypress = keypress;
-
- function keypress(event)
- {
- if (event.which==13)
- {
- onLogon();
- return false;
- }
-
- return true;
- }
- <%
- }
- else
- {
- %>
- function keypress()
- {
- if (event.keyCode==13)
- {
- event.returnValue=null;
- onLogon();
- }
- }
- <%
- }
- %>
-
- function onLoad()
- {
- <%
- if (err==ERR_NOACCESS)
- output.writeln("alert(\""+STR_NOACCESS+"\");")
- else if (err==ERR_BADTYPE)
- output.writeln("alert(\""+STR_BADTYPE+"\");")
- else if (err==ERR_DISABLED)
- output.writeln("alert(\""+STR_DISABLED+"\");")
- else if (err)
- output.writeln("alert(\""+STR_BADLOGON+"\");")
- %>
- document.ftgate.mailbox.focus();
- }
-
- function isOK(form)
- {
- if (form.mailbox.value=="")
- {
- alert("Enter your Sign in name and password.");
- form.mailbox.focus();
- return false;
- }
-
- return true;
- }
-
- function onLogon()
- {
- if (!isOK(document.ftgate))
- return;
-
- document.ftgate.submit();
- }
- //-->
- </SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/cookies.js" TYPE="text/javascript"></SCRIPT>
- <SCRIPT LANGUAGE="JavaScript1.2" SRC="/utility/core.js" TYPE="text/javascript"></SCRIPT>
-
- <BODY BGCOLOR="white" onLoad="onLoad()" MARGINHEIGHT="0" MARGINWIDTH="0" onKeypress="keypress()">
-
- <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" HEIGHT="<%=bodyheight%>" CELLPADDING="0" CELLSPACING="0"><TR><TD> </TD><TD VALIGN="TOP">
-
- <FORM NAME="ftgate" METHOD="POST" onSubmit="return isOK(this)" ACTION="password.fts">
- <INPUT TYPE="HIDDEN" NAME="config" VALUE="1">
-
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0">
- <TR>
- <TD WIDTH="5" HEIGHT="18"> </TD>
- </TR>
- </TABLE>
- <!--- end of the tabs ----->
-
- <!--- start of the tab body --->
- <TABLE BORDER="0" BGCOLOR="<%=border%>" WIDTH="100%" CELLPADDING="0" CELLSPACING="0"><TR><TD>
- <TABLE <%=table%> CELLPADDING="0" CELLSPACING="0">
- <!----- start of block --->
- <TR>
- <TD VALIGN="TOP">
- <!----- sub table goes here --->
- <TABLE BORDER="0" WIDTH="100%">
- <TR>
- <TD>
- <TABLE BORDER="0">
- <TR>
- <TH COLSPAN="2"><%
- if (build()==FTGATE_PRO)
- output.write("You may need to enter the full email address for your mailbox, e.g. user@domain.com")
- else
- output.write(" ")
- %></TH>
- </TR>
- <TR>
- <TD>User name</TD>
- <TD COLSPAN="2"><INPUT TYPE="EDIT" NAME="mailbox" SIZE="<%=size40%>" VALUE="<%=session.webmail.user%>"></TD>
- </TR>
- <TR>
- <TD>Password</TD>
- <TD><INPUT TYPE="PASSWORD" NAME="password" SIZE="<%=size15%>"></TD>
- <TD ALIGN="RIGHT">
- <A HREF="javascript:onLogon()"
- onMouseDown="change('logonA', 'logon', 1)"
- onMouseOut="change('logonA', 'logon', 0)"><IMG SRC="<%=buttons%>logon.gif" NAME="logonA" BORDER="0" WIDTH="49" HEIGHT="20" ALT="Sign In"></A>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
- </TABLE>
- <!----- sub table ends here --->
- </TD>
- </TR>
- <!------ end of block ----->
- </TABLE>
- </TD></TR></TABLE>
-
- </FORM>
-
- </TD><TD WIDTH="10"> </TD></TD></TR></TABLE>
- </BODY>
- </HTML>
-