本文整理汇总了PHP中display_form函数的典型用法代码示例。如果您正苦于以下问题:PHP display_form函数的具体用法?PHP display_form怎么用?PHP display_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
protected function main()
{
$this->set_title(Nw::$lang['contact']['contact']);
$this->add_css('forms.css');
$this->set_filAriane(array(Nw::$lang['contact']['contact'] => array('')));
$this->set_tpl('contact/contact.html');
$this->load_lang_file('users');
$this->add_form('contenu');
//Si on veut envoyer le mail
if (isset($_POST['submit'])) {
if (empty($_POST['pseudo'])) {
$msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_pseudo']);
} elseif (empty($_POST['mail'])) {
$msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_mail']);
} elseif (empty($_POST['sujet'])) {
$msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_sujet']);
} elseif (empty($_POST['contenu'])) {
$msg_error = sprintf(Nw::$lang['contact']['error_empty'], Nw::$lang['contact']['_contenu']);
} elseif ($_POST['code_cap'] != $_SESSION['cap_nw']) {
$msg_error = Nw::$lang['users']['wrong_antispam'];
}
if (!empty($msg_error)) {
display_form(array('pseudo' => $_POST['pseudo'], 'mail' => $_POST['mail'], 'sujet' => $_POST['sujet'], 'contenu' => $_POST['contenu'], 'captcha' => $_POST['captcha'], 'nom' => $_POST['nom'], 'code_cap' => ''), $msg_error);
} else {
inc_lib('mail/email_contact');
if (email_contact($_POST['mail'], $_POST['pseudo'], $_POST['nom'], '[Contact] ' . $_POST['sujet'], $_POST['contenu'], get_ip())) {
redir(Nw::$lang['contact']['redir_ok'], true, 'contact.html');
}
}
} else {
display_form(array('pseudo' => is_logged_in() ? Nw::$dn_mbr['u_pseudo'] : '', 'mail' => is_logged_in() ? Nw::$dn_mbr['u_email'] : '', 'sujet' => '', 'contenu' => '', 'captcha' => '', 'nom' => '', 'code_cap' => ''));
}
}
示例2: main
protected function main()
{
$this->set_title(Nw::$site_slogan);
$this->set_tpl('mobile/users/login.html');
$this->load_lang_file('users');
// Si le membre est déjà connecté
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, 'mobile-2.html');
}
//Si on a soumis le formulaire
if (!multi_empty(trim($_POST['nw_nickname']), trim($_POST['nw_password']))) {
$array_post = array('pseudo' => $_POST['nw_nickname'], 'remember' => isset($_POST['nw_remember']));
//On vérifie que la paire pseudo/mot de passe existe
inc_lib('users/get_info_account');
if ($dn_info_account = get_info_account($_POST['nw_nickname'], $_POST['nw_password'])) {
//Si le compte est actif
if ($dn_info_account['u_active'] == 1) {
$link_redir = 'mobile-2.html';
$connex_auto = 1;
inc_lib('users/connect_auto_user');
connect_auto_user($dn_info_account['u_id'], $_POST['nw_password'], $connex_auto);
// On redirige le membre
redir(sprintf(Nw::$lang['users']['welcome_user'], $_POST['nw_nickname']), true, $link_redir);
} else {
display_form($array_post, Nw::$lang['users']['not_active']);
}
return;
} else {
display_form($array_post, Nw::$lang['users']['account_no_exist']);
}
return;
}
display_form(array('pseudo' => '', 'remember' => true));
Nw::$tpl->set('INC_HEAD', empty($_SERVER['HTTP_AJAX']));
}
示例3: route_request
function route_request()
{
$cmd = strtolower(grab_request_var("cmd"));
// token if required for most everyting
if ($cmd != "" && $cmd != "hello") {
check_token();
}
//echo "CMD='$cmd'<BR>";
switch ($cmd) {
// say hello
case "hello":
say_hello();
break;
// display a form for debugging/testing
// display a form for debugging/testing
case "":
display_form();
break;
default:
//echo "PASSING TO PLUGINS<BR>";
// let plugins handle the output
$args = array("cmd" => $cmd);
do_callbacks(CALLBACK_PROCESS_REQUEST, $args);
break;
}
echo "NO REQUEST HANDLER";
exit;
}
示例4: create_guest
function create_guest($vars = '')
{
global $db, $config, $t;
settype($vars, 'array');
$errors = array();
$vars = get_input_vars();
if (!strlen($vars['guest_name'])) {
$errors[] = "'Name' is a required field";
}
if (!strlen($vars['guest_email'])) {
$errors[] = "'Email' is a required field";
}
if ($errors) {
$t->assign('errors', $errors);
display_guest_list();
display_form($vars);
return;
}
//check member
$is_member = $db->users_find_by_string($vars['guest_email'], 'email', 1) ? true : false;
if (!$is_member) {
$q = $db->query($s = "\n\t INSERT INTO {$db->config['prefix']}newsletter_guest\n\t (guest_id,guest_name,guest_email)\n\t VALUES (null, '" . $db->escape($vars['guest_name']) . "', '" . $db->escape($vars['guest_email']) . "')\n\t ");
$guest_id = mysql_insert_id($db->conn);
$db->add_guest_threads($guest_id, $vars['threads']);
}
$t->assign('link', "newsletter_guests.php");
$t->display("admin/newsletter_guest_saved.html");
}
示例5: occur_form
function occur_form()
{
global $vars;
if (empty($vars["submit_form"])) {
return display_form();
}
// else
return process_form();
}
示例6: user_groups
function user_groups()
{
global $vars, $phpc_cal;
if (!$phpc_cal->can_admin()) {
return tag('div', __('Permission denied'));
}
if (!empty($vars['submit_form'])) {
process_form();
}
return display_form();
}
示例7: user_create
function user_create()
{
global $vars;
if (!is_admin()) {
return tag('div', __('Permission denied'));
}
if (!empty($vars['submit_form'])) {
process_form();
}
return display_form();
}
示例8: main
protected function main()
{
if (is_logged_in() && check_auth('manage_groups')) {
// Edition d'un groupe
if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
// On cherche les infos du groupe
inc_lib('admin/get_info_grp');
$donnees_groupe = get_info_grp($_GET['id']);
$form_id = $_GET['id'];
$form_name = $donnees_groupe['g_nom'];
$form_title = $donnees_groupe['g_titre'];
$form_icone = $donnees_groupe['g_icone'];
$form_color = $donnees_groupe['g_couleur'];
// Fil ariane
$this->set_filAriane(array(Nw::$lang['admin']['fa_admin'] => array('admin.html'), Nw::$lang['admin']['fa_grp'] => array('admin-299.html'), $donnees_groupe['g_nom'] => array('admin-300-' . $_GET['id'] . '.html'), Nw::$lang['admin']['fa_edit_grp'] => array('')));
} else {
$form_id = 0;
$form_name = '';
$form_title = '';
$form_icone = 0;
$form_color = 0;
// Fil ariane
$this->set_filAriane(array(Nw::$lang['admin']['fa_admin'] => array('admin.html'), Nw::$lang['admin']['fa_grp'] => array('admin-299.html'), Nw::$lang['admin']['fa_new_grp'] => array('')));
}
$this->set_tpl('admin/edit_grp.html');
$this->add_css('forms.css');
$this->set_title(Nw::$lang['admin']['titre_accueil']);
// Formulaire soumis
if (isset($_POST['submit'])) {
$array_post = array('nom' => $_POST['nom'], 'titre' => $_POST['titre'], 'icone' => $_POST['icone'], 'couleur' => isset($_POST['couleur']) ? 1 : 0);
// Les champs titre & contenu ne sont pas vides
if (!multi_empty(trim($_POST['nom']))) {
// Edition d'un groupe
if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
inc_lib('admin/edit_grp');
edit_grp($_GET['id']);
redir(Nw::$lang['admin']['confirm_edit_grp'], true, 'admin-300-' . $_GET['id'] . '.html');
} else {
inc_lib('admin/add_grp');
$id_new_grp = add_grp();
redir(Nw::$lang['admin']['confirm_new_grp'], true, 'admin-310-' . $id_new_grp . '.html');
}
} else {
display_form($array_post, Nw::$lang['admin']['nom_grp_obligatoire']);
}
return;
}
// On affiche le template
display_form(array('id' => $form_id, 'nom' => $form_name, 'titre' => $form_title, 'icone' => $form_icone, 'couleur' => $form_color));
} else {
redir(Nw::$lang['admin']['error_cant_see_admin'], false, './');
}
}
示例9: occur_form
function occur_form()
{
global $vars;
if (empty($vars["submit_form"])) {
return display_form();
}
// else
try {
return process_form();
} catch (Exception $e) {
message($e->getMessage());
return display_form();
}
}
示例10: main
/**
* Formulaire de connexion à l'espace membre
* @author Cam
* @return tpl
*/
protected function main()
{
// Si le membre est déjà connecté
if (is_logged_in()) {
redir(Nw::$lang['common']['already_connected'], false, './');
}
// On modifie le titre de la page
$this->set_title(Nw::$lang['users']['title_connexion']);
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'users-10.html') === false) {
$_SESSION['nw_referer_login'] = $_SERVER['HTTP_REFERER'];
}
// Affichage du template
$this->add_css('forms.css');
$this->set_tpl('membres/login.html');
// Fil ariane
$this->set_filAriane(Nw::$lang['users']['fa_connexion']);
//Si on a soumis le formulaire
if (isset($_POST['submit'])) {
$array_post = array('pseudo' => $_POST['nw_nickname'], 'remember' => isset($_POST['nw_remember']));
//On vérifie que les deux champs sont remplis
if (!multi_empty(trim($_POST['nw_nickname']), trim($_POST['nw_password']))) {
//wtf ? =D
//echo 'oook';
//On vérifie que la paire pseudo/mot de passe existe
inc_lib('users/get_info_account');
if ($dn_info_account = get_info_account($_POST['nw_nickname'], $_POST['nw_password'])) {
//Si le compte est actif
if ($dn_info_account['u_active'] == 1) {
$link_redir = !empty($_SESSION['nw_referer_login']) ? $_SESSION['nw_referer_login'] : './';
$connex_auto = (bool) isset($_POST['nw_remember']);
inc_lib('users/connect_auto_user');
connect_auto_user($dn_info_account['u_id'], $_POST['nw_password'], $connex_auto);
// On redirige le membre
redir(sprintf(Nw::$lang['users']['welcome_user'], $_POST['nw_nickname']), true, $link_redir);
} else {
display_form($array_post, Nw::$lang['users']['not_active']);
}
return;
} else {
display_form($array_post, Nw::$lang['users']['account_no_exist']);
}
return;
} else {
display_form($array_post, Nw::$lang['users']['champ_obligatoire']);
}
return;
}
display_form(array('pseudo' => '', 'remember' => true));
}
示例11: _moduleContent
function _moduleContent(&$smarty, $module_name)
{
//global variables
global $arrConf;
global $arrConfModule;
$arrConf = array_merge($arrConf, $arrConfModule);
//folder path for custom templates
$local_templates_dir = getWebDirModule($module_name);
switch (getParameter('action')) {
case 'csvdownload':
return download_csv($smarty);
default:
return display_form($smarty, $module_name, $local_templates_dir);
}
}
示例12: display_customer_form
function display_customer_form()
{
$customer_labels = array('Name');
$address_labels = array('Street', 'City', 'State', 'Zip');
$payment_labels = array('Bank', 'Account', 'SecurityCode');
echo '</br><b>Enter your details:</b></br></br>';
echo '<form method=POST action="submit_order.php">';
table_start();
display_form($customer_labels);
display_form($address_labels);
display_form($payment_labels);
table_end();
echo '<input type=submit name="Order" value="Submit Order"/></br>';
echo '</form>';
}
示例13: submit_photo
function submit_photo()
{
$dir = "../images";
$pid = intval(get_http_var('pid'));
$errors = array();
if (!array_key_exists('photo', $_FILES)) {
array_push($errors, 'Not got the photo.');
} elseif ($_FILES['photo']['error'] > 0) {
array_push($errors, 'There was an error uploading the photo.');
} elseif (!is_uploaded_file($_FILES['photo']['tmp_name'])) {
array_push($errors, 'Did not get an uploaded file.');
} else {
$tmp_name = $_FILES['photo']['tmp_name'];
$image = imagick_readimage($tmp_name);
if (!$image) {
array_push($errors, 'Failed to read image from uploaded file');
}
$imageS = imagick_clonehandle($image);
if (!imagick_scale($image, 118, 118, false)) {
array_push($errors, 'Scaling large failed');
}
if (!imagick_scale($imageS, 59, 59, false)) {
array_push($errors, 'Scaling small failed');
}
if (!imagick_writeimage($image, "{$dir}/mpsL/{$pid}.jpeg")) {
array_push($errors, "Saving to {$dir}/mpsL/{$pid}.jpeg failed");
}
if (!imagick_writeimage($imageS, "{$dir}/mps/{$pid}.jpeg")) {
array_push($errors, "Saving to {$dir}/mps/{$pid}.jpeg failed");
}
if (!$errors) {
print "<pre>";
chdir("{$dir}/mpsL");
passthru("cvs -Q add -kb {$pid}.jpeg 2>&1");
chdir("../mps");
passthru("cvs -Q add -kb {$pid}.jpeg 2>&1");
chdir("../");
passthru('cvs -Q commit -m "Photo update from admin web photo upload interface." mpsL mps 2>&1');
print "</pre>";
}
}
if ($errors) {
return display_form($errors);
}
return "<p><em>Photo uploaded and resized for pid {$pid}</em> — check how it looks <a href=\"/mp?p={$pid}\">on their page</a></p>" . display_form();
}
示例14: main
protected function main()
{
if (!is_logged_in()) {
redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
}
// Si le paramètre ID manque
if (empty($_GET['id']) || !is_numeric($_GET['id'])) {
header('Location: ./');
}
inc_lib('news/news_exists');
$count_news_existe = news_exists($_GET['id']);
if ($count_news_existe == false) {
redir(Nw::$lang['news']['news_not_exist'], false, 'news-70.html');
}
// Récupération des données de la news
inc_lib('news/get_info_news');
$donnees_news = get_info_news($_GET['id']);
$droit_delete_news = $donnees_news['n_id_auteur'] == Nw::$dn_mbr['u_id'] && Nw::$droits['can_delete_mynews'] || Nw::$droits['can_delete_news'] ? true : false;
if (!$droit_delete_news) {
redir(Nw::$lang['news']['not_allowed_delete'], false, 'news-70.html');
}
// Pour rediriger le visiteur d'où il est venu
if (!empty($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url) !== false && strpos($_SERVER['HTTP_REFERER'], Nw::$site_url . 'news-65-' . $_GET['id'] . '.html') === false) {
$_SESSION['nw_referer_edit'] = $_SERVER['HTTP_REFERER'];
}
$link_redir = !empty($_SESSION['nw_referer_edit']) ? $_SESSION['nw_referer_edit'] : 'news-70.html';
$this->set_title(sprintf(Nw::$lang['news']['title_del_news'], $donnees_news['n_titre']));
$this->set_tpl('news/delete.html');
$this->add_css('forms.css');
$this->add_js('ajax.js');
$this->add_js('admin.js');
$this->add_form('contenu');
// Fil ariane
$this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), $donnees_news['c_nom'] => array($donnees_news['c_rewrite'] . '/'), $donnees_news['n_titre'] => array($donnees_news['c_rewrite'] . '/' . rewrite($donnees_news['n_titre']) . '-' . $_GET['id'] . '/'), Nw::$lang['news']['field_delete_news'] => array('')));
// Formulaire soumis
if (isset($_POST['submit'])) {
inc_lib('news/delete_news');
delete_news($_GET['id']);
redir(Nw::$lang['news']['news_deleted'], true, rtrim(Nw::$site_url, '/') . '/news-70.html');
}
if (isset($_POST['no'])) {
header('Location: ' . $link_redir);
}
Nw::$tpl->set(array('ID' => $_GET['id'], 'TITRE' => $donnees_news['n_titre'], 'PHRASE_DEL' => sprintf(Nw::$lang['news']['phrase_del_news'], $donnees_news['c_rewrite'], rewrite($donnees_news['n_titre']), $_GET['id'], $donnees_news['n_titre'])));
display_form(array('contenu' => ''));
}
示例15: check_response
function check_response($dbh)
{
$name = script_param("name");
$place = script_param("place");
$choices = script_param("choices");
$response = script_param("response");
# Is the user's response the correct birthplace?
if ($response == $place) {
print "That is correct!<br />\n";
printf("%s was born in %s.<br />\n", htmlspecialchars($name), htmlspecialchars($place));
print "Try the next question:<br /><br />\n";
present_question($dbh);
} else {
printf("\"%s\" is not correct. Please try again.<br /><br />\n", htmlspecialchars($response));
$choices = explode("#", $choices);
display_form($name, $place, $choices);
}
}