Example #1
0
File: User.php Project: etienne/jam
 function Connect()
 {
     global $_JAM;
     // Check whether user has submitted the login form
     if ($_POST['connect']) {
         // Validate login
         $where = array("login = '******'login'] . "'", "password = '******'password'] . "'");
         if ($userInfo = Query::SingleRow('users', $where)) {
             // Login succeeded; create cookie and reload this page
             $this->Login($userInfo['id']);
             HTTP::ReloadCurrentURL();
             return true;
         } else {
             print e('p', array('class' => 'error'), $_JAM->strings['admin']['incorrectLogin']);
         }
     }
     // Display form if login was incorrect or user has not yet submitted the form
     $form = new Form();
     $form->Open();
     print $form->Field('login', 40, $_JAM->strings['admin']['login']);
     print $form->Password('password', 40, $_JAM->strings['admin']['password']);
     print $form->Submit('connect', $_JAM->strings['admin']['connect']);
     $form->Close();
 }