我有一个帐户生成器,每次点击“生成”时,都会显示一个新帐户。还有一个“标记为无效”按钮,用于将框中的alt发送到我的管理页面(admin-flagged.php)。
生成器中的代码:
$result = mysqli_query($con, $generatorquery) or die(mysqli_error($con));
while ($row = mysqli_fetch_array($result)) {
echo '
<div class="col-lg-4">
<!--user info table start-->
<section class="panel">
<div class="panel-body">
<div class="task-thumb-details">
<h1>'.$row['name'].' Generator</h1>
</div>
<legend></legend>
<input type="text" id="generator'.$row["id"].'" onclick="select_all(this)" class="text-center form-control" placeholder="username:password"></br>
<button id="generate'.$row["id"].'" class="btn btn-info btn-block">Generate</button></br>
<legend></legend>
<form id="flagform'.$row["id"].'" action="generator.php" method="POST">
<input type="hidden" id="flag'.$row["id"].'" name="flagalt" value="">
<input type="hidden" name="generator" value="'.$row["id"].'">
<div class="btn-group btn-group-justified">
<a id="copy'.$row["id"].'" data-clipboard-target="generator'.$row["id"].'" title="Copy" class="btn btn-success">Copy</a>
<a href="javascript:void(0);" onclick=$(this).closest("form").submit(); title="Flag as invalid" class="btn btn-danger">Flag as invalid</a>
</div>
</form>
</div>
</section>
管理页面中的代码:
<?php
$result = mysqli_query($con, "SELECT * FROM `generators`") or die(mysqli_error($con));
while ($row = mysqli_fetch_array($result)) {
$generator = $row['name'];
$generatorid = $row['id'];
$result2 = mysqli_query($con, "SELECT * FROM `generator$generatorid` WHERE `status` = '2'") or die(mysqli_error($con));
while ($row2 = mysqli_fetch_array($result2)) {
echo '<tr>
<td>' . $generator . '</td>
<td>'.$row2['alt'].'</td>
<td><a class="btn btn-info btn-xs" href="#" disabled><i class="icon-check"></i> Test Alt</a></td>
<td><a class="btn btn-danger btn-xs" href="admin-flagged.php?delete=' . $row2['id'] . '&generator='.$generatorid.'"><i class="icon-trash "></i></a></td>
</tr>
';
}
}
?>
管理页面顶部的PHP代码:
if (isset($_GET['delete']) && isset($_GET['generator'])){
$id = mysqli_real_escape_string($con, $_GET['delete']);
$generatorid = mysqli_real_escape_string($con, $_GET['generator']);
mysqli_query($con, "UPDATE `generator$generatorid` SET `status` = '0' WHERE `id` = '$id'") or die(mysqli_error($con));
echo '
<script>
window.history.replaceState("object or string", "Title", "/admin-flagged.php");
</script>
';
}
PhpMyAdmin表:
`-- Table structure for table `generator3`
--
CREATE TABLE IF NOT EXISTS `generator3` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`alt` varchar(1000) DEFAULT NULL,
`status` int(1) DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=997 ;
--
-- Dumping data for table `generator3`
--
INSERT INTO `generator3` (`id`, `alt`, `status`) VALUES
(505, 'psharma078@gmail.com:pinju337\r', 1);`