<?php
$servername = "your_host";
$username = "db_user";
$password = "db_pass";
$dbname = "your_database";
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['user_id'])) {
$user_id = $_POST['user_id'];
$timestamp = strtotime($_POST['timestamp']);
if (!is_numeric($user_id)) {
preg_match('\/members\/(\d+)/', $user_id, $matches);
if (isset($matches[1])) {
$user_id = $matches[1];
} else {
die("Invalid member URL");
}
}
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "UPDATE xf_user SET register_date = ? WHERE user_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("si", $timestamp, $user_id);
if ($stmt->execute()) {
echo "User record updated successfully";
} else {
echo "Error updating user record: " . $conn->error;
}
$conn->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Update User Registration Date</title>
</head>
<body>
<div class="jimchangedatecontainer">
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST" onsubmit="return confirm('Are you sure you want to update the user registration date? This action cannot be undone.');">
<label for="user_id"><pre id="con35">Member URL or ID:</pre></label>
<input type="text" id="user_id" name="user_id"><br>
<label for="timestamp"><pre id="con35">Timestamp:</pre></label>
<input type="text" id="timestamp" name="timestamp"><br>
<input type="button" value="Insert Current Time" onclick="insertCurrentTime()">
<input type="submit" value="Update Registration Date">
</form>
</div>
</body>
<script>
function insertCurrentTime() {
var now = new Date();
var timestampField = document.getElementById("timestamp");
timestampField.value = now.toISOString();
}
</script>
<style>
#con35 {
color: grey;
}
::-webkit-scrollbar {
width: 7px !important;
height: 5px !important;
background-color: #2f2d34 !important;
}
::-webkit-scrollbar-thumb {
background-color: #893839 !important;
}
body {
width: 7px !important;
height: 5px !important;
background-color: #2f2d34 !important;
}
input[type="submit"] {
display: inline-block;
border: 1px solid transparent;
-webkit-transition: background-color 0.25s ease;
transition: background-color 0.25s ease;
font-size: 14px;
font-weight: 700;
border-radius: 3px;
padding-top: 0;
padding-right: 10px;
padding-bottom: 0;
padding-left: 10px;
text-align: center;
outline: none;
line-height: 32px;
height: 32px;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-sizing: content-box;
-webkit-appearance: none;
text-transform: uppercase;
will-change: box-shadow;
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
border: none;
white-space: nowrap;
color: #ec5555;
background: transparent;
border-color: rgba(20, 20, 20, 0);
font-family: 'Lato', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
line-height: 1.4;
}
</style>
</html>