fixed update profile, failed on unchanged data

This commit is contained in:
Jackk Goh
2018-03-27 11:46:37 +08:00
parent 770213499f
commit c14bb2b613
4 changed files with 64 additions and 5 deletions
@@ -37,7 +37,14 @@ var Script = function () {
$("#waiting").hide();
$("#suksesupdate").show();
//$("#gagalupdate").hide();
}else{
}
else if(e.status === 304){
$("#submitprofile").show();
$("#waiting").hide();
$("#update-unchanged").show();
//$("#gagalupdate").hide();
}
else{
$("#submitprofile").show();
$("#waiting").hide();
//$("#suksesupdate").show();
+43
View File
@@ -0,0 +1,43 @@
Time : 18:02:06
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 18:02:05
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:57:23
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:57:17
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:56:52
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:53:06
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:52:08
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'izyim.users' doesn't exist
Raw SQL : SELECT * FROM users WHERE username= :username
Time : 17:51:30
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'izyim.users' doesn't exist
Raw SQL : SELECT * FROM users WHERE username= :username
Time : 17:51:20
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:51:00
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:50:53
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:49:08
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:49:08
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
Time : 17:48:56
SQLSTATE[28000] [1045] Access denied for user 'izyim'@'localhost' (using password: YES)
+3
View File
@@ -78,6 +78,9 @@
<div id='suksesupdate' class="alert alert-success alert-block fade in" style='display:none;'>
<strong><i class="icon-ok-sign"></i>Success! </strong>Yehaa.. Your profile has been updated
</div>
<div id='update-unchanged' class="alert alert-success alert-block fade in" style='display:none;'>
<strong><i class="icon-ok-sign"></i>Unchanged! </strong>Nothing changes.
</div>
<div id='gagalupdate' class="alert alert-danger alert-block fade in" style='display:none;'>
<strong><i class="icon-ok-sign"></i>Whoops! </strong>Your profile cant be updated, please try again later ( Make sure you make any changes to your profile when update )
</div>
+10 -4
View File
@@ -30,7 +30,7 @@ function chpwd_js() {
function editprofile_js() {
?>
<script src="/assets/global/plugins/jquery-validation/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="/assets/modul-js/common/profile/editprofile.min.js" type="text/javascript"></script>
<script src="/assets/modul-js/common/profile/editprofile.js" type="text/javascript"></script>
<?php }
@@ -64,6 +64,7 @@ function the_profile() {
$email = $request->get('email');
$website = $request->get('website');
$position = $request->get('position');
$user_id = $_SESSION["user_id"];
// Bind the data
$db->bind("first_name", $first_name);
$db->bind("last_name", $last_name);
@@ -71,13 +72,18 @@ function the_profile() {
$db->bind("email", $email);
$db->bind("website", $website);
$db->bind("user_id", $_SESSION["user_id"]);
$profileupdate = $db->query("UPDATE user_detail SET first_name = :first_name, last_name = :last_name, email= :email, website= :website , position= :position WHERE user_id = :user_id");
if ($profileupdate) {
if ($profileupdate > 0) {
action_log($_SESSION['user_id'], "Profile Update", "SUCCESS");
return new Response('Success', 200);
} else {
}
else if ($profileupdate == 0){
return new Response('Not affected', 304);
}
else {
action_log($_SESSION['user_id'], "Profile Update", "FAILED");
return new Response('Failed', 201);
return new Response('Failed', 400);
}
});
$app->post('/profile/edit/updatepic', function (Request $request) {