cekProfil($data))return true; else return false; } function regis(){//buat registrasi $u = new User(); $data = array( 'nama' => $_POST['name'], 'dob' => date("Y-m-d",strtotime($_POST['dob'])), 'telp' => $_POST['telp'], 'address' => $_POST['address'], 'hometown' => $_POST['hometown'], 'Fakultas' => $_POST['fakultas'], 'Jurusan' => $_POST['jurusan'], 'Angkatan' => $_POST['angkatan'], 'Kelas' => $_POST['kelas'], 'relationship' => $_POST['relati'], 'user' => $_SESSION['username'] ); if ($u->inputProfil($data)){ //echo ' insert bisa '; unset($_SESSION['notif-alert']); $idp = $u->getId(); if (!empty($_FILES['file']['name'])){ $foto = new Foto($_FILES); if($foto->insert($_SESSION['username'])){ $hasil = $foto->getHasil(); $photo = $hasil['lokasi']; //echo $photo; if($u->inputAvatar($photo,$idp))header('Location: home.php'); } else { $_SESSION['notif-alert'] = 'Foto yang anda Masukkan Salah'; if($u->delProfil($idp))header('Location: home.php'); }//jika foto salah delete data tadi dan kembali } else header('Location: home.php'); } else{ $_SESSION['notif-alert'] = 'Periksa kembali inputan'; header('Location: home.php'); } } function homeContent(){ $h = new Home(); $data['member'] = $h->getAllmember(); $data['post'] = $h->getAllpost(); $data['comm'] = $h->getAllcomm(); //$data['act'] = $h->getAllact(); $data['notiffriend'] = $h->getNotiffriend(); //buat database error unset($_SESSION['notif-warning']); //$_SESSION['notif-warning'] = $h->getSqlerr(); return $data; } function appFriend($id){ $u = new User(); if($u->aproveFriend($id)){ header('Location: home.php'); } } function rejFriend($id){ $u = new User(); if($u->rejectFriend($id)){ header('Location: home.php'); } } function search($key){ $u = new User(); $cari = $u->Search($key); echo '

'; echo 'User'; if (isset($cari['user']) && (mysql_num_rows($cari['user'])>0)){ while ($row = mysql_fetch_assoc($cari['user'])) { echo ''; echo ''; echo ''.$row['nama'].''; echo 'Class of '.$row['angkatan'].''; echo ''; } }else{ echo 'No Result'; } echo 'Community'; if (isset($cari['community']) && (mysql_num_rows($cari['community'])>0)){ while ($row = mysql_fetch_assoc($cari['community'])) { echo ''; echo ''; echo ''.$row['name'].''; echo ''.$row['type'].''; echo ''; } }else{ echo '---No Result---'; } echo '

'; } function cari(){ $u = new User(); $cari = $u->Cari(); $i = 0; $hasil= array(); while ($row = mysql_fetch_assoc($cari['user'])){ $hasil[$i]['key'] = $row['username']; $hasil[$i]['value'] = $row['nama']; $i++; } echo json_encode($hasil); } function logout(){//buat logout unset($_SESSION['username']); session_destroy(); header('Location: index.php'); } ?>