LAYOUT: add names of players to end of score table for long sessions
[e-DoKo.git] / include / login.php
1 <?php
2 /* make sure that we are not called from outside the scripts,
3  * use a variable defined in config.php to check this
4  */
5 if(!isset($HOST))
6   exit;
7
8 /* check if login information is present */
9 if(!myisset('email','password'))
10   {
11     echo "can't log you in... missing login information.";
12   }
13 else
14   {
15     $email     = $_REQUEST['email'];
16     $password  = $_REQUEST['password'];
17
18     /* verify password and email */
19     if(strlen($password)!=32)
20       $password = md5($password);
21
22     $ok  = 1;
23     $myid = DB_get_userid('email-password',$email,$password);
24     if(!$myid)
25       $ok = 0;
26
27     if($ok)
28       {
29         /* user information is ok, set session variabel */
30         $myname = DB_get_name('email',$email);
31         $_SESSION['name'] = $myname;
32         $_SESSION['id']   = $myid;
33         $_SESSION['pass'] = $password;
34       }
35   }
36 ?>