diff --git a/.buildpath b/.buildpath
new file mode 100644
index 0000000..8bcb4b5
--- /dev/null
+++ b/.buildpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..d233bd3
--- /dev/null
+++ b/.project
@@ -0,0 +1,22 @@
+
+
+ UC3-Team-Project
+
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.eclipse.php.core.PHPNature
+
+
diff --git a/.settings/org.eclipse.wst.validation.prefs b/.settings/org.eclipse.wst.validation.prefs
new file mode 100644
index 0000000..39a5ef6
--- /dev/null
+++ b/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06vendor
+eclipse.preferences.version=1
diff --git a/core/classes/UserManager.php b/core/classes/UserManager.php
index 4e97886..be7b1cd 100644
--- a/core/classes/UserManager.php
+++ b/core/classes/UserManager.php
@@ -23,6 +23,14 @@ public static function getUserFromId($uid) {
return $stmt->fetch(PDO::FETCH_OBJ);
}
+ public static function image_retrieve($uid) {
+ $pdo = Dbh::getInstance()->dbh;
+ $stmt = $pdo->prepare('SELECT * FROM users WHERE user_id = ? LIMIT 1');
+ $stmt->execute(array($uid));
+ $obj = $stmt->fetch(PDO::FETCH_OBJ);
+ return $obj->profile_image;
+ }
+
/**
* @param $email string email of logging in user
* @param $password string password of logging in user
@@ -86,8 +94,8 @@ public function register($email, $name, $password) {
}
public function uploadPic($file, $user_id) {
-
- $stmt = $this->pdo->prepare('UPDATE users SET profile_image =:file WHERE user_id=:user');
+ $pdo = Dbh::getInstance()->dbh;
+ $stmt = $pdo->prepare('UPDATE users SET profile_image =:file WHERE user_id=:user');
$stmt->bindParam(':file', $file);
$stmt->bindParam(':user', $user_id);
try {
@@ -97,6 +105,27 @@ public function uploadPic($file, $user_id) {
}
}
+
+ public static function updateUserInfo($screenname, $username, $bio,
+ $website, $email, $country, $user_id) {
+ $pdo = Dbh::getInstance()->dbh;
+ $stmt = $pdo->prepare('UPDATE users SET screen_name =:screenname,
+ username = :username, bio = :bio, website = :website,
+ email = :email, country = :country WHERE user_id=:user');
+ $stmt->bindParam(':screenname', $screenname);
+ $stmt->bindParam(':username', $username);
+ $stmt->bindParam(':bio', $bio);
+ $stmt->bindParam(':website', $website);
+ $stmt->bindParam(':email', $email);
+ $stmt->bindParam(':country', $country);
+ $stmt->bindParam(':user', $user_id);
+
+ try {
+ $stmt->execute();
+ } catch (PDOException $e) {
+ echo "Error: " . $e->getMessage();
+ }
+ }
}
diff --git a/profile.php b/profile.php
index 57f9900..37a5a61 100644
--- a/profile.php
+++ b/profile.php
@@ -11,7 +11,7 @@
if (isset($_POST['image_submit'])) {
$image = file_get_contents(addslashes($_FILES['image']['tmp_name']));
$file = base64_encode($image);
- $getUserManager->uploadPic($file, $user_data->user_id);
+ UserManager::uploadPic($file, $user_data->user_id);
}
}
@@ -33,6 +33,17 @@ function requestFollow(idol_id, fan_id) {
idol_id: idol_id, fan_id: fan_id
});
}
+
+ function edit(element) {
+ var parent=$(element).parent().parent();
+ var placeholder=$(parent).find('.text-info').text();
+ //hide label
+ $(parent).find('label').hide();
+ //show input, set placeholder
+ var input=$(parent).find('input[type="text"]');
+ $(input).show();
+ $(input).attr('placeholder', placeholder);
+ }
@@ -83,11 +94,15 @@ class="glyphicon glyphicon-user"> My Account
-
username; ?>
-
-
+
+
+
+
+ Edit
+
+
bio; ?>
diff --git a/profileEdit.php b/profileEdit.php
index 3d182b8..a49693c 100644
--- a/profileEdit.php
+++ b/profileEdit.php
@@ -1,5 +1,5 @@
uploadPic($file,$user_id);
+ UserManager::uploadPic($file,$user_id);
+}
+
+if(isset($_POST["confirm"]))
+{
+ $user_id = $_SESSION['user_id'];
+ $screenname = $_REQUEST["screen_name"];
+ $username = $_REQUEST["username"];
+ $bio = $_REQUEST["bio"];
+ $website = $_REQUEST["website"];
+ $email = $_REQUEST["email"];
+ $country = $_REQUEST["country"];
+ UserManager::updateUserInfo($screenname, $username, $bio,
+ $website, $email, $country, $user_id);
}
?>
@@ -74,8 +87,8 @@ class="glyphicon glyphicon-user"> My Account
image_retrieve($user_id);
- echo'
';
+ $userimage=UserManager::image_retrieve($user_id);
+ echo'
';
?>