~lss-team/lilsoftstats/trunk

« back to all changes in this revision

Viewing changes to login.php

  • Committer: Nick
  • Date: 2011-11-14 04:10:28 UTC
  • Revision ID: nick@little-apps.org-20111114041028-cvmpwq6z6hx3pkya
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
require_once('inc/main.php');
 
3
require_once("inc/securimage.php");
 
4
 
 
5
//global $sLogin;
 
6
 
 
7
$sError = "";
 
8
 
 
9
if (isset($_POST['submitBtn']) || isset($_POST['resetBtn'])) {
 
10
        // Check captcha
 
11
        $sImg = new Securimage();
 
12
        $bValid = $sImg->check($_POST['captcha']);
 
13
}
 
14
 
 
15
if (isset($_POST['submitBtn'])) {
 
16
        if (!isset($_POST['username']) || !isset($_POST['password']))
 
17
                        return;
 
18
                
 
19
        $sUsername = isset($_POST['username']) ? $_POST['username'] : '';
 
20
        $sPassword = isset($_POST['password']) ? $_POST['password'] : '';
 
21
 
 
22
        if (!$bValid) {
 
23
                $sError = "The CAPTCHA wasn't entered correctly. Go back and try it again.";
 
24
        } else {
 
25
                $sError = $sLogin->LoginUser($sUsername, $sPassword);
 
26
                
 
27
                if (empty($sError))
 
28
                        header(sprintf("Location: %s", SITE_URL));
 
29
        }
 
30
} else if (isset($_POST['resetBtn'])) {
 
31
                if (!$bValid)
 
32
                        $sError = "The CAPTCHA wasn't entered correctly. Go back and try it again.";
 
33
                else
 
34
                        $sError = $sLogin->ForgotPassword($_POST['email']);
 
35
} else if (isset($_POST['changeBtn'])) {
 
36
        $sError = $sLogin->ChangePassword($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['key']);
 
37
        
 
38
        if (empty($sError))
 
39
                header(sprintf("Location: %s/login.php", SITE_URL));
 
40
}
 
41
?>
 
42
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
43
<html xmlns="http://www.w3.org/1999/xhtml">
 
44
<head>
 
45
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
46
<title>Little Software Stats | Login</title>
 
47
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
 
48
<!-- favicon -->
 
49
<link type="image/x-icon" href="images/shared/favicon.ico" rel="icon" />
 
50
<link type="image/x-icon" href="images/shared/favicon.ico" rel="shortcut icon" />
 
51
<!--  jquery core -->
 
52
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
 
53
 
 
54
<!-- Custom jquery scripts -->
 
55
<script src="js/jquery/custom_jquery.js" type="text/javascript"></script>
 
56
 
 
57
<!-- MUST BE THE LAST SCRIPT IN <HEAD></HEAD></HEAD> png fix -->
 
58
<script src="js/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
 
59
<script type="text/javascript">
 
60
$(document).ready(function(){ $(document).pngFix( ); });
 
61
</script>
 
62
</head>
 
63
<body id="login-bg"> 
 
64
 
 
65
<!-- Start: login-holder -->
 
66
<div id="login-holder">
 
67
 
 
68
        <!-- start logo -->
 
69
        <div id="logo-login">
 
70
                <a href="index.php"><img src="images/shared/logo.png" width="261" height="40" alt="Little Software Stats" /></a>
 
71
        </div>
 
72
        <!-- end logo -->
 
73
        
 
74
        <div class="clear"></div>
 
75
        
 
76
        <!--  start loginbox ................................................................................. -->
 
77
        <div id="loginbox">
 
78
        <!--  start message -->
 
79
        <?php if (!empty($sError)) { ?>
 
80
                <div id="message-red" align="center">
 
81
                        <table border="0" width="90%" cellpadding="0" cellspacing="0">
 
82
                        <tr>
 
83
                                <td class="red-left"><?php echo $sError; ?></td>
 
84
                                <td class="red-right"><a class="close-red"><img src="images/table/icon_close_red.png"   alt="" /></a></td>
 
85
                        </tr>
 
86
                        </table>
 
87
                </div>
 
88
        <?php } else if (empty($sError) && isset($_POST['resetBtn'])) { ?>
 
89
        <div id="message-green" align="center">
 
90
                <table border="0" width="90%" cellpadding="0" cellspacing="0">
 
91
                        <tr>
 
92
                                <td class="green-left">Please check your inbox for further instructions on how to reset your password.</td>
 
93
                                <td class="green-right"><a class="close-red"><img src="images/table/icon_close_green.png"   alt="" /></a></td>
 
94
                        </tr>
 
95
                </table>
 
96
        </div>
 
97
        <?php } ?>
 
98
        <!--  end message -->
 
99
                <!--  start login-inner -->
 
100
<?php if ($_REQUEST['action'] == "resetPwd") { ?>               
 
101
                <div id="login-inner">
 
102
                        <form action="#" method="post">
 
103
                                <table border="0" cellpadding="0" cellspacing="0">
 
104
                                        <tr>
 
105
                                                <th>Username</th>
 
106
                                                <td><input name="username" type="text" class="login-inp" value="<?php echo $_REQUEST['login']; ?>" /></td>
 
107
                                        </tr>
 
108
                                        <tr>
 
109
                                                <th>Password</th>
 
110
                                                <td><input name="password" type="password" class="login-inp" /></td>
 
111
                                        </tr>
 
112
                                        <tr>
 
113
                                                <th>Password (again)</th>
 
114
                                                <td><input name="password2" type="password" class="login-inp" /></td>
 
115
                                        </tr>
 
116
                                        <tr>
 
117
                                                <th>Activation key</th>
 
118
                                                <td><input name="key" type="text" class="login-inp" value="<?php echo $_REQUEST['key']; ?>" /></td>
 
119
                                        </tr>
 
120
                                        <tr>
 
121
                                                <th></th>
 
122
                                                <td><input name="changeBtn" type="submit" class="submit-login"  /></td>
 
123
                                        </tr>
 
124
                                </table>
 
125
                        </form>
 
126
                </div>
 
127
<?php } else { ?>
 
128
                <div id="login-inner">
 
129
                        <form action="#" method="post">
 
130
                                <table border="0" cellpadding="0" cellspacing="0">
 
131
                                        <tr>
 
132
                                                <th>Username</th>
 
133
                                                <td><input name="username" type="text" class="login-inp" /></td>
 
134
                                        </tr>
 
135
                                        <tr>
 
136
                                                <th>Password</th>
 
137
                                                <td><input name="password" type="password" class="login-inp" /></td>
 
138
                                        </tr>
 
139
                                        <tr>
 
140
                                                <td colspan="2" align="center"><a href="#" onclick="$('#siimage').attr('src', 'inc/captcha.php?sid=' + Math.random()); return false"><img src="inc/captcha.php" alt="CAPTCHA" id="siimage" width="300" height="80" /></a></td>
 
141
                                        </tr>
 
142
                                        <tr>
 
143
                                                <th>Security<br />code</th>
 
144
                                                <td><input name="captcha" type="text" class="login-inp" /></td>
 
145
                                        </tr>
 
146
                                        <tr>
 
147
                                                <th></th>
 
148
                                                <td><input name="submitBtn" type="submit" class="submit-login"  /></td>
 
149
                                        </tr>
 
150
                                </table>
 
151
                        </form>
 
152
                </div>
 
153
                <div class="clear"></div>
 
154
                <a href="" class="forgot-pwd">Forgot Password?</a>
 
155
<?php } ?>
 
156
                <!--  end login-inner -->
 
157
        </div>
 
158
 <!--  end loginbox -->
 
159
 
 
160
        <!--  start forgotbox ................................................................................... -->
 
161
        <div id="forgotbox">
 
162
                <div id="forgotbox-text">Please send us your email and we'll reset your password.</div>
 
163
                <!--  start forgot-inner -->
 
164
                <div id="forgot-inner">
 
165
                        <form action="#" method="post">
 
166
                                <table border="0" cellpadding="0" cellspacing="0">
 
167
                                        <tr>
 
168
                                                <th>Email address:</th>
 
169
                                                <td><input name="email" type="text" class="login-inp" /></td>
 
170
                                        </tr>
 
171
                                        <tr>
 
172
                                                <td colspan="2" align="center"><a href="#" onclick="$('#siimage').attr('src', 'inc/captcha.php?sid=' + Math.random()); return false"><img src="inc/captcha.php" alt="CAPTCHA" id="siimage" width="300" height="80" /></a></td>
 
173
                                        </tr>
 
174
                                        <tr>
 
175
                                                <th>Security<br />code</th>
 
176
                                                <td><input name="captcha" type="text" class="login-inp" /></td>
 
177
                                        </tr>
 
178
                                        <tr>
 
179
                                                <th> </th>
 
180
                                                <td><input name="resetBtn" type="submit" class="submit-login"  /></td>
 
181
                                        </tr>
 
182
                                </table>
 
183
                        </form>
 
184
                </div>
 
185
                <!--  end forgot-inner -->
 
186
                <div class="clear"></div>
 
187
                <a href="" class="back-login">Back to login</a>
 
188
        </div>
 
189
        <!--  end forgotbox -->
 
190
 
 
191
</div>
 
192
<!-- End: login-holder -->
 
193
</body>
 
194
</html>
 
 
b'\\ No newline at end of file'