JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
starting to work
[contractor-progress.git] / login.php
1 <?php
2
3 function login_get_fields() {
4         $username = format_oneline($_REQUEST['username']);
5         tem_set('username', $username);
6         
7         $password = format_oneline($_REQUEST['password']);
8         
9         $url = format_unix($_REQUEST['url']);
10         tem_set('url', $url);
11         
12         return array($username, $password, $url);
13 }
14
15 function login_main() {
16         if(isset($GLOBALS['url'])) {
17                 $_REQUEST['url'] = $GLOBALS['url'];
18                 tem_set('url', $GLOBALS['url']);
19         }
20
21         if(isset($_REQUEST['username'])) {
22                 list($username, $password, $url) = login_get_fields();
23
24                 if($username == 'test' && $password == 'test') {
25                         message("Logged in successfully.");
26                         session_new();
27                         session_set('auth_username', "admin:$id");
28                         if($url) {
29                                 return $url;
30                         } else {
31                                 return './';
32                         }
33                 }
34
35                 tem_sub('failed');
36         }
37         tem_sub('main_body');
38 }
39
40 ?>