示例#1
0
 public function get_Users($room_id)
 {
     $pdo = Database::getDB();
     $stmt = $pdo->prepare("SELECT * FROM brain_joinroom WHERE room_num = ?");
     $stmt->execute(array($room_id));
     $result = $stmt->fetchAll();
     $brain_joinUsers = array();
     foreach ($result as $j) {
         $stmt = $pdo->prepare("SELECT * FROM register WHERE user_id = ?");
         $stmt->execute(array($j['user_id']));
         $brain_User = new brain_User();
         $row = $stmt->fetch();
         $brain_User->setAcc_path($row['user_path']);
         $brain_User->setFname($row['fname']);
         $brain_joinUsers[] = $brain_User;
     }
     return $brain_joinUsers;
 }
示例#2
0
 public function getProfile($user_id)
 {
     $pdo = Database::getDB();
     $stmt = $pdo->prepare("SELECT * FROM register WHERE user_id = ?");
     $stmt->execute(array($user_id));
     $row = $stmt->fetchAll();
     $brain_profile = array();
     foreach ($row as $b) {
         $brain_prof = new brain_User();
         $brain_prof->setUser_id($b['user_id']);
         $brain_prof->setAcc_path($b['user_path']);
         $brain_prof->setLname($b['lname']);
         $brain_prof->setFname($b['fname']);
         $brain_prof->setMname($b['middlename']);
         $brain_prof->setAddress($b['address']);
         $brain_prof->setContact($b['contact']);
         $brain_prof->setAge($b['age']);
         $brain_prof->setGender($b['gender']);
         $brain_prof->setUsertype($b['usertype']);
         $brain_prof->setDob($b['bday']);
         $brain_prof->setUsername($b['username']);
         $brain_prof->setDate($b['date_reg']);
         $brain_profile[] = $brain_prof;
     }
     return $brain_profile;
 }
示例#3
0
    $brain_User->setUser_id($_SESSION['user_id']);
    $brain_User->setLname($_SESSION['lname']);
    $brain_User->setFname($_SESSION['fname']);
    $brain_User->setMname($_SESSION['mname']);
    $brain_User->setAddress($_SESSION['address']);
    $brain_User->setContact($_SESSION['contact']);
    $brain_User->setAge($_SESSION['age']);
    $brain_User->setGender($_SESSION['gender']);
    $brain_User->setDob($_SESSION['dob']);
    $brain_User->setUsername($_SESSION['username']);
    $brain_User->setPassword($_SESSION['password']);
    $brain_User->setUsertype($_SESSION['usertype']);
    $brain_User->setDate($date);
    $brain_User->setAcc_name($acc_name = $_FILES['acc_name']['name']);
    $brain_User->setAcc_type($acc_type = $_FILES['acc_name']['type']);
    $brain_User->setAcc_path($acc_path = "./user/" . $acc_name);
    move_uploaded_file($_FILES['acc_name']['tmp_name'], $acc_path);
    $duplicate_user = $brain_UserDB->verify_user($brain_User);
    if ($duplicate_user) {
        $error = "duplicate";
        unset($brain_User);
        header("location:.?&error=" . urlencode($error));
    } else {
        $brain_UserDB->brain_addDB($brain_User);
        unset($brain_User);
        $error = "Success";
        header("location:.?&error=" . urlencode($error));
    }
}
if ($action == 'brain_login') {
    $_SESSION['user'] = $_POST['user'];