本文整理汇总了PHP中enter函数的典型用法代码示例。如果您正苦于以下问题:PHP enter函数的具体用法?PHP enter怎么用?PHP enter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: confirm
function confirm($_POST)
{
# get vars
extract($_POST);
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($dept, "string", 1, 50, "Invalid User Department.");
# display errors, if any
if ($v->isError()) {
$theseErrors = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$theseErrors .= "-" . $e["msg"] . "<br>";
}
$Errors = "\n \t<tr>\n \t\t<td class='err' colspan='2'>{$theseErrors}</td>\n \t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>";
return enter($dept, $Errors);
}
$confirm = "\n\t\t<h3>Add User Department</h3>\n\t\t<h4>Confirm entry</h4>\n\t\t<table " . TMPL_tblDflts . " width='300'>\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='write'>\n\t\t\t<input type='hidden' name='dept' value='{$dept}'>\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>User Department</td>\n\t\t\t\t<td>{$dept}</td>\n\t\t\t</tr>\n\t\t\t<tr><td colspan='2'><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Select Permissions</th>\n\t\t\t</tr>";
// list scripts
db_connect();
$sql = "SELECT DISTINCT name, script FROM scripts ORDER BY script";
$rslt = db_exec($sql);
$i = 0;
while ($scr = pg_fetch_array($rslt)) {
$confirm .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2' nowrap><input type='checkbox' name='perm[]' value='{$scr['name']}'>" . strtoupper($scr['script']) . "</td>\n\t\t\t</tr>";
$i++;
}
$confirm .= "\n\t\t\t<tr>\n\t\t\t\t<td align='right' colspan='3'><input type='submit' value='Add Dept »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>";
return $confirm;
}
示例3: search
function search()
{
global $_GET;
extract($_GET);
require_lib("validate");
$v =& new Validate();
$v->isOk($idnum, "string", 0, 100, "Invalid id / registration number.");
if ($v->isError()) {
$err = "";
foreach ($v->getErrors() as $key => $value) {
$err .= "<li class=err>{$value['msg']}</li>";
}
return enter($err);
}
// post the search request
$search_request = @file(urler(BLACKLIST_SEARCH_URL . "?idnum={$idnum}&" . sendhash()));
if ($search_request == false) {
$site_msg = "<li class=err>Connection to server failed. Check you internet connection and try again.</li>";
} else {
$site_msg = "";
$status = 0;
// 0 = none, 1 = read message
foreach ($search_request as $value) {
$value = str_replace("\n", "", $value);
switch ($value) {
case "<DR_E>":
break;
case "<DR_M>":
$status = 1;
break;
case "</DR_M>":
$status = 0;
break;
case "</DR_E>":
$status = 0;
break;
default:
if ($status == 1) {
$site_msg .= "{$value}\n";
}
}
}
}
$OUTPUT = "\r\n\t<h3>Search Black / White List Registry</h3>";
foreach ($_GET as $key => $value) {
if ($key != "key") {
$OUTPUT .= "<input type=hidden name='{$key}' value='{$value}'>";
}
}
$OUTPUT .= "\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr>\r\n\t\t<th>Data Returned</th>\r\n\t</tr>\r\n\t<tr class='bg-odd'>\r\n\t\t<td valign=top>{$site_msg}</td>\r\n\t</tr>\r\n\t</table>";
return $OUTPUT;
}
示例4: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($wh_id, "num", 1, 9, "Invalid store id.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "UPDATE hire.hire_settings SET value='{$wh_id}' WHERE field='wh_id'";
db_exec($sql) or errDie("Unable to save store id.");
$OUTPUT = "<h3>Hire Settings</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='2'>Write</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>Successfully saved settings.</li></td>\r\n\t\t</tr>\r\n\t</table>";
return $OUTPUT;
}
示例5: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 9, "Invalid booking selection.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "DELETE FROM hire.bookings WHERE id='{$id}'";
db_exec($sql) or errDie("Unable to retrieve bookings.");
$OUTPUT = "<h3>Remove Booking</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Remove</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><li>Booking successfully removed</li></td>\r\n\t\t</tr>\r\n\t</table>";
return $OUTPUT;
}
示例6: update
function update()
{
extract($_REQUEST);
if (isset($remove)) {
foreach ($remove as $id => $value) {
$sql = "DELETE FROM cubit.pslip_reasons WHERE id='{$id}'";
db_exec($sql) or errDie("Unable to remove reasons.");
}
}
if (!empty($reason)) {
$sql = "INSERT INTO cubit.pslip_reasons (reason) VALUES ('{$reason}')";
db_exec($sql) or errDie("Unable to add reason.");
}
return enter();
}
示例7: create
function create($map, $set, $xSize)
{
foreach ($map as $k => $value) {
if (in_array($value, $set)) {
spot();
list($n) = explode('-', $value);
if ($n == $xSize - 1) {
enter();
}
} else {
blank();
if ($value[0] == $xSize - 1) {
enter();
}
}
}
}
示例8: validate
function validate()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($type_name, "string", 1, 255, "Invalid type name.");
if ($v->isError()) {
return enter($v->genErrors());
}
// Make sure we don't have another entry with the same name
$sql = "SELECT * FROM cubit.document_types WHERE type_name='{$type_name}'";
$dt_rslt = db_exec($sql) or errDie("Unable to retrieve document types.");
if (pg_num_rows($dt_rslt)) {
$errmsg = "<li class='err'>A document type with the same name exists.</li>";
return enter($errmsg);
}
}
示例9: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($name, "string", 1, 80, "Invalid type name.");
$v->isOk($descr, "string", 0, 255, "Invalid description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if ($page_option == "Edit") {
$sql = "UPDATE cubit.asset_types SET name='{$name}', description='{$descr}' WHERE id='{$id}'";
} else {
$sql = "INSERT INTO cubit.asset_types (name, description) VALUES ('{$name}', '{$descr}')";
}
db_exec($sql) or errDie("Unable to save asset type.");
$OUTPUT = "\r\n\t\t<h3>{$page_option} Asset Type</h3>\r\n\t\t<form method='post' action='" . SELF . "'>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Write</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td>Successfully Saved the Asset Type.</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</form>";
return $OUTPUT;
}
示例10: confirm
function confirm()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($title, "string", 1, 255, "Invalid title.");
$v->isOk($team_id, "num", 1, 9, "Invalid team selection.");
if ($v->isError()) {
return enter($v->genErrors());
}
// Retrieve team name
$sql = "SELECT name FROM crm.teams WHERE id='{$team_id}'";
$team_rslt = db_exec($sql) or errDie("Unable to retrieve team.");
$team_name = pg_fetch_result($team_rslt, 0);
if (empty($team_name)) {
$team_name = "[None]";
}
$OUTPUT = "<h3>{$page_option} Main Todo</h3>\n\t<form method='post' action='" . SELF . "'>\n\t" . frmupdate_passon() . "\n\t<input type='hidden' name='key' value='write' />\n\t<input type='hidden' name='page_option' value='{$page_option}' />\n\t<input type='hidden' name='id' value='{$id}' />\n\t<input type='hidden' name='title' value='{$title}' />\n\t<input type='hidden' name='team_id' value='{$team_id}' />\n\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t<tr>\n\t\t\t<th colspan='2'>Confirm</th>\n\t\t</tr>\n\t\t<tr class='odd'>\n\t\t\t<td>Title</td>\n\t\t\t<td>{$title}</td>\n\t\t</tr>\n\t\t<tr class='even'>\n\t\t\t<td>Team Permissions</td>\n\t\t\t<td>{$team_name}</td>\n\t\t</tr>\n\t</table>\n\t<input type='submit' value='Write »' />\n\t</form>";
return $OUTPUT;
}
示例11: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($name, "string", 1, 255, "Invalid team name.");
$v->isOk($description, "string", 1, 255, "Invalid team description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if (strtolower($page_option) == "edit") {
$sql = "\n\t\tUPDATE project.teams SET name='{$name}', description='{$description}'\n\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to update team.");
} else {
$sql = "\n\t\tINSERT INTO project.teams (name, description)\n\t\tVALUES ('{$name}', '{$description}')";
db_exec($sql) or errDie("Unable to add team.");
}
$OUTPUT = "\n\t\t\t\t<h3>{$page_option} Project Management Team</h3>\n\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Write</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t<td><li>Successfully saved the team.</li></td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
return $OUTPUT;
}
示例12: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($user_id, "num", 1, 20, "Invalid cubit user selection.");
$v->isOk($description, "string", 0, 255, "Invalid person description.");
if ($v->isError()) {
return enter($v->genErrors());
}
if (strtolower($page_option) == "edit") {
$sql = "\n\t\tUPDATE project.people SET user_id='{$user_id}', description='{$description}'\n\t\tWHERE id='{$id}'";
db_exec($sql) or errDie("Unable to add person");
} else {
$sql = "\n\t\tINSERT INTO project.people (user_id, description)\n\t\tVALUES ('{$user_id}', '{$description}')";
db_exec($sql) or errDie("Unable to add person.");
}
$OUTPUT = "<h3>{$page_option} Person</h3>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Write</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><li>Successfully saved the person to cubit.</li></td>\n\t\t</tr>\n\t</table>";
return $OUTPUT;
}
示例13: write
function write()
{
extract($_REQUEST);
require_lib("validate");
$v = new validate();
$v->isOk($hd_perc, "num", 1, 9, "Invalid half day rate.");
if ($v->isError()) {
return enter($v->genErrors());
}
$sql = "SELECT value FROM cubit.settings WHERE constant='HD_PERC'";
$rslt = db_exec($sql) or errDie("Unable to retrieve percentage.");
if (pg_num_rows($rslt)) {
$sql = "\n\t\tUPDATE cubit.settings SET value='{$hd_perc}'\n\t\tWHERE constant='HD_PERC'";
} else {
$sql = "\n\t\tINSERT INTO cubit.settings (constant, value)\n\t\t\tVALUES ('HD_PERC', '{$hd_perc}')";
}
db_exec($sql) or errDie("Unable to update half day rate.");
$msg = "<li class='yay'>Successfully saved half day rate.</li>";
return enter($msg);
}
示例14: confirm
function confirm($_POST)
{
extract($_POST);
// Validate
require_lib("validate");
$v = new validate();
$v->isOk($ws_cond, "string", 1, 1024, "Invalid display notice.");
// Did we get any errors?
if ($v->isError()) {
$confirm = "";
$errors = $v->getErrors();
foreach ($errors as $e) {
$confirm .= "<li class=err>{$e['msg']}</li>";
}
return enter($confirm);
}
// Layout
$OUTPUT = "<h3>Workshop Settings</h3>\n\t<form method=post action='" . SELF . "'>\n\t<input type=hidden name=key value='write'>\n\t<input type=hidden name=ws_cond value='{$ws_cond}'>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t <tr>\n\t <th colspan=2>Confirm</td>\n\t </tr>\n\t <tr class='bg-odd'>\n\t <td>Default workshop conditions</td>\n\t <td>" . nl2br($ws_cond) . "</td>\n\t </tr>\n\t <tr>\n\t <td colspan=2 align=right>\n\t <input type=submit name=key value='« Correction'>\n\t <input type=submit value='Write »'>\n\t </td>\n\t </tr>\n\t</table>";
return $OUTPUT;
}
示例15: write
function write()
{
extract($_REQUEST);
if (!preg_match("/(png|jpg|gif)\$/", $_FILES["file"]["name"])) {
$msg = "<li class='err'>We only accept images of type png, jpg or gif</li>";
return enter($sorder_num, $msg);
}
$fp = fopen($_FILES["file"]["tmp_name"], "rb");
$buf = "";
while (!feof($fp)) {
$buf .= fread($fp, 1024);
}
$file = base64_encode($buf);
$sql = "INSERT INTO cubit.pslip_signed_files (file) VALUES ('{$file}')";
db_exec($sql) or errDie("Unable to add signed invoice.");
$id = pglib_lastid("cubit.pslip_signed_files", "id");
$sql = "\n\t\tINSERT INTO cubit.pslip_signed_index (\n\t\t\tid, file_name, file_type, sordid\n\t\t) VALUES (\n\t\t\t'{$id}', '" . $_FILES["file"]["name"] . "', '" . $_FILES["file"]["type"] . "', '{$sordid}'\n\t\t)";
db_exec($sql) or errDie("Unable to add signed invoice index.");
$OUTPUT = "\n\t\t<h3>Signed Invoice</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Write</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><li>Signed Invoice Successfully Added.</li></td>\n\t\t\t</tr>\n\t\t</table>";
return $OUTPUT;
}