Пример #1
0
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
require_once dirname(__FILE__) . '/common.php';
dgr_require('/includes/user.php');
dgr_startup();
$bad_login = false;
$errmsg = '';
if (isset($_GET['logout'])) {
    try {
        $user = new DGradeUser();
        $user->logout();
        $user = null;
    } catch (Exception $e) {
        /* do nothing */
    }
    dgr_redirect('index.php');
}
if (isset($_POST['dgrade_login'])) {
    try {
        $user = new DGradeUser($_POST['user'], $_POST['pass']);
    } catch (Exception $e) {
        $bad_login = true;
        $errmsg = $e->getMessage();
    }
    if (!$bad_login) {
        dgr_redirect('main.php');