本文整理汇总了PHP中show_form函数的典型用法代码示例。如果您正苦于以下问题:PHP show_form函数的具体用法?PHP show_form怎么用?PHP show_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_teacher_POST
function add_teacher_POST()
{
$name = _post('name');
$gender = _post('gender');
$description = _post('description');
if ($name && $gender) {
$teacher = Teacher::create(compact('name', 'gender', 'description'));
redirect('teacher/' . $teacher->id);
} else {
show_form();
}
}
示例2: add_course_POST
function add_course_POST()
{
$name = _post('name');
$teacher = _post('teacher');
$description = _post('description');
if ($name && $teacher) {
$course = Course::create(compact('name', 'teacher', 'description'));
redirect('course/' . $course->id);
} else {
show_form();
}
}
示例3: mode_show
function mode_show()
{
//書き込みフォームを表示
show_form();
//データの書き込み
$log = load_date();
//ログを表示
echo "<ul>";
foreach ($log as $i) {
$name = htmlspecialchars($i["name"]);
$body = htmlspecialchars($i["body"]);
echo "<li><b style='color:red;'>{$name}</b>:{$body}</li>\n";
}
echo "</ul>";
}
示例4: process_form
function process_form()
{
//print results
$nbr1 = intval($_POST['nbr1']);
$nbr2 = intval($_POST['nbr2']);
$operator = $_POST['operator'];
if ($operator == 'A') {
$result = $nbr1 + $nbr2;
} elseif ($operator == 'S') {
$result = $nbr1 - $nbr2;
} elseif ($operator == 'M') {
$result = $nbr1 * $nbr2;
} else {
$result = $nbr1 / $nbr2;
}
print 'Result: ' . $result;
//show form again for another round!
show_form();
}
示例5: adminForgot
function adminForgot($title)
{
if (check_login()) {
header("location:./?sub");
} else {
include 'config/db.php';
include 'config/settings.php';
include 'config/globals.php';
$dbname = $branchyear . '_Users';
$table = $branchyear . '_Students';
$table1 = $branchyear . '_Admins';
//if(!mysql_select_db($dbname)) die(mysql_error());
echo "<!DOCTYPE html>\n<html>\n";
display_headers($title);
echo "\n<body>";
menu1("adminforgot.php", "Forgot Password", "unlock");
show_form();
}
}
示例6: process_form
function process_form()
{
// Connect to database
require_once "_dbConfig.php";
// Save data from the submitted variables as shorter variables
$firstname = cleanText($_POST['firstname']);
$lastname = cleanText($_POST['lastname']);
// Insert all the data from above into the table in the database
$sql = "INSERT INTO users (firstname, lastname) VALUES ('{$firstname}', '{$lastname}')";
$result = mysql_query($sql);
// If it worked, say so...
if ($result) {
$message = "Successfully inserted";
} else {
$message = "There was an error";
}
// If the form was submitted with a PDF, just show a clean confirmation page. Otherwise, show page with message
if ($_POST['submitted'] == "pdf") {
echo $message . "! Thanks!";
} else {
show_form($message);
}
}
示例7: do_add_page
function do_add_page()
{
if ($_POST['xsrf_token'] != $_SESSION['xsrf_token']) {
trigger_error('XSRF code incorrect', E_USER_ERROR);
}
$name = $_POST['name'];
$content = $_POST['content'];
if ($name == '') {
show_form('Please choose a name for the page');
}
if (strlen($name) > 25) {
show_form('The page name may not be longer than 25 characters');
}
if (strlen($content) > 20000) {
show_form('The content may not be longer than 20,000 characters');
}
// ** VALIDATION COMPLETE ** \\
$row = DB::queryFirstRow('SELECT MIN(order_num - 1) AS new_order FROM pages');
$new_order = $row['new_order'];
DB::queryRaw('INSERT INTO pages (name, content, order_num) VALUES ("' . mysqli_real_escape_string(DB::get(), $name) . '", "' . mysqli_real_escape_string(DB::get(), $content) . '", "' . mysqli_real_escape_string(DB::get(), $new_order) . '")');
$row = DB::queryFirstRow('SELECT page_id FROM pages WHERE order_num="' . mysqli_real_escape_string(DB::get(), $new_order) . '"');
header('Location: View?ID=' . $row['page_id']);
}
示例8: do_edit_page
function do_edit_page()
{
if ((int) $_GET['ID'] == -1) {
trigger_error('Cannot edit Registration page', E_USER_ERROR);
}
if ($_POST['xsrf_token'] != $_SESSION['xsrf_token']) {
trigger_error('XSRF code incorrect', E_USER_ERROR);
}
$name = $_POST['name'];
$content = $_POST['content'];
if ($name == '') {
show_form('Please choose a name for the page');
}
if (strlen($name) > 25) {
show_form('The page name may not be longer than 25 characters');
}
str_replace($content, "{INDIVCOST}", map_value());
if (strlen($content) > 20000) {
show_form('The content may not be longer than 20,000 characters');
}
// ** VALIDATION COMPLETE ** \\
DB::queryRaw('UPDATE pages SET name="' . mysqli_real_escape_string(DB::get(), $name) . '", content="' . mysqli_real_escape_string(DB::get(), $content) . '" WHERE page_id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '" LIMIT 1');
header('Location: View?ID=' . $_GET['ID']);
}
示例9: main
function main()
{
show_header();
show_form();
show_footer();
}
示例10: VALUES
$dbhost = $_config['db'][1]['dbhost'];
$dbname = $_config['db'][1]['dbname'];
$dbpw = $_config['db'][1]['dbpw'];
$dbuser = $_config['db'][1]['dbuser'];
$tablepre = $_config['db'][1]['tablepre'];
$db->connect($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
$db->query("REPLACE INTO {$tablepre}user (uid, username,nickname, password, adminid, groupid, email, regdate,salt,authstr) VALUES ('{$uid}', '{$username}', '{$nickname}','{$password}', '1', '1', '{$email}', '" . time() . "','{$salt}','');");
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}user");
$totalmembers = $db->result($query, 0);
$userstats = array('totalmembers' => $totalmembers, 'newsetuser' => $username);
$ctype = 1;
$data = addslashes(serialize($userstats));
$db->query("REPLACE INTO {$tablepre}syscache (cname, ctype, dateline, data) VALUES ('userstats', '{$ctype}', '" . time() . "', '{$data}')");
header("location: index.php?step=5");
}
show_form($form_admin_init_items, $error_msg);
} elseif ($method == 'ext_info') {
@touch($lockfile);
@unlink(ROOT_PATH . './install/index.php');
show_header();
echo '<iframe src="../misc.php?mod=syscache" style="display:none;"></iframe>';
echo '<h3>恭喜!安装成功</h3>';
echo '<h4 class="red">为了安全起见,请手工删除"./install/index.php"文件</h4>';
echo '<div style="text-align:right;width:80%;padding-top:50px;"><a href="' . $bbserver . '" class="button" ><input type="button" value="进入桌面"></a></div>';
show_footer();
} elseif ($method == 'install_check') {
if (file_exists($lockfile)) {
show_msg('installstate_succ');
} else {
show_msg('lock_file_not_touch', $lockfile, 0);
}
示例11: do_showdelete
function do_showdelete()
{
global $curr_abspath, $curr_relpath, $hce_curr_displaypath;
$page_title = sprintf(_("Delete an item from folder %s"), $hce_curr_displaypath);
output_header($page_title);
echo "<h1>{$page_title}</h1>\n";
$item_name = @$_POST['item_name'];
confirm_is_local('FD', $item_name);
$item_path = "{$curr_abspath}/{$item_name}";
// Set up the appropriate descriptor string for the requested delete
if (is_file($item_path)) {
$question_template = _("Are you sure you want to delete the file %s?");
} else {
if (is_dir($item_path)) {
$question_template = _("Are you sure you want to delete the folder %s?");
} else {
// Shouldn't happen
fatal_error(_("Unable to determine status of delete request."));
}
}
$form_content = "<p style='margin-top: 0em;'>";
$form_content .= _("<b>Warning:</b> Deletion is permanent and cannot be undone.") . " ";
$form_content .= _("This script does not check that folders are empty.</p>");
$form_content .= "<p><b>" . sprintf($question_template, "<input type='text' name='del_file' size='50' maxsize='50' value='" . attr_safe($item_name) . "' READONLY>") . "</b></p>";
show_form('delete', $curr_relpath, $form_content, _("Delete"));
show_return_link();
}
示例12: process_form
function process_form()
{
// INITIAL DATA FETCHING
global $name, $email, $cell, $yog, $mailings;
// so that the show_form function can use these values later
$name = htmlentities(ucwords(trim(strtolower($_POST['name']), ' \\-\'')));
foreach (array('-', '\'') as $delimiter) {
if (strpos($name, $delimiter) !== false) {
$name = implode($delimiter, array_map('ucfirst', explode($delimiter, $name)));
}
}
// forces characters after spaces, hyphens and apostrophes to be capitalized
$name = preg_replace('/[\\s\']*\\-+[\\s\']*/', '-', $name);
// removes hyphens not between two characters
$name = preg_replace('/[\\s\\-]*\'+[\\s\\-]*/', '\'', $name);
// removes apostrophes not between two characters
$name = preg_replace('/\\s+/', ' ', $name);
// removes multiple consecutive spaces
$name = preg_replace('/\\-+/', '-', $name);
// removes multiple consecutive hyphens
$name = preg_replace('/\'+/', '\'', $name);
// removes multiple consecutive apostrophes
$email = htmlentities(strtolower($_POST['email']));
$cell = htmlentities($_POST['cell']);
$yog = $_POST['yog'];
$pass = $_POST['pass1'];
$mailings = '0';
if ($_POST['mailings'] == 'Yes') {
$mailings = '1';
}
// CHECK THAT THE NAME IS VALID
if (($name = sanitize_username($name)) === false) {
alert('Your name must have only letters, hyphens, apostrophes, and spaces, and be between 3 and 30 characters long', -1);
show_form();
return;
}
if (strpos($name, ' ') == false) {
alert('Please enter both your first <span class="i">and</span> last name', -1);
show_form();
return;
}
// CHECK THAT THE EMAIL ADDRESS IS VALID
if (!val('e', $email)) {
alert('That\'s not a valid email address', -1);
show_form();
return;
}
// CHECK AND FORMAT CELL PHONE NUMBER
if ($cell != '' && ($cell = format_phone_number($cell)) === false) {
//Validate the format of the cell phone number (if it's not left blank)
alert('That\'s not a valid cell phone number', -1);
show_form();
return;
}
// CHECK THAT THE YOG IS VALID
$grade = intval(getGradeFromYOG($yog));
if ($grade < 9 || $grade > 12) {
alert('That is not a valid YOG (' . $grade . 'you have to be in high school)', -1);
show_form();
return;
}
// CHECK THAT THE PASSWORDS MATCH, MEET MINIMUM LENGTH
if ($pass != $_POST['pass2']) {
alert('The passwords that you entered do not match', -1);
show_form();
return;
}
if (strlen($pass) < 6) {
alert('Please choose a password that has at least 6 characters', -1);
show_form();
return;
}
// CHECK THAT THEY ENTERED THE RECAPTCHA CORRECTLY
// CURRENTLY BROKEN: NEED TO UPDATE RECAPTCHA
/*
$recaptcha_msg = validate_recaptcha();
if ($recaptcha_msg !== true) {
alert($recaptcha_msg, -1);
show_form();
return;
}
*/
// CHECK THAT AN ACCOUNT WITH THAT EMAIL DOES NOT ALREADY EXIST
// this is done *after* checking the reCaptcha to prevent bots from harvesting our email
// addresses via a brute-force attack.
if (DBExt::queryCount('users', 'LOWER(email)=LOWER(%s)', $email) != 0) {
alert('An account with that email address already exists', -1);
show_form();
return;
}
// CHECK THAT AN ACCOUNT WITH THE SAME NAME IN THE SAME GRADE DOES NOT EXIST
// - with the exception that if it's permissions = 'E', they probably mistyped their email and are redoing it.
if (DBExt::queryCount('users', 'LOWER(name)=%s AND yog=%i AND permissions!="E"', strtolower($name), $yog) != 0) {
alert('An account in your grade with that name already exists', -1);
show_form();
return;
}
// ** All information has been validated at this point **
$verification_code = generate_code(5);
// for verifying ownership of the email address
//.........这里部分代码省略.........
示例13: array
$totalmembers = $db->result($query, 0);
$userstats = array('totalmembers' => $totalmembers, 'newsetuser' => $username);
$ctype = 1;
$data = addslashes(serialize($userstats));
$db->query("REPLACE INTO {$tablepre}common_syscache (cname, ctype, dateline, data) VALUES ('userstats', '{$ctype}', '" . time() . "', '{$data}')");
touch($lockfile);
VIEW_OFF && show_msg('initdbresult_succ');
if (!VIEW_OFF) {
echo '<script type="text/javascript">function setlaststep() {document.getElementById("laststep").disabled=false;window.location=\'index.php?method=ext_info\';}</script><script type="text/javascript">setTimeout(function(){window.location=\'index.php?method=ext_info\'}, 30000);</script><iframe src="../misc.php?mod=initsys" style="display:none;" onload="setlaststep()"></iframe>' . "\r\n";
show_footer();
}
}
if (VIEW_OFF) {
show_msg('missing_parameter', '', 0);
} else {
show_form($form_db_init_items, $error_msg);
}
} elseif ($method == 'ext_info') {
@touch($lockfile);
if (VIEW_OFF) {
show_msg('ext_info_succ');
} else {
show_header();
echo '</div><div class="main" style="margin-top: -123px;"><ul style="line-height: 200%; margin-left: 30px;">';
echo '<li><a href="../">' . lang('install_succeed') . '</a><br>';
echo '<script>setTimeout(function(){window.location=\'../\'}, 2000);</script>' . lang('auto_redirect') . '</li>';
echo '</ul></div>';
show_footer();
}
} elseif ($method == 'install_check') {
if (file_exists($lockfile)) {
示例14: explode
$reputationid = 0;
$time_offset = 0;
$a = explode(",", gmdate("Y,n,j,G,i,s", time() + $time_offset));
$now_date = array('year' => $a[0], 'mon' => $a[1], 'mday' => $a[2], 'hours' => $a[3], 'minutes' => $a[4], 'seconds' => $a[5]);
switch ($input['mode']) {
case 'modify':
show_level();
break;
case 'add':
show_form('new');
break;
case 'doadd':
do_update('new');
break;
case 'edit':
show_form('edit');
break;
case 'doedit':
do_update('edit');
break;
case 'doupdate':
do_update();
break;
case 'dodelete':
do_delete();
break;
case 'list':
view_list();
break;
case 'dolist':
do_list();
示例15: end_table
if (!in_rops()) {
echo "<td><input class=\"btn btn-default\" type=submit name=submit value=Update></td>";
} else {
echo "<td> </td>";
}
echo "</tr></form>";
}
end_table();
// Entry form to create a new application
//
if (in_rops()) {
return;
}
echo "<P>\n <h2>Add an application</h2>\n To add an application enter the short name and description\n ('user friendly name') below. You can then edit the\n application when it appears in the table above.\n <p>\n <form action={$action_url} method=POST>\n ";
start_table("align='center' ");
table_header("Name", "Description", " ");
echo "<TR>\n <TD> <input type='text' size='12' name='add_name' value=''></TD>\n <TD> <input type='text' size='35' name='add_user_friendly_name' value=''></TD>\n <TD align='center' >\n <input type='submit' name='add_app' value='Add Application'></TD>\n </TR>\n";
end_table();
echo "</form><p>\n";
}
admin_page_head("Manage applications");
$all = get_int('all', true);
if (post_str('add_app', true)) {
add_app();
} else {
if (post_str('submit', true)) {
do_updates();
}
}
show_form($all);
admin_page_tail();