logged_in bug fix
[squirrelmail.git] / src / webmail.php
1 <?
2 /**
3 ** webmail.php
4 **
5 ** This simply creates the frames.
6 **
7 **/
8
9 session_start();
10
11 if(!isset($username)) {
12 echo _("You need a valid user and password to access this page!");
13 exit;
14 }
15
16 # setcookie("username", $username, 0, "/");
17 # setcookie("key", $key, 0, "/");
18 # setcookie("logged_in", 1, 0, "/");
19
20 session_register("username");
21 session_register("key");
22 session_register("logged_in");
23 $logged_in = 1;
24
25 $PHPSESSID = session_id();
26
27 // Refresh the language cookie.
28 if (isset($squirrelmail_language)) {
29 session_register("squirrelmail_language");
30 # setcookie("squirrelmail_language", $squirrelmail_language, time()+2592000);
31 }
32 ?>
33 <HTML><HEAD>
34 <?
35 include ("../config/config.php");
36 include ("../functions/prefs.php");
37 include ("../functions/imap.php");
38
39 // verify that username and password are correct
40 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
41
42 include ("../src/load_prefs.php");
43
44 echo "<TITLE>";
45 echo "$org_title";
46 echo "</TITLE>";
47 echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
48
49 /**
50 There are three ways to call webmail.php
51 1. webmail.php
52 - this just loads the default entry screen.
53 2. webmail.php?right_frame=right_main.php&sort=X&startMessage=X&mailbox=XXXX
54 - This loads the frames starting at the given values.
55 3. webmail.php?right_frame=folders.php
56 - Loads the frames with the Folder options in the right frame.
57
58 This was done to create a pure HTML way of refreshing the folder list since
59 we would like to use as little Javascript as possible.
60 **/
61 if ($right_frame == "right_main.php") {
62 $urlMailbox = urlencode($mailbox);
63 echo "<FRAME SRC=\"left_main.php?PHPSESSID=$PHPSESSID\" NAME=\"left\">";
64 echo "<FRAME SRC=\"right_main.php?PHPSESSID=$PHPSESSID&mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage\" NAME=\"right\">";
65 } else if ($right_frame == "folders.php") {
66 $urlMailbox = urlencode($mailbox);
67 echo "<FRAME SRC=\"left_main.php?PHPSESSID=$PHPSESSID\" NAME=\"left\">";
68 echo "<FRAME SRC=\"folders.php?PHPSESSID=$PHPSESSID\" NAME=\"right\">";
69 } else {
70 echo "<FRAME SRC=\"left_main.php?PHPSESSID=$PHPSESSID\" NAME=\"left\">";
71 echo "<FRAME SRC=\"right_main.php?PHPSESSID=$PHPSESSID\" NAME=\"right\">";
72 }
73 ?>
74 </FRAMESET>
75 </HEAD></HTML>