Example #1
0
session_start();
require "libraries/user.php";
if (isset($_POST['ok'])) {
    if ($_POST['txtuser'] == NULL) {
        echo "<div align='center' style='margin:10px 0px 5px 0px;'><font size='+1' color='#FF0033'>Chưa gõ tên đăng nhập</font></div><br />";
    } else {
        $u = $_POST['txtuser'];
    }
    if ($_POST['txtpass'] == NULL) {
        echo "<div align='center' style='margin:10px 0px 5px 0px;'><font size='+1' color='#FF0033'>Chưa nhập mật khẩu</font></div>";
    } else {
        $p = $_POST['txtpass'];
    }
    if ($u && $p) {
        $login = new User();
        $login->set_user($u);
        $login->set_pass($p);
        $data1 = $login->check_login();
        if ($login->check_login() == FALSE) {
            echo "<div align='center' style='margin:10px;'><font size='+1' color='#FF0033'>Sai tên đăng nhập hoặc mật khẩu</font></div>";
        } else {
            foreach ($data1 as $user1) {
                $_SESSION['username'] = $user1[Username];
                $_SESSION['hoten'] = $user1[HoTen];
                $_SESSION['dienthoai'] = $user1[DienThoai];
                $_SESSION['diachi'] = $user1[DiaChi];
                $_SESSION['level'] = $user1[Level];
            }
            if ($_GET['co'] == 2) {
                header("location:index.php?module=giohang&act=xem");
            } else {
Example #2
0
<?php

require_once '../../../libraries/oop.php';
require_once '../../../libraries/user.php';
$a = new User();
$user = $_GET['id'];
$a->set_user($user);
$a->delete_user();
echo '12';
?>
   
Example #3
0
<?php

$ten = $_GET['ten'];
$lv = $_GET['lv'];
require_once '../../../libraries/oop.php';
require_once '../../../libraries/user.php';
require_once '../../../libraries/function.php';
$a = new User();
$a->set_user($ten);
$a->set_level($lv);
$a->set_pass('123456');
$a->set_ngaydangky(date("Y-m-d", time()));
$a->set_ngaysinh(date("Y-m-d", time()));
if ($a->get_user() != "") {
    if ($a->insert_user_admin()) {
        echo "11";
    } else {
        echo "0";
    }
} else {
    echo "0";
}
Example #4
0
$pass = $data[Password];
$namsinh = substr($ngay, 0, 4);
$thangsinh = substr($ngay, 5, 2);
$ngaysinh = substr($ngay, 8, 2);
if ($data[GioiTinh] == 1) {
    $gioitinh = 'Nam';
} else {
    if ($data[GioiTinh] == 2) {
        $gioitinh = 'Nữ';
    } else {
        $gioitinh = 'Không Biết';
    }
}
if (isset($_POST['ok'])) {
    $u = new User();
    $u->set_user($username);
    $flag = TRUE;
    if ($_POST['txtpass'] != "") {
        if ($_POST['txtpass'] == $pass) {
            if ($_POST['txtpass1'] == $_POST['txtpass2']) {
                $u->set_pass($_POST['txtpass1']);
            } else {
                $flag = FALSE;
                echo "Mật khẩu mới không giống nhau.";
            }
        } else {
            echo "Mật khẩu không đúng.";
            $flag = FALSE;
        }
    }
    if ($flag == TRUE) {
Example #5
0
        if (!$this->valid) {
            return false;
        }
        if ($this->is_root() && $force != 1) {
            $db->query("insert into usertag set username='******'username']) . "', pid='{$pid}', catid='{$tagid}'");
        }
        $db->query("select pcid from problem_category where pid='{$pid}' and catid='{$tagid}'");
        if ($db->num_rows == 0) {
            $db->query("insert into problem_category set pid='{$pid}', catid='{$tagid}', weight='{$weight}'");
        } else {
            $db->query("update problem_category set weight=weight+{$weight} where pid='{$pid}' and catid='{$tagid}'");
        }
    }
}
$current_user = new User();
$current_user->set_user($nowuser, $nowpass);
function user_create($infos)
{
    global $db, $EZSQL_ERROR;
    $now = time();
    $today = date("Y-m-d G:i:s", $now);
    $infos[1] = hash_password($infos[1]);
    $infos[2] = htmlspecialchars($infos[2]);
    $infos[3] = htmlspecialchars($infos[3]);
    $infos[4] = htmlspecialchars($infos[4]);
    $sql = $db->query("insert into user (username,password,nickname,school,email,register_time) values ('{$infos['0']}','{$infos['1']}','{$infos['2']}','{$infos['3']}','{$infos['4']}','{$today}')");
    if ($EZSQL_ERROR) {
        return false;
    } else {
        return true;
    }
Example #6
0
    } else {
        $u = $_POST['txtuser'];
    }
    if ($_POST['txtpass'] == NULL) {
        $loi[] = ERROR_EMPTY_PASS;
    } else {
        if ($_POST['txtpass'] != $_POST['txtpass2']) {
            $loi[] = ERROR_NOTMATCHES;
        } else {
            $p = $_POST['txtpass'];
        }
    }
    $l = $_POST['level'];
    if ($u && $p && $l) {
        $a = new User();
        $a->set_user($u);
        $a->set_pass($p);
        $a->set_level($l);
        if ($a->insert_user() == FALSE) {
            $loi[] = "Sorry, Your username has been register, please try again";
        } else {
            ob_end_clean();
            header("location:index.php?module=user&act=list");
            exit;
        }
    }
}
?>
<form action="index.php?module=user&act=add" method="post">
<fieldset>
<legend>Add A User</legend>
Example #7
0
         $dt = $_POST['txtdt'];
     } else {
         $loi[] = "Số điện thoại không hợp lê <br />";
     }
 }
 if ($loi != "") {
     echo "<ul>";
     foreach ($loi as $err) {
         echo "<li>{$err}</li>";
     }
     echo "</ul>";
 } else {
     if ($u && $p && $e && $ht && $dc && $dt) {
         $lv = 1;
         $dk = new User();
         $dk->set_user($u);
         $dk->set_pass($p);
         $dk->set_email($e);
         $dk->set_hoten($ht);
         $dk->set_diachi($dc);
         $dk->set_dienthoai($dt);
         $dk->set_level($lv);
         $ngaydk = date("d");
         $thangdk = date("m");
         $namdk = date("Y");
         $ngaydk = "{$namdk}-{$thangdk}-{$ngaydk}";
         $ngaysinh = "{$namsinh}-{$thangsinh}-{$ngaysinh}";
         $dk->set_ngaydangky($ngaydk);
         $dk->set_ngaysinh($ngaysinh);
         if ($dk->check_user() == FALSE) {
             echo "<div align='center' style='margin:10px;'><font size='+1' color='#FF0033'>Tên này đã có người dùng</font></div>";