gpt4 book ai didi

php - 我想显示提交后插入数据库的数据

转载 作者:行者123 更新时间:2023-11-29 10:35:13 24 4
gpt4 key购买 nike

我有一个生成器脚本,它基本上生成随机 token 并将它们存储在 MySQL 数据库中。有几个人会使用它,我想要做的基本上是显示刚刚在生成页面上生成的生成的 token ,这样当他们生成 token 并且它们都与其他 token 混合时,他们可以轻松复制他们生成的 token ,而无需遍历每个人的代币的整个表。

我已将整个表单和脚本放在这里,提交部分工作完美,只是想知道这个额外的功能以及它是否有可能。

<?php 
function randString($length, $charset='ABCEFGHJKLMNPRTUVWXY23456789' )
{
$str='' ;
$count=strlen($charset);
while ($length--) {
$str.=$charset[mt_rand(0, $count - 1) ];
}
return $str;
}

if (isset($_POST[ 'create'])) {
$token_semi_quantity=0 ;
$token_combo=$ _POST[ 'howmany'];
$seller=$_POST[ 'seller'];
while ($token_semi_quantity < $token_combo) {
$token=randString(4) . "-" . randString(4) . "-" . randString(4);
$token_semi_quantity++;
$token_info=$_POST[ 'tokeninfo'];
$token_explode=e xplode( ',', $token_info);
$token_time=$token_explode[0];
$token_desc=$token_explode[1];
$NowDateTime=date( "Y-m-d H:i:s");
// Log dat shit
$WhoGenDatToken=$userRow[ 'username'] . ' Generated Token <b>' . $token . '</b> at ' . date( "m-d-Y h:i") . ' CST.';
$gen_token=new CONNECT;
$insert_token=( "INSERT INTO `tokens`
(`id`, `token`, `time`, `generatedby`,
`timegenerated`, `used`, `seller`,
`description`)
VALUES ('NULL', :generatetokenVal,
:generatetokentimeVal, :generatetokenadminName,
:generateDateTime, '0',
:generatetokenSeller, :generatetokenDesc);
INSERT INTO `admin_act` (`activity`)
VALUES(:WhoGenDatTokenDen)");
$stmt=$gen_token->runQuery($insert_token);
$stmt->execute(Array( ':generatetokenVal' => $token,
':generatetokentimeVal' => $token_time,
':generatetokenadminName' => $adminName,
':generateDateTime' => $NowDateTime,
':generatetokenSeller' => $seller,
':generatetokenDesc' => $token_desc,
':WhoGenDatTokenDen' => $WhoGenDatToken ));

}
}
?>
<!-- PAGE CONTENT WRAPPER -->
<div class="page-content-wrap">
<div class="row">
<h2>&nbsp;&nbsp;<span class="fa fa-tags"></span>&nbsp;<?php
echo $xblsname; ?> Token Generator</h2>
<div class="col-md-12">
<div class="panel panel-default tabs">
<div class="panel-body tab-content">
<div class="tab-pane active" id="tab-first">
<div class="col-md-3">
<h3><?php
echo $xblsname; ?> Token Generator</h3>
<form method="POST" class="form-horizontal">
<div class="form-group">
<label class="col-md-3 col-xs-12 control-label">How Many?</label>
<div class="col-md-6 col-xs-12">
<select class="form-control select" name="howmany">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
</select>
<span class="help-block">Choose how many to generate</span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-xs-12 control-label">Token Type</label>
<div class="col-md-6 col-xs-12">
<select class="form-control" name="tokeninfo" id="tokeninfo">
<option value="1,1 Day Server Time">1 Day Server Only</option>
<option value="3,3 Days Server Only">3 Days Server Only</option>
<option value="7,1 Week Server Only">1 Week Server Only</option>
<option value="14,2 Weeks Server Only">2 Weeks Server Only</option>
<option value="31,1 Month Server Only">1 Month Server Only</option>
<option value="110,1 Day with GTA Menu">1 Day with GTA Menu</option>
<option value="111,3 Days with GTA Menu">3 Days with GTA Menu</option>
<option value="112,1 Week with GTA Menu">1 Week with GTA Menu</option>
<option value="113,2 Weeks with GTA Menu">2 Weeks with GTA Menu</option>
<option value="114,1 Month with GTA Menu">1 Month with GTA Menu</option>
<option value="999,Custom Token 1">Custom Token 1</option>
</select>
<span class="help-block">Choose token value</span>
</div>
</div>
<div class="form-group">
<label class="col-md-3 col-xs-12 control-label">Seller</label>
<div class="col-md-6 col-xs-12">
<select class="form-control" name="seller">
<?php // Don 't change the options here - do it in includes/settings.php -JohnC
if (!empty($seller1)) print "<option value=\"" . $seller1 . "\">" . $seller1 . "</option>";
if (!empty($seller2)) print "<option value=\"" . $seller2 . "\">" . $seller2 . "</option>";
if (!empty($seller3)) print "<option value=\"" . $seller3 . "\">" . $seller3 . "</option>";
if (!empty($seller4)) print "<option value=\"" . $seller4 . "\">" . $seller4 . "</option>";
if (!empty($seller5)) print "<option value=\"" . $seller5 . "\">" . $seller5 . "</option>";
if (!empty($seller6)) print "<option value=\"" . $seller6 . "\">" . $seller6 . "</option>";
if (!empty($seller7)) print "<option value=\"" . $seller7 . "\">" . $seller7 . "</option>";
if (!empty($seller8)) print "<option value=\"" . $seller8 . "\">" . $seller8 . "</option>";
if (!empty($seller9)) print "<option value=\"" . $seller9 . "\">" . $seller9 . "</option>";
if (!empty($seller10)) print "<option value=\"" . $seller10 . "\">" . $seller10 . "</option>";
if (!empty($seller11)) print "<option value=\"" . $seller11 . "\">" . $seller11 . "</option>";
if (!empty($seller12)) print "<option value=\"" . $seller12 . "\">" . $seller12 . "</option>";
if (!empty($seller13)) print "<option value=\"" . $seller13 . "\">" . $seller13 . "</option>";
if (!empty($seller14)) print "<option value=\"" . $seller14 . "\">" . $seller14 . "</option>";
if (!empty($seller15)) print "<option value=\"" . $seller15 . "\">" . $seller15 . "</option>";
?>
</select>
<span class="help-block">Choose seller</span>
</div>
</div>
</div>
<div class="panel-footer">
<button name = "create" class="btn btn-primary pull-right">Generate Token(s) <span class="fa fa-magic fa-right"></span></button>
</form>
</div>




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

感谢您提供的任何帮助。

最佳答案

while 循环内,将 token 存储到数组/集合/列表中

// inside while loop, after $token = ...
$generatedtoken[] = $token;

然后在您想要显示/列出它们的任何位置:

foreach($generatedtoken as $token) {
echo $token; // some markup maybe added
}

附加到尚未被视为数组的 var 可能是脏的,因此在 if 之前或适当的地方,实例化该数组。

$generatedtoken = array();

关于php - 我想显示提交后插入数据库的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46541311/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com