implemented image upload and cropping system, mostly work. it's too zoomed in and appears to be using the xy coords from the top left of the crop selector.

This commit is contained in:
2025-03-29 22:57:43 -06:00
parent 9a45075010
commit ff7e799b7f
14 changed files with 609 additions and 130 deletions
+66 -29
View File
@@ -5,43 +5,81 @@ require_once 'functions/functions.php';
include_once 'functions/account_functions.php';
$msg = '';
// Handle creating a new user.
if (isset($_POST['verify_password'])) {
$msg = create_account($_POST['username'], $_POST['email'], $_POST['password'], $_POST['verify_password'], 4, $_POST['profile_picture_upload']);
if ($msg === true)
header('Location: .');
}
if (isset($_POST['username'])) {
$msg = login($_POST['username'], $_POST['password'], (isset($POST['stay_logged_in']) ? true : false));
if ($msg === true)
header('Location: .');
}
if (isset($_POST['form_id'])) {
switch ($_POST['form_id']) {
case 'signup_form':
$msg = signup(
$_POST['username'],
$_POST['email'],
$_POST['password'],
$_POST['verify_password'],
4, // TODO: Need to allow for other roles to be created, if the submission is from an administrator or owner.
(!empty($_FILES) ? $_FILES : ''),
(!empty($_POST['crop_x']) ? $_POST['crop_x'] : ''),
(!empty($_POST['crop_y']) ? $_POST['crop_y'] : ''),
(!empty($_POST['crop_width']) ? $_POST['crop_width'] : '')
);
if ($msg === true)
header('Location: user.php?action=view&user_id=' . $_COOKIE['user_id']);
break;
case 'login_form':
$msg = login(
$_POST['username'],
$_POST['password'],
(isset($POST['stay_logged_in']) ? true : false)
);
if ($msg === true)
header('Location: .');
break;
case 'reset_pw_form':
$msg = reset_password($_COOKIE['user_id'], $_POST['new_pw'], $_POST['verify_new_pw']);
// code...
$msg = reset_password(
$_COOKIE['user_id'],
$_POST['new_pw'],
$_POST['verify_new_pw']
);
break;
case 'update_email_form':
$msg = update_email($_COOKIE['user_id'], $_POST['new_email'], $_POST['verify_new_email']);
// code...
$msg = update_email(
$_COOKIE['user_id'],
$_POST['new_email'],
$_POST['verify_new_email']
);
break;
case 'update_username_form':
$msg = update_username($_COOKIE['user_id'], $_POST['new_username'], $_POST['verify_new_username']);
// code...
$msg = update_username(
$_COOKIE['user_id'],
$_POST['new_username'],
$_POST['verify_new_username']
);
break;
case 'delete_account_form':
$msg = delete_account($_COOKIE['user_id'], $_POST['delete_password'], $_POST['delete_verify_password']);
break;
// case 'request_role_form':
// // code...
// break;
default:
// code...
$msg = delete_account(
$_COOKIE['user_id'],
$_POST['delete_password'],
$_POST['delete_verify_password']
);
break;
}
echo $msg;
@@ -55,8 +93,7 @@ else if ($_GET['action'] == 'signup')
echo signup_form(($msg ? $msg : ''));
else if ($_GET['action'] == 'logout')
logout();
else if ($_GET['action'] == 'view' && isset($_GET['user_id'])) {
else if ($_GET['action'] == 'view' && isset($_GET['user_id']))
echo user_view($_GET['user_id']);
}
include_once 'components/foot.php';