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' => ''));
     }
 }
 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']));
 }
Exemple #3
0
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;
}
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");
}
Exemple #5
0
function occur_form()
{
    global $vars;
    if (empty($vars["submit_form"])) {
        return display_form();
    }
    // else
    return process_form();
}
Exemple #6
0
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();
}
function user_create()
{
    global $vars;
    if (!is_admin()) {
        return tag('div', __('Permission denied'));
    }
    if (!empty($vars['submit_form'])) {
        process_form();
    }
    return display_form();
}
 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, './');
     }
 }
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();
    }
}
 /**
  *  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));
 }
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);
    }
}
Exemple #12
0
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>';
}
Exemple #13
0
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> &mdash; check how it looks <a href=\"/mp?p={$pid}\">on their page</a></p>" . display_form();
}
 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' => ''));
 }
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);
    }
}
Exemple #16
0
function do_process()
{
    global $HTTP_POST_VARS;
    $cond_array = array();
    for ($x = 0; $x < count($HTTP_POST_VARS['term']); $x++) {
        $cond_array[] = array("text" => $HTTP_POST_VARS['term'][$x], "loc" => $HTTP_POST_VARS['location'][$x], "conn" => ($x > 0 and isset($HTTP_POST_VARS['connection'][$x - 1])) ? $HTTP_POST_VARS['connection'][$x - 1] : "");
    }
    if (isset($HTTP_POST_VARS['find'])) {
        search($cond_array);
        exit;
    }
    if ($HTTP_POST_VARS['buildaction'] == "add_condition") {
        $cond_array[] = array("text" => "", "loc" => "", "conn" => "a");
    }
    if (preg_match('/^erase_condition_([0-9]+)$/', $HTTP_POST_VARS['buildaction'], $matches)) {
        unset($cond_array[$matches[1]]);
    }
    display_form($HTTP_POST_VARS, $cond_array);
}
Exemple #17
0
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 = new Imagick();
        $image->readImage($tmp_name);
        if (!$image)
            array_push($errors, 'Failed to read image from uploaded file');
            $imageS = $image->clone();
        if (!$image->scaleImage(0, 118))
            array_push($errors, 'Scaling large failed');
        if (!$imageS->scaleImage(0, 59))
            array_push($errors, 'Scaling small failed');
        if (!$image->writeImage("$dir/mpsL/$pid.jpeg"))
            array_push($errors, "Saving to $dir/mpsL/$pid.jpeg failed");
        if (!$imageS->writeImage("$dir/mps/$pid.jpeg"))
            array_push($errors, "Saving to $dir/mps/$pid.jpeg failed");
        if (!$errors) {
            print "<pre>";
            chdir($dir);
            passthru('git pull');
            passthru("git add mpsL/$pid.jpeg");
            passthru("git add mps/$pid.jpeg");
            passthru('git commit -m "Photo update from admin web photo upload interface."');
            passthru('git push');
            print "</pre>";
        }
    }

    if ($errors)
        return display_form($errors);
    return "<p><em>Photo uploaded and resized for pid $pid</em> &mdash; check how it looks <a href=\"/mp?p=$pid\">on their page</a></p>" . display_form();
}
Exemple #18
0
function check_account_exists()
{
    $username = strtolower(trim($_POST['username']));
    $command = "show account {$username}\r\n";
    $sock = fsockopen("127.0.0.1", 9996, $errornumber, $errorstring, 30);
    if (!$sock) {
        die("Error {$errornumber}: {$errorstring}");
    }
    fputs($sock, $command);
    sleep(1);
    $result = fread($sock, 1000);
    fclose($sock);
    if (strpos($result, "Cannot find account")) {
        create_account();
    } else {
        echo "<B><font color=red>That account name is taken, please try again.</font></B><BR>";
        display_form();
    }
}
 protected function main()
 {
     // Seuls les membres peuvent créer des brouillons
     if (!is_logged_in()) {
         redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
     }
     if (!Nw::$droits['can_create_brouillon']) {
         redir(Nw::$lang['news']['cant_create_brouillon'], false, 'news-70.html');
     }
     $this->set_title(Nw::$lang['news']['title_create_brouillon']);
     $this->set_tpl('news/create_brouillon.html');
     $this->add_css('forms.css');
     $this->add_css('code.css');
     $this->add_js(array('write.js', 'jquery.blockUI.js'));
     $this->add_form('contenu');
     // Fil ariane
     $this->set_filAriane(array(Nw::$lang['news']['news_section'] => array('news-70.html'), Nw::$lang['news']['title_create_brouillon'] => array('')));
     Nw::$tpl->set(array('BAL_CHAMP' => 'contenu'));
     // Formulaire soumis
     if (isset($_POST['submit'])) {
         $array_post = array('is_breve' => isset($_POST['is_breve']) ? $_POST['is_breve'] : '', 'titre_news' => $_POST['titre_news'], 'cat' => isset($_POST['cat']) ? $_POST['cat'] : 0, 'contenu' => $_POST['contenu'], 'tags' => isset($_POST['tags']) ? $_POST['tags'] : '', 'private_news' => isset($_POST['private_news']), 'source' => isset($_POST['source']) ? $_POST['source'] : '', 'source_nom' => isset($_POST['source_nom']) ? $_POST['source_nom'] : '');
         // Les champs titre & contenu ne sont pas vides
         if (!multi_empty(trim($_POST['titre_news']), trim($_POST['contenu']))) {
             // On créé la news
             inc_lib('news/add_news_brouillon');
             add_news_brouillon();
             redir(Nw::$lang['news']['brouillon_cree'], true, 'news-70.html');
         } else {
             display_form($array_post, Nw::$lang['news']['title_content_oblig']);
         }
         return;
     }
     // Catégories de news
     foreach (Nw::$cache_categories as $idcs => $donnees_categorie) {
         Nw::$tpl->setBlock('cats_news', array('ID' => $idcs, 'TITRE' => $donnees_categorie[0]));
     }
     // On affiche le template
     display_form(array('is_breve' => '', 'titre_news' => '', 'cat' => 0, 'contenu' => '', 'tags' => '', 'private_news' => 0, 'source' => '', 'source_nom' => ''));
 }
 protected function main()
 {
     if (!is_logged_in()) {
         redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
     }
     $this->set_title(Nw::$lang['users']['item_avatar']);
     $this->set_tpl('membres/options_avatar.html');
     $this->add_css('forms.css');
     $this->set_filAriane(array(Nw::$lang['users']['mes_options_title'] => array('users-60.html'), Nw::$lang['users']['item_avatar'] => array('')));
     if (isset($_GET['delete']) && !empty(Nw::$dn_mbr['u_avatar'])) {
         inc_lib('users/delete_avatar');
         delete_avatar(Nw::$dn_mbr['u_id']);
         redir(Nw::$lang['users']['redir_d_avatar'], true, 'users-62.html');
     }
     if (isset($_POST['submit']) && (!empty($_FILES['file']['name']) || !empty($_POST['url']))) {
         inc_lib('users/edit_avatar_mbr');
         edit_avatar_mbr();
         redir(Nw::$lang['users']['redir_t_avatar'], true, 'users-62.html');
     }
     Nw::$tpl->set(array('AVATAR' => Nw::$dn_mbr['u_avatar']));
     // On affiche le template
     display_form(array('avatar' => Nw::$dn_mbr['u_avatar']));
 }
Exemple #21
0
function register_user()
{
    global $db_server, $db_username, $db_password, $db_database;
    // read input variables
    $name = isset($_POST['name']) ? $_POST['name'] : "";
    $username = isset($_POST['username']) ? $_POST['username'] : "";
    $email = isset($_POST['email']) ? $_POST['email'] : "";
    $password = isset($_POST['password']) ? $_POST['password'] : "";
    // something is missing
    if ($name == "" || $username == "" || $email == "" || $password == "") {
        display_form("One or more input fields are empty", $name, $username, $email, $password);
    } else {
        $mysqli = new mysqli($db_server, $db_username, $db_password, $db_database);
        $stmt = $mysqli->prepare("INSERT INTO reg(name, username, email, password) VALUES(?,?,?,?)");
        $stmt->bind_param('ssss', $name, $username, $email, get_password_hash($password));
        $stmt->execute();
        if ($stmt->affected_rows == 1) {
            echo "Registration successful";
        }
        $stmt->close();
        $mysqli->close();
    }
}
function custom_form_generate($atts)
{
    global $wpdb;
    //allows us to have database tables access
    extract(shortcode_atts(array('invoice_name' => 'stuff', 'invoice_type_id' => 'stuff'), $atts, 'cfg'));
    set_external_js_css($invoice_type_id);
    // add linked js and css files
    /* Form Validation/Submission Handler */
    if ($_POST) {
        if ($invoice_type_id != 17) {
            $error_messages = custom_form_generate_validation($invoice_type_id);
            $form .= $error_messages;
            //output error messages
        }
        if (!$error_messages) {
            $form .= handle_submission($invoice_type_id);
        }
    }
    // if $_POST
    if (!$_POST || $_POST && $error_messages) {
        $form .= display_form($invoice_type_id);
    }
    return $form;
}
 protected function main()
 {
     if (!is_logged_in()) {
         redir(Nw::$lang['common']['need_login'], false, 'users-10.html');
     }
     $this->set_title(Nw::$lang['users']['item_infos_profil']);
     $this->set_tpl('membres/options_profil.html');
     $this->add_css('code.css');
     $this->add_css('forms.css');
     $this->add_js('ajax.js');
     $this->add_js('write.js');
     $this->add_form('contenu');
     $this->set_filAriane(array(Nw::$lang['users']['mes_options_title'] => array('users-60.html'), Nw::$lang['users']['item_infos_profil'] => array('')));
     if (isset($_POST['submit'])) {
         inc_lib('users/edit_profile_mbr');
         edit_profile_mbr();
         redir(Nw::$lang['users']['redir_t_infos_profil'], true, 'users-60.html');
     }
     inc_lib('bbcode/unparse');
     $fuseaux_horaires = array('-13:00:00' => '[UTC - 12] Ile Baker', '-12:00:00' => '[UTC - 11] Iles Midway, Samoa', '-11:00:00' => '[UTC - 10] Hawaii, Iles Cook', '-10:30:00' => '[UTC - 9:30] Iles Marquises', '-10:00:00' => '[UTC - 9] Alaska, Iles Gambier', '-09:00:00' => '[UTC - 8] Pacifique (Etats-unis et Canada), Tijuana', '-08:00:00' => '[UTC - 7] Arizona, Chihuahua, La Paz, Montagnes Rocheuses', '-07:00:00' => '[UTC - 6] Amérique Centrale', '-06:00:00' => '[UTC - 5] Heure de l\'est (Etats-Unis, Canada), Bogota, Lima, Quito', '-05:00:00' => '[UTC - 4] Heure atlantique (Canada), Caracas, La Paz, Santiago', '-04:30:00' => '[UTC - 3:30] Terre Neuve', '-04:00:00' => '[UTC - 3] Amazonie, Groenland central', '-03:00:00' => '[UTC - 2] Fernando de Noronha, Géorgie du Sud &amp; Iles Sandwich', '-02:00:00' => '[UTC - 1] Iles des Açores, Iles du Cap Vert, Groenland oriental', '-01:00:00' => '[UTC] Europe de l\'Ouest, Heure de Greenwich, Dublin, Edimbourg, Lisbonne, Londres', '00:00:00' => '[UTC + 1] Europe Centrale, Bruxelles, Copenhague, Madrid, Paris, Afrique de l\'Est', '01:00:00' => '[UTC + 2] Europe de l\'Est, Bucarest, Helsinki, Kiev, Afrique Centrale, Jérusalem', '02:00:00' => '[UTC + 3] Moscou, Afrique de l\'Est, Koweït, Riyad', '02:30:00' => '[UTC + 3:30] Iran', '03:00:00' => '[UTC + 4] Abu Dhabi, Samara, Seychelles', '03:30:00' => '[UTC + 4:30] Afghanistan', '04:00:00' => '[UTC + 5] Pakistan', '04:30:00' => '[UTC + 5:30] Inde, Sri Lanka', '04:40:00' => '[UTC + 5:45] Népal', '05:00:00' => '[UTC + 6] Bangladesh, Bhutan, Novossibirsk', '05:30:00' => '[UTC + 6:30] Iles Cocos, Birmanie', '06:00:00' => '[UTC + 7] Indochine, Krasnoïarsk, Jakarta', '07:00:00' => '[UTC + 8] Chine, Australie de l\'Ouest, Irkoutsk', '07:45:00' => '[UTC + 8:45] Australie du Sud-ouest', '08:00:00' => '[UTC + 9] Japon, Corée, Taïwan', '08:30:00' => '[UTC + 9:30] Australie Centrale', '09:00:00' => '[UTC + 10] Australie de l\'Est, Vladivostok', '09:30:00' => '[UTC + 10:30] Ile de Lord Howe', '10:00:00' => '[UTC + 11] Iles Salomon, Nouvelle Calédonie', '10:30:00' => '[UTC + 11:30] Norfolk', '11:00:00' => '[UTC + 12] Nouvelle-Zélande, Fidji, Kamchatka', '11:45:00' => '[UTC + 12:45] Iles Chatham', '12:00:00' => '[UTC + 13] Tonga, Iles Phoenix', '13:00:00' => '[UTC + 14] Iles de la ligne');
     Nw::$tpl->set(array('BAL_CHAMP' => 'biographie', 'FUSEAUX' => $fuseaux_horaires));
     // On affiche le template
     display_form(array('decalage_horaire' => !empty(Nw::$dn_mbr['u_decalage']) ? Nw::$dn_mbr['u_decalage'] : '00:00:00', 'date_naissance' => Nw::$dn_mbr['date_naissance'], 'localisation' => Nw::$dn_mbr['u_localisation'], 'biographie' => unparse(Nw::$dn_mbr['u_bio'])));
 }
function create_newsletter($vars = '')
{
    global $db, $config, $t;
    settype($vars, 'array');
    $errors = array();
    $vars = get_input_vars();
    if (!strlen($vars['subject'])) {
        $errors[] = "'Subject' is a required field";
    }
    if (!strlen($vars['message'])) {
        $errors[] = "'Message' is a required field";
    }
    if ($errors) {
        $t->assign('errors', $errors);
        display_archive_list();
        display_form($vars);
        return;
    }
    $vars['threads'] = $db->escape_array($vars['threads']);
    $threads = "," . implode(",", $vars['threads']) . ",";
    $q = $db->query($s = "\n            INSERT INTO {$db->config['prefix']}newsletter_archive\n            (archive_id,threads,subject,message,add_date)\n            VALUES (null, '" . $db->escape($threads) . "', '" . $db->escape($vars['subject']) . "',\n            '" . $db->escape($vars['message']) . "', NOW())\n        ");
    $t->assign('link', "newsletter_archive.php");
    $t->display("admin/newsletter_archive_saved.html");
}
						<table border="0" align="center" width = "100" style="font-family:georgia;font-size:15px;">
							<tr>
								<td align="right" width="300" style="padding-right:5px">House Number:</td>
								<td width="100" align="left">
									<input id="hno" style = "height:25px; padding-left:10px;border-radius:5px;" size = "25" type="text" name="f[]" placeholder="House Number" required = "true" /> 
								</td>
						    </tr>
							<tr>
								<td colspan = "2">&nbsp;</td>
							</tr>
					  </table>
						<input type="submit" name="submit" value = "Delete" style=" background:#000099;border:none; color:white; font-family:georgia; font-size:14px; height: 25px; width: 100px; border-radius:5px; position:relative; left: 200px; top: 10px;" />
	        </div>
			</form>';
}
display_form();
display_view();
if (isset($_POST['submit'])) {
    $formData = $_POST['f'];
    $fclass = new dummy();
    $fclass->check($formData);
    //	$fclass->result();
}
echo '</br> </br><a href="pm_home.php" style=" background:#000099; border:none; color:white; font-family:georgia; font-size:20px; height: 25px; width: 100px; border-radius:5px; left: 20px; top: 10px;">Return</a>';
?>
			</div>
		</div>
	</div> <!-- /#contents -->
	
</body>
</html>
include 'dbconn.php';
?>
<!DOCTYPE html>
<head>
<title>Creating a drop down</title>
</head>
<body>
<pre><?php 
print_r($_GET);
?>
 </pre>
<?php 
if (isset($_GET['submitted'])) {
    handle_form($_GET['student']);
}
display_form("student");
?>
</body>
</html>
<?php 
function handle_form($id)
{
    $dbc = connect_to_db("jed");
    $query = "select lastname, firstname, major from student where ID = '{$id}'";
    $result = perform_query($dbc, $query);
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);
    //print_r($row);
    $lastname = $row['lastname'];
    $firstname = $row['firstname'];
    $major = $row['major'];
    echo "{$firstname} {$lastname}'s major is {$major}<br />";
Exemple #27
0
<?php

$page_file = "top11_vote_add.php";
$page_title = "Add Top 11 Vote";
require "functions/main_fns.php";
require "functions/top11_fns.php";
require "partials/_header.php";
/*----- CONTENT ------*/
?>
<div class="row">
  <div class="tweleve columns content full-width">
    <h1>Add Top 11 Vote</h1>
    <?php 
if ($_POST['action']) {
    $by_pass_ip_check = true;
    require "partials/_top11_save.php";
} else {
    display_form($page_file);
}
?>
    <div class="top-spacer_20">
      <a href="top11_vote_add.php">Add another Top 11 Vote</a>
      <p>
      <a href="cp.php">Control Panel</a>
    </div>
  </div>
</div> <!-- end of row div -->
<?php 
require "partials/_footer.php";
Exemple #28
0
  <link rel="stylesheet" type="text/css" href="../css/body.css" />

  <style>
  body {font-size:80%; margin:5px;}
  h1 {font-size:140%}
  table {margin-left:40px; border-collapse:collapse}
  td {border:1px solid #C0C0C0; padding:2px}
  .grey {background-color:#EAEAEA; font-weight:bold}
  .nonexist {background-color:#FFC0C0}
  .dkred {background-color:#C00000; color:white; font-weight:bold}
  .err {color:red; font-weight:bold}
  </style>
</head>

<body>
<?php 
if (isset($_POST['submit'])) {
    make_db_connections();
    $table_list = get_tables($_POST['master_dbname'], $master_mysqli);
    foreach ($table_list as $table) {
        echo "<h1>{$table}</h1>\n";
        compare_indexes($_POST['master_dbname'], $_POST['test_dbname'], $table, $master_mysqli, $test_mysqli);
    }
} else {
    echo display_form();
}
?>
</body>
</html>
// Assign template variables
$template['files'][] = 'resources_create.html';
$template['files'][] = 'resources_retrieve.html';
$template['resources'] = "";
$template['category_list'] = "";
// Pull all details
$all_locations_assoc = $db->GetAssoc("SELECT * FROM " . LOCATIONS_TABLE . " WHERE location_id != 0 ORDER BY loc_order_hash ASC, loc_name ASC");
// Define the SQL to pull all resources, alter if a specific row is requested
$sql = "SELECT * FROM " . RESOURCES_TABLE;
if ($row = isset($_GET['row'])) {
    $sql .= " WHERE resource_id = " . clean_string($_GET['row']);
}
$all_resources = $db->Execute($sql . " ORDER BY resource_id ASC");
// If this isn't a category refresh, we generate the return location and bookable location drop-downs
if (!$cat) {
    $template['location_list'] = display_form($all_locations, "create_base_location", FALSE, FALSE);
    $template['book_location'] = str_replace("create_base_location", "create_book_location", $template['location_list']);
    // Display resources
    foreach ($all_resources as $resource) {
        $display = display_resource($resource);
        if ($ajax) {
            echo $display;
        } else {
            $template['resources'] .= $display;
        }
    }
}
$template['category_list'] = display_categories($all_categories);
if ($ajax && $cat) {
    echo $template['category_list'];
} else {
 * $Id$
 * Copyright (c) 2010 Craig Watson [ craig@cwatson.org ]
 * Distributed Under the Mozilla Public License 1.1 [ http://www.mozilla.org/MPL/MPL-1.1.html ]
 */
if (!defined('IN_OB')) {
    exit;
}
// If the form has NOT been submitted
if (!isset($_POST['submit'])) {
    $id = (int) clean_string($_GET['loc']);
    // Pull the details for the location and its parent, and display the form
    $location = $db->GetArray("SELECT * FROM " . LOCATIONS_TABLE . " WHERE location_id = {$id}");
    $poss_parents = $db->getArray("SELECT * FROM " . LOCATIONS_TABLE . " WHERE loc_type < " . $location[0]['loc_type'] . " ORDER BY loc_order_hash");
    // Build the possible parents box
    if ($location[0]['loc_num_children'] == 0) {
        $parents_form = display_form($poss_parents, "update_parent", $location[0]['loc_parent_id']);
    }
    // Include the update form
    include $root_path . 'style/templates/locations_update_form.html';
} else {
    // Parse submitted values
    $id = (int) clean_string($_POST['id']);
    $name = clean_string($_POST['update_name']);
    $parent_update = FALSE;
    // Define base SQL
    $sql = "UPDATE " . LOCATIONS_TABLE . " SET loc_name = '{$name}'";
    // If the number of children is greater than zero (i.e. true)
    if (!$_POST['children']) {
        // Parse values
        $new_parent_id = (int) clean_string($_POST['update_parent']);
        $old_parent_id = (int) clean_string($_POST['old_parent']);