本文整理汇总了PHP中mf_connect_db函数的典型用法代码示例。如果您正苦于以下问题:PHP mf_connect_db函数的具体用法?PHP mf_connect_db怎么用?PHP mf_connect_db使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mf_connect_db函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_machform
function display_machform($config)
{
$form_id = $config['form_id'];
$show_border = $config['show_border'];
$machform_path = $config['base_path'];
$machform_data_path = dirname(__FILE__) . '/';
if ($show_border === true) {
$integration_method = '';
} else {
$integration_method = 'php';
}
//start session if there isn't any
if (session_id() == "") {
@session_start();
}
$dbh = mf_connect_db();
if (mf_is_form_submitted()) {
//if form submitted
$input_array = mf_sanitize($_POST);
$input_array['machform_data_path'] = $machform_data_path;
$input_array['machform_base_path'] = $machform_path;
$submit_result = mf_process_form($dbh, $input_array);
if (!isset($input_array['password'])) {
//if normal form submitted
if ($submit_result['status'] === true) {
if (!empty($submit_result['form_resume_url'])) {
//the user saving a form, display success page with the resume URL
$_SESSION['mf_form_resume_url'][$input_array['form_id']] = $submit_result['form_resume_url'];
$ssl_suffix = mf_get_ssl_suffix();
echo "<script type=\"text/javascript\">top.location = 'http{$ssl_suffix}://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?id={$input_array['form_id']}&done=1'</script>";
exit;
} else {
if (!empty($submit_result['review_id'])) {
//redirect to review page
$ssl_suffix = mf_get_ssl_suffix();
if (!empty($submit_result['origin_page_number'])) {
$page_num_params = '&mf_page_from=' . $submit_result['origin_page_number'];
}
$_SESSION['review_id'] = $submit_result['review_id'];
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?show_review=1{$page_num_params}'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&show_review=1{$page_num_params}'</script>";
}
exit;
} else {
if (!empty($submit_result['next_page_number'])) {
//redirect to the next page number
$_SESSION['mf_form_access'][$input_array['form_id']][$submit_result['next_page_number']] = true;
$ssl_suffix = mf_get_ssl_suffix();
echo "<script type=\"text/javascript\">top.location = 'http{$ssl_suffix}://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?id={$input_array['form_id']}&mf_page={$submit_result['next_page_number']}'</script>";
exit;
} else {
//otherwise display success message or redirect to the custom redirect URL
if (empty($submit_result['form_redirect'])) {
$ssl_suffix = mf_get_ssl_suffix();
echo "<script type=\"text/javascript\">top.location = 'http{$ssl_suffix}://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?id={$input_array['form_id']}&done=1'</script>";
exit;
} else {
echo "<script type=\"text/javascript\">top.location = '{$submit_result['form_redirect']}'</script>";
exit;
}
}
}
}
} else {
if ($submit_result['status'] === false) {
//there are errors, display the form again with the errors
$old_values = $submit_result['old_values'];
$custom_error = @$submit_result['custom_error'];
$error_elements = $submit_result['error_elements'];
$form_params = array();
$form_params['page_number'] = $input_array['page_number'];
$form_params['populated_values'] = $old_values;
$form_params['error_elements'] = $error_elements;
$form_params['custom_error'] = $custom_error;
$form_params['integration_method'] = $integration_method;
$form_params['machform_path'] = $machform_path;
$form_params['machform_data_path'] = $machform_data_path;
$markup = mf_display_form($dbh, $input_array['form_id'], $form_params);
}
}
} else {
//if password form submitted
if ($submit_result['status'] === true) {
//on success, display the form
$form_params = array();
$form_params['integration_method'] = $integration_method;
$form_params['machform_path'] = $machform_path;
$form_params['machform_data_path'] = $machform_data_path;
$markup = mf_display_form($dbh, $input_array['form_id'], $form_params);
} else {
$custom_error = $submit_result['custom_error'];
//error, display the pasword form again
$form_params = array();
$form_params['custom_error'] = $custom_error;
$form_params['integration_method'] = $integration_method;
$form_params['machform_path'] = $machform_path;
$form_params['machform_data_path'] = $machform_data_path;
$markup = mf_display_form($dbh, $input_array['form_id'], $form_params);
//.........这里部分代码省略.........
示例2: mf_connect_db
<?php
/********************************************************************************
MachForm
Copyright 2007-2012 Appnitro Software. This code cannot be redistributed without
permission from http://www.appnitro.com/
More info at: http://www.appnitro.com/
********************************************************************************/
require 'includes/init.php';
require 'config.php';
require 'includes/db-core.php';
require 'includes/helper-functions.php';
require 'includes/check-session.php';
$dbh = mf_connect_db();
//get the font list parameter
$start_font_id = (int) $_POST['start_id'];
$list_length = (int) $_POST['list_length'];
//create the list markup
$query = "SELECT \r\n\t\t\t\t\tfont_id,font_family,font_variants,font_variants_numeric \r\n\t\t\t\tFROM \r\n\t\t\t\t\t" . MF_TABLE_PREFIX . "fonts \r\n\t\t\t WHERE \r\n\t\t\t \t\tfont_id >= ? and font_id < ? \r\n\t\t\tORDER BY \r\n\t\t\t \t\tfont_id";
$end_font_id = $start_font_id + $list_length;
$params = array($start_font_id, $end_font_id);
$sth = mf_do_query($query, $params, $dbh);
$font_list_markup = '';
$font_styles = array();
$font_css_markup = '';
$font_css_array = array();
while ($row = mf_do_fetch_result($sth)) {
$encoded_font_family = urlencode($row['font_family']);
$markup = <<<EOT
示例3: display_machform
function display_machform($config)
{
$form_id = $config['form_id'];
$show_border = $config['show_border'];
$machform_path = $config['base_path'];
$machform_data_path = '';
if ($show_border === true) {
$integration_method = '';
} else {
$integration_method = 'php';
}
//start session if there isn't any
if (session_id() == "") {
@session_start();
}
$dbh = mf_connect_db();
if (mf_is_form_submitted()) {
//if form submitted
$input_array = mf_sanitize($_POST);
$input_array['machform_data_path'] = $machform_data_path;
$input_array['machform_base_path'] = $machform_path;
$submit_result = mf_process_form($dbh, $input_array);
if (!isset($input_array['password'])) {
//if normal form submitted
if ($submit_result['status'] === true) {
if (!empty($submit_result['form_resume_url'])) {
//the user saving a form, display success page with the resume URL
$_SESSION['mf_form_resume_url'][$input_array['form_id']] = $submit_result['form_resume_url'];
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?done=1'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&done=1'</script>";
}
exit;
} else {
if ($submit_result['logic_page_enable'] === true) {
//the page has skip logic enable and a custom destination page has been set
$target_page_id = $submit_result['target_page_id'];
if (is_numeric($target_page_id)) {
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?mf_page={$target_page_id}'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&mf_page={$target_page_id}'</script>";
}
exit;
} else {
if ($target_page_id == 'payment') {
//allow access to payment page
$_SESSION['mf_form_payment_access'][$input_array['form_id']] = true;
$_SESSION['mf_payment_record_id'][$input_array['form_id']] = $submit_result['entry_id'];
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?show_payment=1'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&show_payment=1'</script>";
}
exit;
} else {
if ($target_page_id == 'review') {
if (!empty($submit_result['origin_page_number'])) {
$page_num_params = '&mf_page_from=' . $submit_result['origin_page_number'];
}
$_SESSION['review_id'] = $submit_result['review_id'];
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?show_review=1{$page_num_params}'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&show_review=1{$page_num_params}'</script>";
}
exit;
} else {
if ($target_page_id == 'success') {
//redirect to success page
if (empty($submit_result['form_redirect'])) {
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?done=1'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&done=1'</script>";
}
exit;
} else {
echo "<script type=\"text/javascript\">top.location = '{$submit_result['form_redirect']}'</script>";
exit;
}
}
}
}
}
} else {
if (!empty($submit_result['review_id'])) {
//redirect to review page
if (!empty($submit_result['origin_page_number'])) {
$page_num_params = '&mf_page_from=' . $submit_result['origin_page_number'];
}
$_SESSION['review_id'] = $submit_result['review_id'];
if (strpos($_SERVER['REQUEST_URI'], '?') === false) {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}?show_review=1{$page_num_params}'</script>";
} else {
echo "<script type=\"text/javascript\">top.location = '{$_SERVER['REQUEST_URI']}&show_review=1{$page_num_params}'</script>";
}
exit;
} else {
//.........这里部分代码省略.........