本文整理汇总了PHP中confirm函数的典型用法代码示例。如果您正苦于以下问题:PHP confirm函数的具体用法?PHP confirm怎么用?PHP confirm使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了confirm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: leaveRun
function leaveRun()
{
// Access the globals.
global $DB;
global $TIMEMARK;
global $MySelf;
$runid = $_GET[id];
$userid = $MySelf->getID();
// Are we actually still in this run?
if (userInRun($userid, $runid) == "none") {
makeNotice("You can not leave a run you are currently not a part of.", "warning", "Not you run.", "index.php?action=show&id={$runid}", "[cancel]");
}
// Is $runid truly an integer?
numericCheck($runid);
// Oh yeah?
if (runIsLocked($runid)) {
confirm("Do you really want to leave mining operation #{$runid} ?<br><br>Careful: This operation has been locked by " . runSupervisor($runid, true) . ". You can not rejoin the operation unless its unlocked again.");
} else {
confirm("Do you really want to leave mining operation #{$runid} ?");
}
// Did the run start yet? If not, delete the request.
$runStart = $DB->getCol("SELECT starttime FROM runs WHERE id='{$runid}' LIMIT 1");
if ($TIMEMARK < $runStart[0]) {
// Event not started yet. Delete.
$DB->query("DELETE FROM joinups WHERE run='{$runid}' AND userid='{$userid}'");
} else {
// Event started, just mark inactive.
$DB->query("update joinups set parted = '{$TIMEMARK}' where run = '{$runid}' and userid = '{$userid}' and parted IS NULL");
}
makeNotice("You have left the run.", "notice", "You left the Op.", "index.php?action=show&id={$runid}", "[OK]");
}
示例2: get_products
function get_products()
{
$query = query("SELECT * FROM products");
confirm($query);
while ($row = fetch_array($query)) {
$product = <<<DELIMITER
<div class="col-sm-4 col-lg-4 col-md-4">
<div class="thumbnail">
<a href="item.php?id={$row['product_id']}"><img src="{$row['product_image']}" alt=""></a>
<div class="caption">
<h4 class="pull-right">${$row['product_price']}</h4>
<h4><a href="item.php?id={$row['product_id']}">{$row['product_title']}</a>
</h4>
<p>See more snippets like this online store item at <a target="_blank" href="http://www.bootsnipp.com">Bootsnipp - http://bootsnipp.com</a>.</p>
<a class="btn btn-primary" target="_blank" href="../resources/cart.php?add={$row['product_id']}">Add to Cart</a>
</div>
</div>
</div>
DELIMITER;
echo $product;
}
}
示例3: write
function write(&$frm)
{
if (isset($_REQUEST["btn_back"])) {
return enter($frm);
}
if ($frm->validate("write")) {
return confirm($frm);
}
$upd = new dbUpdate("suppstock", "cubit");
$del = new dbDelete("suppstock", "cubit");
foreach ($_REQUEST["stkcod"] as $suppid => $stkcod) {
if (empty($stkcod)) {
$del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$del->run();
continue;
}
$cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkcod", $stkcod));
$upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$upd->run(DB_REPLACE);
}
foreach ($_REQUEST["stkdes"] as $suppid => $stkdes) {
if (empty($stkcod)) {
$del->setOpt("suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$del->run();
continue;
}
$cols = grp(m("suppid", $suppid), m("stkid", $_REQUEST["id"]), m("stkdes", $stkdes));
$upd->setOpt($cols, "suppid='{$suppid}' AND stkid='{$_REQUEST['id']}'");
$upd->run(DB_REPLACE);
}
$OUT = "<script>window.close();</script>";
return $OUT;
}
示例4: deleteEvent
function deleteEvent()
{
// is the events module active?
if (!getConfig("events")) {
makeNotice("The admin has deactivated the events module.", "warning", "Module not active");
}
// Import the globals, as usual.
global $DB;
global $MySelf;
// Are we allowed to be here?
if (!$MySelf->canDeleteEvents()) {
makeNotice("You are not allowed to do this!", "error", "Forbidden");
}
// Is the ID safe?
if (!is_numeric($_GET[id]) || $_GET[id] < 0) {
makeNotice("Invalid ID given!", "error", "Invalid Data");
}
// Does the user really want this?
confirm("Are you sure you want to delete this event?");
// Ok, then delete it.
$DB->query("DELETE FROM events WHERE id = '{$_GET['id']}' LIMIT 1");
if ($DB->affectedRows() == 1) {
// Inform the people!
// mailUser();
makeNotice("The event has been deleted", "notice", "Event deleted", "index.php?action=showevents", "[OK]");
} else {
makeNotice("Could not delete the event from the database.", "error", "DB Error", "index.php?action=showevents", "[Cancel]");
}
}
示例5: users_online
function users_online()
{
if (isset($_GET['onlineusers'])) {
global $connection;
if (!$connection) {
session_start();
include "../includes/db.php";
$session = session_id();
$time = time();
$time_out_in_seconds = 1;
$time_out = $time - $time_out_in_seconds;
$query = "SELECT * FROM users_online WHERE session = '{$session}'";
$send_query = mysqli_query($connection, $query);
confirm($send_query);
$count = mysqli_num_rows($send_query);
if ($count == NULL) {
mysqli_query($connection, "INSERT INTO users_online(session, time) VALUES('{$session}', '{$time}')");
} else {
mysqli_query($connection, "UPDATE users_online SET time = '{$time}' WHERE session = '{$session}'");
}
$users_online_query = mysqli_query($connection, "SELECT * FROM users_online WHERE time > '{$time_out}'");
echo $count_user = mysqli_num_rows($users_online_query);
}
}
// Get request isset()
}
示例6: deleteRun
function deleteRun()
{
// We need some globals.
global $DB;
global $MySelf;
global $READONLY;
// Are we allowed to delete runs?
if (!$MySelf->canDeleteRun() || $READONLY) {
makeNotice("You are not allowed to delete runs!", "error", "forbidden");
}
// Set the ID.
$ID = sanitize("{$_GET['id']}");
if (!is_numeric($ID) || $ID < 0) {
makeNotice("Invalid ID passed to deleteRun!", "error");
}
// Are we sure?
confirm("Do you really want to delete run #{$ID} ?");
// Get the run in question.
$run = $DB->getRow("SELECT * FROM runs WHERE id = '{$ID}' LIMIT 1");
// is it closed?
if ("{$run['endtime']}" < "0") {
makeNotice("You can only delete closed runs!", "error", "Deletion canceled", "index.php?action=list", "[cancel]");
}
// delete it.
$DB->query("DELETE FROM runs WHERE id ='{$ID}'");
// Also delete all hauls.
$DB->query("DELETE FROM hauled WHERE miningrun='{$ID}'");
// And joinups.
$DB->query("DELETE FROM joinups WHERE runid='{$ID}'");
makeNotice("The Miningrun Nr. #{$ID} has been deleted from the database and all associated hauls as well.", "notice", "Mining Operation deleted", "index.php?action=list", "[OK]");
}
示例7: verify_directory
function verify_directory($directory)
{
if (file_exists($directory)) {
return confirm(sprintf("Directory %s exists. Use it?", $directory));
}
mkdir($directory);
return true;
}
示例8: alerta
function alerta()
{
if (confirm("El usuario y contraseña son incorrectos vuelva a intentarlo ")) {
alert('Pulsaste aceptar!');
} else {
alert('Pulsaste cancelar!');
}
}
示例9: write
function write($frm)
{
extract($_REQUEST);
if ($frm->validate("write")) {
return confirm($frm);
}
pglib_transaction("BEGIN");
db_conn('cubit');
$user = USER_NAME;
$Sql = "SELECT * FROM assets WHERE (dep_month='yes' AND remaction IS NULL)";
$Rslt = db_exec($Sql) or errDie("Unable to access database.");
$cc = "";
$todate = mkdate($date_year, $date_month, $date_day);
$ttime = mktimefd($todate);
$refnum = getrefnum($todate);
while ($led = pg_fetch_array($Rslt)) {
if (empty($led["autodepr_date"])) {
$led["autodepr_date"] = $led["date"];
}
explodeDate($led["autodepr_date"], $date_year, $date_month, $date_day);
$ftime = mktime(0, 0, 0, $date_month, $date_day, $date_year);
$depmonths = 0;
while ($ftime < $ttime) {
++$depmonths;
$ftime = mktime(0, 0, 0, $date_month + $depmonths, $date_day, $date_year);
}
if ($depmonths == 0) {
continue;
}
$depperc = $led["dep_perc"];
$ml_perc = $depperc * ($depmonths % 12 / 12);
$years = ($depmonths - $depmonths % 12) / 12;
$baseamt = $led["amount"] - $led["accdep"];
$depamt = 0;
/* yearly depreciations */
for ($i = 1; $i <= $years; ++$i) {
$depamt += ($baseamt - $depamt) * ($depperc / 100);
}
/* monthly depreciation */
$depamt += ($baseamt - $depamt) * ($ml_perc / 100);
$sql = "SELECT * FROM assetgrp WHERE grpid = '{$led['grpid']}' AND div = '" . USER_DIV . "'";
$grpRslt = db_exec($sql);
$grp = pg_fetch_array($grpRslt);
writetrans($grp['depacc'], $grp['accdacc'], $todate, $refnum, $depamt, "{$led['des']} Depreciation");
db_connect();
$sql = "UPDATE assets SET accdep = (accdep + '{$depamt}'), autodepr_date='{$todate}'\r\n\t\t\t\tWHERE (id='{$led['id']}' AND div = '" . USER_DIV . "')";
db_exec($sql) or errdie("Could not update assets table.");
$snetval = $baseamt - $depamt;
$sdate = date("Y-m-d");
$sql = "INSERT INTO assetledger(assetid, asset, date, depamt, netval, div) \r\n\t\t\t\tVALUES ('{$led['id']}', '{$led['des']}', '{$todate}', '{$depamt}', '{$snetval}', '" . USER_DIV . "')";
db_exec($sql) or errdie("Could not write to asset ledger.");
$cc .= "CostCenter('ct', 'Asset Depreciation', '{$todate}', '{$led['des']} Depreciation', '{$depamt}', '');";
}
pglib_transaction("COMMIT");
$write = "\r\n\t<script> \r\n\t{$cc}\r\n\t</script>\r\n\t<table " . TMPL_tblDflts . " width='50%'>\r\n\t\t<tr>\r\n\t\t\t<th>Auto Asset Depreciation</th>\r\n\t\t</tr>\r\n\t\t<tr class='datacell'>\r\n\t\t\t<td>Asset Depreciation has calculated and recorded.</td>\r\n\t\t</tr>\r\n\t</table>";
return $write;
}
示例10: get_record_json_by_id
function get_record_json_by_id($id)
{
$query = "SELECT * FROM task WHERE id = {$id}";
$result = mysql_query($query);
confirm($result, "problem in query");
$row = mysql_fetch_array($result);
$record_array = array("id" => $row["id"], "title" => $row["title"], "complete" => $row["complete"]);
$record_json = json_encode($record_array);
return $record_json;
}
示例11: connect_error
function connect_error()
{
global $adminer, $connection, $token, $error, $drivers;
if (DB != "") {
header("HTTP/1.1 404 Not Found");
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
} else {
if ($_POST["db"] && !$error) {
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
}
//Encabezado y botones de la parte superior en la seleccion de bases de datos
page_header(lang('Select database'), $error, false);
echo "<p>\n";
foreach (array('database' => lang('Create new database'), 'privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) {
if (support($key)) {
echo "<a class='btn btn-xs btn-primary' href='" . h(ME) . "{$key}='>{$val}</a>\n";
}
}
//Presenta informacion de la conexion
echo "<p><i class='fa fa-exchange fa-fw'></i> " . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>" . h($connection->server_info) . "</b>", "<b>{$connection->extension}</b>") . "\n";
echo "<p><i class='fa fa-user fa-fw'></i> " . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
//Presenta la lista de bases de datos existentes y los encabezados
$databases = $adminer->databases();
if ($databases) {
$scheme = support("scheme");
$collations = collations();
echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' class='checkable table table-condensed table-responsive table-hover' onclick='tableClick(event);' ondblclick='tableClick(event, true);'>\n";
echo "<thead><tr>" . (support("database") ? "<th> " : "") . "<th>" . lang('Database') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "refresh=1'><i class='fa fa-refresh fa-fw'></i> " . lang('Refresh') . "</a>" . "<th>" . lang('Collation') . "<th>" . lang('Tables') . "<th>" . lang('Size') . " - <a class='btn btn-default btn-xs' href='" . h(ME) . "dbsize=1' onclick=\"return !ajaxSetHtml('" . js_escape(ME) . "script=connect');\">" . lang('Compute') . "</a>" . "</thead>\n";
//Presenta la lista de bases de datos
$databases = $_GET["dbsize"] ? count_tables($databases) : array_flip($databases);
foreach ($databases as $db => $tables) {
$root = h(ME) . "db=" . urlencode($db);
echo "<tr" . odd() . ">" . (support("database") ? "\n\t\t\t\t\t<td align=center>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"])) : "");
echo "<th><a href='{$root}'>" . h($db) . "</a>";
$collation = nbsp(db_collation($db, $collations));
echo "<td>" . (support("database") ? "<a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>{$collation}</a>" : $collation);
echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>" . ($_GET["dbsize"] ? $tables : "?") . "</a>";
echo "<td align='right' id='size-" . h($db) . "'>" . ($_GET["dbsize"] ? db_size($db) : "?");
echo "\n";
}
echo "</table>\n";
//Agrega boton de eliminar
echo support("database") ? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n" . "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" . "<input class='btn btn-xs btn-danger' type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n" . "</div></fieldset>\n" : "";
echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "<input type='hidden' name='token' value='{$token}'>\n";
echo "</form>\n";
}
}
page_footer("db");
}
示例12: cart
function cart()
{
$total = 0;
$item_quantity = 0;
$item_name = 1;
$item_number = 1;
$amount = 1;
$quantity = 1;
foreach ($_SESSION as $name => $value) {
if ($value > 0) {
if (substr($name, 0, 8) == "product_") {
$length = strlen($name - 8);
$id = substr($name, 8, $length);
$query = query("SELECT * FROM products WHERE product_id = " . escape_string($id) . " ");
confirm($query);
while ($row = fetch_array($query)) {
$sub = $row['product_price'] * $value;
$item_quantity += $value;
$product = <<<DELIMETER
<tr>
<td>{$row['product_title']}</td>
<td>${$row['product_price']}</td>
<td>{$value}</td>
<td>${$sub}</td>
<td>
<a class='btn btn-warning' href="cart.php?remove={$row['product_id']}"><span class='glyphicon glyphicon-minus'></span></a>
<a class='btn btn-success' href="cart.php?add={$row['product_id']}"><span class='glyphicon glyphicon-plus'></span></a>
<a class='btn btn-danger' href="cart.php?delete={$row['product_id']}"><span class='glyphicon glyphicon-remove'></span></a>
</td>
</tr>
<input type="hidden" name="item_name_{$item_name}" value="{$row['product_title']}">
<input type="hidden" name="item_number_{$item_number}" value="{$row['product_id']}">
<input type="hidden" name="amount_{$amount}" value="{$row['product_price']}">
<input type="hidden" name="quantity_{$quantity}" value="{$row['product_quantity']}">
DELIMETER;
echo $product;
$total = 0;
$item_quantity = 0;
$item_name++;
$item_number++;
$amount++;
$quantity++;
}
$_SESSION['item_total'] = $total += $sub;
$_SESSION['item_quantity'] = $item_quantity;
}
}
}
}
示例13: createTransaction
function createTransaction()
{
// We need globals.
global $DB;
global $MySelf;
global $TIMEMARK;
// Are we allowed to poke in here?
if (!$MySelf->isAccountant()) {
makeNotice("Umm, you are not allowed to do this. Really. You are not.", "warning", "You are not supposed to be here");
}
// Check the ints.
numericCheck($_POST[wod], 0, 1);
numericCheck($_POST[amount], 0);
numericCheck($_POST[id], 0);
// Its easier on the eyes.
$type = $_POST[wod];
$amount = $_POST[amount];
$id = $_POST[id];
$username = idToUsername($id);
// invert the amount if we have a withdrawal.
if ($_POST[wod] == 1) {
$dir = "withdrawed";
$dir2 = "from";
$hisMoney = getCredits($id);
if ($hisMoney < $amount) {
$ayee = $hisMoney - $amount;
confirm("WARNING:<br>{$username} can NOT afford this withdrawal. If you choose to " . "authorize this transaction anyway his account will be at " . number_format($ayee, 2) . " ISK.");
}
} else {
$amount = $_POST[amount];
$dir = "deposited";
$dir2 = "into";
}
// We use custom reason, if set.
if ($_POST[reason2] != "") {
$reason = sanitize($_POST[reason2]);
} else {
$reason = sanitize($_POST[reason1]);
}
// Create transaction.
$transaction = new transaction($id, $type, $amount);
$transaction->setReason($reason);
// Success?
if (!$transaction->commit()) {
// Nope :(
makeNotice("Unable to create transaction. Danger, Will Robinson, DANGER!", "error", "Internal Error", "index.php?action=edituser&id={$id}", "[Back]");
} else {
// Success !
makeNotice("You successfully {$dir} {$amount} ISK {$dir2} " . $username . "'s account.", "notice", "Transaction complete", "index.php?action=edituser&id={$id}", "[Ok]");
}
}
示例14: connect_error
function connect_error()
{
global $connection, $token, $error, $drivers;
$databases = array();
if (DB != "") {
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
} else {
if ($_POST["db"] && !$error) {
queries_redirect(substr(ME, 0, -1), lang('Databases have been dropped.'), drop_databases($_POST["db"]));
}
page_header(lang('Select database'), $error, false);
echo "<p><a href='" . h(ME) . "database='>" . lang('Create new database') . "</a>\n";
foreach (array('privileges' => lang('Privileges'), 'processlist' => lang('Process list'), 'variables' => lang('Variables'), 'status' => lang('Status')) as $key => $val) {
if (support($key)) {
echo "<a href='" . h(ME) . "{$key}='>{$val}</a>\n";
}
}
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>{$connection->server_info}</b>", "<b>{$connection->extension}</b>") . "\n";
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
if ($_GET["refresh"]) {
set_session("dbs", null);
}
$databases = get_databases();
if ($databases) {
$scheme = support("scheme");
$collations = collations();
echo "<form action='' method='post'>\n";
echo "<table cellspacing='0' class='checkable' onclick='tableClick(event);'>\n";
echo "<thead><tr><td> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
foreach ($databases as $db) {
$root = h(ME) . "db=" . urlencode($db);
echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
echo "<th><a href='{$root}'>" . h($db) . "</a>";
echo "<td><a href='{$root}" . ($scheme ? "&ns=" : "") . "&database=' title='" . lang('Alter database') . "'>" . nbsp(db_collation($db, $collations)) . "</a>";
echo "<td align='right'><a href='{$root}&schema=' id='tables-" . h($db) . "' title='" . lang('Database schema') . "'>?</a>";
echo "\n";
}
echo "</table>\n";
echo "<script type='text/javascript'>tableCheck();</script>\n";
echo "<p><input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm("formChecked(this, /db/)", 1) . ">\n";
// 1 - eventStop
echo "<input type='hidden' name='token' value='{$token}'>\n";
echo "<a href='" . h(ME) . "refresh=1' onclick='eventStop(event);'>" . lang('Refresh') . "</a>\n";
echo "</form>\n";
}
}
page_footer("db");
if ($databases) {
echo "<script type='text/javascript'>ajaxSetHtml('" . js_adminer_escape(ME) . "script=connect');</script>\n";
}
}
示例15: cart
function cart()
{
$total = 0;
$item_quantity = 0;
$item_name = 1;
$item_number = 1;
$amount = 1;
$quantity = 1;
foreach ($_SESSION as $name => $value) {
if ($value > 0) {
if (substr($name, 0, 8) == "product_") {
$length = strlen($name - 8);
$id = sanitize(substr($name, 8, $length));
$query = query("SELECT * FROM products WHERE p_id = {$id}");
confirm($query);
while ($row = fetch_array($query)) {
$sub = $row['pprice'] * $value;
$item_quantity += $value;
$srt = strtoupper(str_replace("_", " ", "{$row['pname']}"));
$product = <<<DELIMETER
\t\t\t\t<tr>
\t\t\t\t <td><div class=row><div class=col-md-3><img width='50' src='{$row['pimage']}'>
\t\t\t\t </div><div class=col-sm-9><a href="{$row['pname']}"><strong>{$srt}</strong></a><br>
\t\t\t\t </div>
\t\t\t\t </div>
\t\t\t\t </td>
\t\t\t\t <td>₹ {$row['pprice']}</td>
\t\t\t\t <td>{$value}</td>
\t\t\t\t <td>₹ {$sub}</td>
\t\t\t\t <td><a class='btn btn-success' href="cart?add={$row['p_id']}"><span class='glyphicon glyphicon-plus'></span></a> <a class='btn btn-warning' href="cart?remove={$row['p_id']}"><span class='glyphicon glyphicon-minus'></span></a>
\t\t\t\t<a class='btn btn-danger' href="cart?delete={$row['p_id']}"><span class='glyphicon glyphicon-remove'></span></a></td>
\t\t\t\t </tr>
\t\t\t\t <input type="hidden" name="item_name_{$item_name}" value="{$srt}">
\t\t\t\t <input type="hidden" name="item_number_{$item_number}" value="{$row['p_id']}">
\t\t\t\t <input type="hidden" name="amount_{$amount}" value="{$row['pprice']}">
\t\t\t <input type="hidden" name="quantity_{$quantity}" value="{$value}">
DELIMETER;
echo $product;
$item_name++;
$item_number++;
$amount++;
$quantity++;
}
$_SESSION['item_total'] = $total += $sub;
$_SESSION['item_quantity'] = $item_quantity;
}
}
}
}