';
}else{
echo 'File was not uploaded.';
}
}else{
echo 'Upload DIR is not writable....But hey, at least it exists!';
}
}else{
echo 'Upload DIR does not exist.
';
}
}else{
echo 'err...empty file... :|';
}
if(!$connection){
due("SOMETHING WENT HORRIBLY WRONG. RUN AWAY. RUN FAR FAR AWAY.".mysqli_connect_error());
}
/*---- Bio Update -----*/
if($bio){
$update_bio = "UPDATE users SET bio='$bio' WHERE email='$email'";
if(mysqli_query($connection, $update_bio)){
echo "Update successful.
";
}else{
echo "Something went wrong -- ". mysqli_error($connection);
}
}
/*---- Locations Updates -----*/
if($country){
$update_country = "UPDATE users SET location_country='$country' WHERE email='$email'";
if(mysqli_query($connection, $update_country)){
echo "Update successful.
";
}else{
echo "Something went wrong -- ". mysqli_error($connection);
}
}
if($state){
$update_state = "UPDATE users SET location_state='$state' WHERE email='$email'";
if(mysqli_query($connection, $update_state)){
echo "Update successful.
";
}else{
echo "Something went wrong -- ". mysqli_error($connection);
}
}
if($town){
$update_town = "UPDATE users SET location_town='$town' WHERE email='$email'";
if(mysqli_query($connection, $update_town)){
echo "Update successful.
";
}else{
echo "Something went wrong -- ". mysqli_error($connection);
}
}
/*---- Inserts Picture Update -----*/
if($uploaded){
$update_photo = "UPDATE users SET default_image='$new_file_name' WHERE email='$email'";
if(mysqli_query($connection, $update_photo)){
echo "Update Successful.";
}else{
echo "Something went wrong -- ". mysqli_error($connection);
}
}
header("Location: edit-profile.php");
mysqli_close($connection);
?>