commit jun 24
This commit is contained in:
@@ -116,42 +116,60 @@
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<?php
|
||||
require 'php/connect.inc.php';
|
||||
|
||||
$name = htmlspecialchars($_GET['name']);
|
||||
$surname = htmlspecialchars($_GET['surname']);
|
||||
$email = htmlspecialchars($_GET['email']);
|
||||
$birth_day = htmlspecialchars($_GET['birth_day']);
|
||||
$birth_month = htmlspecialchars($_GET['birth_month']);
|
||||
$birth_year = htmlspecialchars($_GET['birth_year']);
|
||||
$city = htmlspecialchars($_GET['city']);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<body>
|
||||
<div class="form d-flex flex-column align-items-center justify-content-center my-md-5 mb-5 mb-lg-0">
|
||||
<div class="headline-card d-flex flex-column align-items-center justify-content-center mt-4">
|
||||
<h2>Edit user</h2>
|
||||
<img class="line-img" src="assets/images/line.png" alt="">
|
||||
</div>
|
||||
<form action="php/add_user_register.php" method="post">
|
||||
<form action="php/update-user.php" method="post">
|
||||
<div class="form-container-bot d-flex flex-column align-items-start justify-content-center">
|
||||
<input class="input-text" type="text" placeholder="User's Name" name="name">
|
||||
<input class="input-text" type="text" placeholder="User's Surname" name="surname">
|
||||
<input class="input-text" type="text" placeholder="User's Email" name="email">
|
||||
<input class="input-text" type="password" id="password" placeholder="Password" name="password">
|
||||
<i id="togglePassword" class="fa-solid fa-eye"></i>
|
||||
<p id="generate-password">generete</p>
|
||||
<input class="input-text" type="password" id="confirm-password" placeholder="Confirm Password" name="password_again">
|
||||
<input class="input-text" type="text" placeholder="User's City" name="city">
|
||||
<input class="input-text" type="text" name="name" value="<?php echo $name; ?>">
|
||||
<input class="input-text" type="text" name="surname" value="<?php echo $surname; ?>">
|
||||
<input class="input-text" type="text" name="email" value="<?php echo $email; ?>">
|
||||
<input class="input-text" type="password" id="password" placeholder="Password" name="password">
|
||||
<i id="togglePassword" class="fa-solid fa-eye"></i>
|
||||
<p id="generate-password">generate</p>
|
||||
<input class="input-text" type="password" id="confirm-password" placeholder="Confirm Password" name="password_again">
|
||||
<input class="input-text" type="text" name="city" value="<?php echo $city; ?>">
|
||||
<h6>Date of birth:</h6>
|
||||
<div class="date-container">
|
||||
<span>
|
||||
|
||||
<span>
|
||||
<select name="birth_day">
|
||||
<?php
|
||||
$start_date = 1;
|
||||
$end_date = 31;
|
||||
for ($j = $start_date; $j <= $end_date; $j++) {
|
||||
echo '<option value=' . $j . '>' . $j . '</option>';
|
||||
$selected = ($j == $birth_day) ? 'selected' : '';
|
||||
echo '<option value="' . $j . '" ' . $selected . '>' . $j . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</span>
|
||||
<span>
|
||||
<select name="birth_month">
|
||||
<?php for ($m = 1; $m <= 12; ++$m) {
|
||||
<?php
|
||||
for ($m = 1; $m <= 12; ++$m) {
|
||||
$month_label = date('F', mktime(0, 0, 0, $m, 1));
|
||||
$selected = ($month_label == $birth_month) ? 'selected' : '';
|
||||
echo '<option value="' . $month_label . '" ' . $selected . '>' . $month_label . '</option>';
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $month_label; ?>"><?php echo $month_label; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</span>
|
||||
<span>
|
||||
@@ -161,7 +179,8 @@
|
||||
$min = $year - 100;
|
||||
$max = $year;
|
||||
for ($i = $max; $i >= $min; $i--) {
|
||||
echo '<option value=' . $i . '>' . $i . '</option>';
|
||||
$selected = ($i == $birth_year) ? 'selected' : '';
|
||||
echo '<option value="' . $i . '" ' . $selected . '>' . $i . '</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
@@ -172,7 +191,7 @@
|
||||
<input type="hidden" id="exampleCheckboxValue" name="admin" value="0">
|
||||
</div>
|
||||
</div>
|
||||
<input class="view-more" type="submit" value="Add user">
|
||||
<input class="view-more" type="submit" value="Edit user">
|
||||
|
||||
</div>
|
||||
</form>
|
||||
@@ -260,7 +279,7 @@
|
||||
|
||||
$('#generate-password').click(function() {
|
||||
const password = generatePassword(8);
|
||||
$('#password').val(password);
|
||||
$('#password').val(password);
|
||||
$('#confirm-password').val(password);
|
||||
});
|
||||
|
||||
@@ -282,7 +301,7 @@
|
||||
function isPasswordValid(password) {
|
||||
if (password.length < 8) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!/[a-z]/.test(password)) {
|
||||
return false;
|
||||
}
|
||||
@@ -298,16 +317,16 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
function updateCheckboxValue() {
|
||||
const isChecked = $('#exampleCheckbox').is(':checked');
|
||||
$('#exampleCheckboxValue').val(isChecked ? '1' : '0');
|
||||
}
|
||||
function updateCheckboxValue() {
|
||||
const isChecked = $('#exampleCheckbox').is(':checked');
|
||||
$('#exampleCheckboxValue').val(isChecked ? '1' : '0');
|
||||
}
|
||||
|
||||
$('#exampleCheckbox').change(function() {
|
||||
updateCheckboxValue();
|
||||
});
|
||||
|
||||
$('#exampleCheckbox').change(function() {
|
||||
updateCheckboxValue();
|
||||
});
|
||||
|
||||
updateCheckboxValue();
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user