<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="connection.asp" -->
<%
'------------------------------------------------------------------------
'declaration of functions
'------------------------------------------------------------------------
'========================================================================
'declaration of variables
'========================================================================
'recordsets
Dim rstLogin
'------------------------------------------------------------------------
'------------------------------------------------------------------------
'Querystring and/or Form values
'------------------------------------------------------------------------
Dim strUsername
Dim strPassword
'------------------------------------------------------------------------
'Other local values
'------------------------------------------------------------------------
Dim strMessage 'for errormessages/feedback about login
Dim strGroupSet 'to set a session var with all groups
Dim bIsAdmin 'true if this is a JPRD Admin
Dim bIsSiteAdmin 'true if this is a Site Admin
'------------------------------------------------------------------------
'========================================================================
'copying form and querystring vars to local vars
'========================================================================
strUsername=Request.Form("UserName")
strPassword=Request.Form("Password")
if strUsername <> "" and strPassword<>"" then
'strip username/password from special codes
strUsername=Replace(strUsername,chr(34),"")
strUsername=Replace(strUsername,"'","")
strPassword=Replace(strPassword,chr(34),"")
strPassword=Replace(strPassword,"'","")
'we only bother to check for valid login if at least username & password are supplied!
set rstLogin = Server.CreateObject("ADODB.Recordset")
rstLogin.ActiveConnection = WDM_DB
rstLogin.Source = "SELECT U.UserID, U.CommonName, U.Inactive, G.GroupID FROM TBL_Users U, TBL_GroupMembers G WHERE U.UserID = G.UserID " & _
"AND U.Loginname='" & strUserName & "' AND U.Password='" & strPassword & "' ORDER BY G.GroupID"
rstLogin.CursorType = 3 'adOpenStatic
rstLogin.CursorLocation = 2 'adUseServer
rstLogin.LockType = 2
rstLogin.Open()
'if there is more than one hit then we are all set
if rstLogin.Recordcount = 0 then
strMessage = "Invalid Username or password combination"
else
'see if this account is inactive
if rstLogin("Inactive") = true then
strMessage = "Your account has been deactivated"
else
'let's stuff all the groupinfo for later
rstLogin.MoveFirst
Session("UserID")=rstLogin("UserID")
Session("CommonName")=rstLogin("CommonName")
strGroupSet=""
while not rstLogin.EOF
strGroupSet=strGroupSet & "," & rstLogin("GroupID")
if rstLogin("GroupID")=1 then bIsAdmin=true
if rstLogin("GroupID")=2 then bIsSiteAdmin=true
rstLogin.MoveNext
wend
strGroupSet=mid(strGroupSet ,2)
Session("Groups") = strGroupSet
Session("IsAdmin") = bIsAdmin
Session("IsSiteAdmin") = bIsSiteAdmin
'now we can continue to the main page
response.Redirect("main.asp")
Response.Write "Login OK"
end if
end if
rstLogin.Close
set rstLogin = nothing
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>JPRD WDM 2.0 - Web Database Module - Farma Research BV</title>
<link href="styles/default.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!--
-->
</script>
<style type="text/css">
<!--
.UNPWDStyle {font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
-->
</style>
</head>
<body>
<table id="tblHeader">
<tr>
<td width="40" height="20" nowrap><img src="images/head_up_gr.gif" width="20" height="20"></td>
<td width="333" rowspan="2" nowrap><img src="images/header.jpg" width="333" height="41"></td>
<td rowspan="2" align="center" nowrap><img src="images/wdmlogo.jpg" width="400" height="41"></td>
<td width="130" rowspan="2" nowrap><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="130" height="70">
<param name=movie value="images/logo.swf">
<param name=quality value=high>
<param name="BGCOLOR" value="#CCCCCC">
<embed src="images/logo.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="130" height="70" bgcolor="#CCCCCC"> </embed>
</object></td>
<td width="50" rowspan="2" nowrap> </td>
</tr>
<tr>
<td width="40" height="50" nowrap> </td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" id="tblMenuBar">
<tr>
<td nowrap class="LeftMenu"> </td>
<td nowrap class="RightMenu"> </td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0" id="tblMainArea">
<tr>
<td width="151" align="left" valign="top"><img src="images/LeftPane.jpg" width="151" height="209"></td>
<td rowspan="2">
<form name="frmLogin" method="post">
<!-- start of main area -->
<!-- space for login error msgs -->
<!-- end space for login error msgs -->
<table id="tblLogin">
<tr>
<td width="100" height="30"> </td>
<td width="75" height="30"> </td>
<td width="100" height="30"> </td>
<td height="30"> </td>
</tr>
<tr>
<td width="100" height="50"> </td>
<td width="75" height="50" class="UNPWDStyle"><span class="style8">Username</span></td>
<td width="100" height="50"><input type="text" name="UserName" size="15" value="<% =strUsername %>"></td>
<td height="50"> </td>
</tr>
<tr>
<td width="100" height="50"> </td>
<td width="75" height="50" class="UNPWDStyle"><span class="style8">Password</span></td>
<td width="100" height="50"><input type="password" name="Password" size="15"></td>
<td height="50"> </td>
</tr>
<tr>
<td height="70"> </td>
<td height="70" colspan="2" align="center" valign="top"><input type="submit" name="btnLogin" value="Login"></td>
<td height="70"> </td>
</tr>
</table>
<!-- end of main area -->
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>