コード例 #1
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['itemid']), 'Item belum dipilih!')->check();
$dbo = new Todo_Item();
return $dbo->retrieve($_REQUEST);
コード例 #2
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['description']), 'Deskripsi harus diisi!')->check();
$dbo = new Todo_Item();
return $dbo->insert($_REQUEST);
コード例 #3
0
<?php

defined('ALT_PATH') or die('No direct access allowed.');
Alt_Validation::instance()->rule(Alt_Validation::not_empty($_REQUEST['itemid']), 'Item belum dipilih!')->rule(Alt_Validation::not_empty($_REQUEST['description']), 'Deskripsi harus diisi!')->check();
$dbo = new Todo_Item();
return $dbo->update($_REQUEST);
コード例 #4
0
        return System_Auth::get_token();
    }
    // logout
    $dbo = new System_Session();
    $res = $dbo->delete(array('where' => 'userid = ' . $dbo->quote($userdata['userid']) . ' and token like ' . $dbo->quote(System_Auth::get_token())));
    System_Auth::clear_token();
}
// user not logged in but token is exist, try to force logout
if (!System_Auth::islogin() && System_Auth::get_token() != '') {
    try {
        include 'logout.php';
    } catch (Exception $e) {
    }
}
// validate username and password
Alt_Validation::instance()->rule(Alt_Validation::not_empty($username), 'Username harus diisi!')->rule(Alt_Validation::not_empty($password), 'Password harus diisi!')->check();
// check is exist within database
$user = new System_User();
$res = $user->get(array('where' => 'username = '******'User tidak ditemukan!');
}
// set userdata
$userdata = $res[0];
// checking if password correct
if (md5($password) != $userdata['password']) {
    throw new Alt_Exception('Password tidak cocok!');
}
unset($userdata['password']);
$token = System_Auth::generate_token($userdata);
コード例 #5
0
 /**
  * Validate the domain of an email address by checking if the domain has a
  * valid MX record.
  *
  * @link  http://php.net/checkdnsrr  not added to Windows until PHP 5.3.0
  *
  * @param   string  $email  email address
  * @return  boolean
  */
 public static function email_domain($email)
 {
     if (!Alt_Validation::not_empty($email)) {
         return FALSE;
     }
     // Empty fields cause issues with checkdnsrr()
     // Check if the email domain has a valid MX record
     return (bool) checkdnsrr(preg_replace('/^[^@]++@/', '', $email), 'MX');
 }