Esempio n. 1
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;
 }
Esempio n. 2
0
 $_SESSION['gender'] = ucwords($_POST['gender']);
 $_SESSION['dob'] = $_POST['dob'];
 $_SESSION['username'] = $_POST['username'];
 $_SESSION['password'] = $_POST['password'];
 $_SESSION['usertype'] = ucwords($_POST['usertype']);
 $date = date('M:d:Y');
 $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);