summaryrefslogtreecommitdiffstats
path: root/include/login.php
blob: c1a0e42029c6e1b5ffd2579524082a6a365c703d (plain)
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
<?php
/* make sure that we are not called from outside the scripts,
 * use a variable defined in config.php to check this
 */
if(!isset($HOST))
  exit;

/* check if login information is present */
if(!myisset('email','password'))
  {
    echo "can't log you in... missing login information.";
  }
else
  {
    $email     = $_REQUEST['email'];
    $password  = $_REQUEST['password'];

    /* verify password and email */
    if(strlen($password)!=32)
      $password = md5($password);

    $ok  = 1;
    $myid = DB_get_userid('email-password',$email,$password);
    if(!$myid)
      $ok = 0;

    if($ok)
      {
	/* user information is ok, set session variabel */
	$myname = DB_get_name('email',$email);
	$_SESSION['name'] = $myname;
	$_SESSION['id']   = $myid;
	$_SESSION['pass'] = $password;
      }
  }
?>