forked from smuwanga/ViralLoad
/
tpl.home.prelogin.php
176 lines (173 loc) · 7.27 KB
/
tpl.home.prelogin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?
//security check
if(!$GLOBALS['vlDC']) {
die("<font face=arial size=2>Job 38:11</font>");
}
//should we send the password to an email?
if($remindEmail) {
resetPassword($remindEmail);
go("/sentreminder/$remindEmail/");
}
if($login && $email && $pass) {
//validate
$email=validate($email);
//authenticate
$u=0;
$u=mysqlquery("select * from vl_users where lower(email)='".strtolower($email)."'");
if(mysqlnumrows($u)) {
while($un=mysqlfetcharray($u)) {
if(strtolower($email)==strtolower($un["email"])) {
//email authentic
if(vlSimpleDecrypt($un["xp"])==hash("sha256",$pass)) {
//has this account been de-activated?
if(!$un["active"]) {
go("/login/in/");
} else {
//register session variables
$_SESSION["VLEMAIL"]=$email;
//log
mysqlquery("update vl_users set lastLogin='$datetime' where email='$_SESSION[VLEMAIL]'");
//redirect
go("/dashboard/welcome/");
}
} else {
go("/login/er/");
}
}
}
} else {
go("/login/er/");
}
}
?>
<p><img src="/images/spacer.gif" width="5" height="5"></p>
<table width="45%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#FFFFFF"><script language="JavaScript" type="text/javascript">
<!--
function check(login) {
if(!document.login.email.value) {
alert('Please provide your email address');
document.login.email.focus();
return false;
}
if(!document.login.pass.value) {
alert('Please provide your password');
document.login.pass.focus();
return false;
}
document.login.Submit.disabled=true;
return true;
}
function sendPassword(login) {
var theEmail=document.login.email.value;
if(!theEmail) {
alert('First insert your email address then click \'forgotten password?\'');
document.login.email.focus();
return false;
} else {
//process the send
document.location.href='/sendreminder/'+theEmail+'/';
}
return true;
}
//-->
</script>
<!--<form action="/dashboard/" method="post" name="login" id="login" onsubmit="return check(this)">-->
<form action="/dashboard/" method="post" name="login" id="login">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding:20px 20px 40px 20px"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding-bottom:20px; border-bottom: 1px solid #e1e8e1"><img src="/images/logo.prelogin.gif" alt="NMS Logo" border="0" /></td>
</tr>
<tr>
<td style="padding-top:10px"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<? if($fail) { ?>
<tr>
<td class="vl_error">Incorrect username or password!</td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="1" height="1" /></td>
</tr>
<? } else if($inactive) { ?>
<tr>
<td class="vl_error">Account Inactive! Kindly contact an Administrator.</td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="1" height="1" /></td>
</tr>
<? } else if($logout) { ?>
<tr>
<td class="vl_success">Logged out!</td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="1" height="1" /></td>
</tr>
<? } else if($sentTo) { ?>
<tr>
<td class="vl_success">New password sent to: <strong><?=$sentTo?></strong></td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="1" height="1" /></td>
</tr>
<? } else { ?>
<tr>
<td class="vl" style="padding:20px 0px 20px 0px">Login to Viral Load</td>
</tr>
<? } ?>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="vl">
<tr>
<td style="padding: 10px 0px 5px 0px">Email/Username</td>
</tr>
<tr>
<td><input name="email" type="text" id="email" size="35" class="search" /></td>
</tr>
<tr>
<td style="padding: 10px 0px 5px 0px">Password</td>
</tr>
<tr>
<td><input name="pass" type="password" id="pass" size="35" class="search" /></td>
</tr>
<tr>
<td style="padding:5px 0px 0px 0px"><a href="#" onclick="sendPassword(this)" class="vl_brown_link">Forgotten password?</a></td>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td bgcolor="#cccccc" style="padding:20px; border-top: 1px #b3b3b3 solid; background-image:url(/images/login.bg.prelogin.jpg); background-repeat: no-repeat; background-position: center right"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="vl">
<tr>
<td><input type="submit" name="Submit" value="login" class="button" />
<input name="redirect" type="hidden" id="redirect" value="<?=($redirect?$redirect:vlEncrypt($_SERVER['REQUEST_URI']))?>" />
<input name="login" type="hidden" id="login" value="1" />
</td>
</tr>
</table></td>
</tr>
</table>
</form>
</td>
<td background="/images/bg.right.gif"><img src="/images/spacer.gif" width="11" height="11"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="/images/bg.bottom.gif" width="100%"><img src="/images/spacer.gif" width="11" height="11"></td>
<td background="/images/bg.bottom.right.gif"><img src="/images/spacer.gif" width="11" height="11"></td>
</tr>
</table></td>
</tr>
</table>
<div style="padding:5px 0px 5px 0px" align="center" class="vls"><strong>Viral Load</strong></div>
<div style="padding:0px 0px 5px 0px" align="center" class="vl">Ministry of Health, The Republic of Uganda © Copyright <?=getCurrentYear()?></div>