File "user_create.php"

Full path: /home/fsibplc/public_html/fsib/remittance/user_create.php
File size: 1.39 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

include 'all_sql.php';
include 'sidebar.php';

$success = false;

if (isset($_POST['user_create'])) {
    $username = $_POST['username'];
    $password = "Abcd@1234";

    $user_create_sql = "INSERT INTO `user_list`(`username`, `password`) VALUES ('$username','$password')";
    $user_create_sql_execute = $conn->query($user_create_sql);
    $affected_rows = $user_create_sql_execute->num_rows;

    if ($user_create_sql_execute) {
        $success = true;
    }
}

?>

<div class="show-content">
    <div class="card" style="width: 600px;margin:30px auto">
        <h3 class="text-info mt-3 text-center">New User Create</h3>

        <script>
            <?php if ($success) { ?>
                alert('New User created successfully!\nUsername: <?php echo $username; ?>\nPassword: <?php echo $password; ?>\n');
            <?php } ?>
        </script>

        <form action="" method="post" class="p-5">
            <div class="form-group row">
                <label for="username" class="form-label">Username</label>
                <input type="text" name="username" class="form-control" placeholder="use PF as username" required>
            </div>
            <div class="form-group row">
                <input type="submit" value="Submit" name="user_create" class="btn btn-success">
            </div>

        </form>
    </div>
</div>

<?php include 'footer.php'; ?>