File: login.php3

package info (click to toggle)
basilix 1.0.3b-1.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 828 kB
  • ctags: 206
  • sloc: php: 2,681; sql: 45; makefile: 40; sh: 7
file content (83 lines) | stat: -rw-r--r-- 2,149 bytes parent folder | download
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
<?php
/*
+-------------------------------------------------------------------+
| BasiliX - Copyright (C) 2000 Murat Arslan <arslanm@cyberdude.com> |
+-------------------------------------------------------------------+
*/

// Login procedure
// ------------------------------------------------------------------

$username = decode_strip($username);
$password = decode_strip($password);

// some checks
if(!$username && !$password) {
   $LOGIN_ERR = $lng->p(58);
   $BODY_ONLOAD = "onLoad='document.loginForm.username.focus();'";
   $err=1;
   $domain--;
} else if(!$username) { // if the username is empty
   $LOGIN_ERR = $lng->p(59);
   $BODY_ONLOAD = "onLoad='document.loginForm.username.focus();'";
   $err=1; 
   $domain--;
} else if($domain == "0") { // no domain selected
   $LOGIN_ERR = $lng->p(59);
   $BODY_ONLOAD = "onLoad='document.loginForm.domain.focus();'";
   $err=1;
   $domain--;
} else if(!$password) { // if the password is empty
   $LOGIN_ERR = $lng->p(60);
   $BODY_ONLOAD = "onLoad='document.loginForm.password.focus();'";
   $err=1;
   $domain--;
}

if($err) {
   if($relogin) {
      $BODY_ONLOAD = "onLoad='document.loginForm.password.focus();'";
      $incfile = "login-relogin.htx";
   } else {
      $incfile = "login-new.htx";
   }
   include("$BSX_HTXDIR/header.htx");
   include("$BSX_HTXDIR/$incfile");
   include("$BSX_HTXDIR/footer.htx");
}
// --

// ok let's connect
// ---
$domain--;
require("$BSX_LIBDIR/imap2.inc");
// ---

// go create/update a/the session for the user
$sql = new MySQL;
$sql->open();
$last_values = session_create($username, $domain, $password);
$last_host = $last_values["LastHost"];
$last_addr = $last_values["LastAddr"];
$last_time = $last_values["LastTime"];
$push_lastinfo = true;

// create and or cleanup attachment directory
$atch_dir = $BSX_ATTACH_DIR . "/" .  "$IMAP_DOMAIN" . "/" . "$username";
if(is_dir($atch_dir)) {
    if(!empty($atch_dir)) {
	$clncmd="/bin/rm -f $atch_dir/*";
	@exec($clncmd);
    }
} else {
    $mkdcmd="/bin/mkdir -p $atch_dir";
    @exec($mkdcmd);
}

// --
require("$BSX_LIBDIR/mbox.inc");
$mbox = "Inbox";
lang_load("mboxlst");
push_mboxlist();
// --
?>