Пример #1
0
<?php

$objForm = new Form();
$objValid = new Validation($objForm);
if ($objForm->isPost('name')) {
    $objValid->_expected = array('name', 'new', 'retype');
    $objValid->_required = array('name', 'new', 'retype');
    $new = $objForm->getPost('new');
    $retype = $objForm->getPost('retype');
    if ($new != '' && $retype != '' && $new != $retype) {
        $objValid->add2Errors('new_mismatch');
    }
    $id = $objForm->getPost('id');
    if ($objValid->isValid()) {
        $encoded = Login::hash($new);
        if ($objMember->updateMember(array('password' => $encoded), $id)) {
            $success = true;
        } else {
            $success = false;
        }
    }
}
require_once '_header.php';
?>
        <h1>Member :: Reset Pasword</h1>
        <?php 
if (!isset($success)) {
    ?>
            <form action="" method="post">
                <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert">
                    <tr>
Пример #2
0
    <?php 
if (Login::isLogged()) {
    Helper::redirect(Login::$_default);
}
$objForm = new Form();
$objValid = new Validation($objForm);
$objMember = new Member();
if ($objForm->isPost('login_email')) {
    $member = $objMember->getMembers(array('personal_email' => $objForm->getPost('login_email'), 'password' => Login::hash($objForm->getPost('login_password'))));
    if (!empty($member) && count($member) == 1) {
        //echo '<h1>VALID</h1>';
        Login::processLogin($member[0]['id'], '/sugarkms/' . $this->objURL->href($this->objURL->get(Login::$_referrer)), $objForm->getPost('remember'));
    } else {
        $objValid->add2Errors('login');
    }
}
require_once '_header.php';
?>
    <h1>Login</h1>
    <form action="" method="post">
        <table cellpadding="0" cellspacing="0" border="0" class="tbl_insert"> 
            <tr>
                <?php 
echo $objValid->validate('login');
?>
                <td><label for="login_email">Email:</label></td>
                <td><input type="text" name="login_email" id="login_email" class="fld" value="" /></td>
            </tr>
            <tr>
                <td><label for="login_password">Password:</label></td>
                <td><input type="password" name="login_password" id="login_password" class="fld" value="" /></td>
Пример #3
0
            $params['uni'] = $uni_id;
        } else {
            $new_uni = $objSchool->addUni(array('name' => trim($uni)));
            if (!empty($new_uni)) {
                $uni_id = $new_uni['id'];
                $params['uni'] = $uni_id;
            } else {
                $success = false;
            }
        }
        $uni_id = $objSchool->getSchoolByName($uni)['id'];
        $params['uni'] = $uni_id;
    }
    $entity = $objMember->generateURLentity($objForm->getPost('name'));
    $params['entity'] = $entity;
    $params['password'] = Login::hash($objMember->_default_password);
    $params['member'] = 1;
    if ($objValid->isValid()) {
        if (isset($success) && $success == false) {
        } else {
            $return = $objMember->addMember($params);
            if ($return['result']) {
                $new_id = $return['id'];
                $success = true;
            } else {
                $success = false;
            }
        }
    }
}
$header = 'Member :: Add';
Пример #4
0
 public function format($key, $value)
 {
     switch ($value) {
         case 'password':
             $this->_post[$key] = Login::hash($this->_post[$key]);
             break;
     }
 }