if (!array_key_exists('price', $range) || !(is_numeric($range['price']) && $range['price'] >= 0)) { $validate = false; break; } } } } return $validate; } } // communication with jQuery Ajax methods if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; switch ($action) { case 'save_form': save_form(); break; } } function save_form() { error_reporting(E_ERROR); if (!ini_get('display_errors')) { ini_set('display_errors', 1); } if (isset($_POST['formdata']) && !empty($_POST['formdata'])) { $data = json_decode($_POST['formdata'], true); } $dm = new DeliveryMethods(); if ($dm->validate($data)) { $dm->save_data($data);
case "apply_wizard_changes": form_wizard($task); break; case "remove": delete_form(); break; case "copy": copy_form(); break; case "add": case "edit": edit_form(); break; case "save": case "apply": save_form($task); break; case "create_table": case "save_table": create_table($task); break; case "list_data": list_data($task); break; case "show_data": show_data($task); break; case "delete_data": delete_data($task); break; case "publish":
function Manage_Form_maker() { require_once "form_maker_functions.php"; require_once "form_maker_functions.html.php"; if (!function_exists('print_html_nav')) { require_once "nav_function/nav_html_func.php"; } global $wpdb; if (isset($_GET["task"])) { $task = esc_html($_GET["task"]); } else { $task = "show"; } if (isset($_GET["id"])) { $id = (int) $_GET["id"]; } else { $id = 0; } switch ($task) { case 'update': update_form_maker(); break; case 'save_update': save_update_form_maker(); break; case 'update_complite': update_complete(); display_form_lists(); break; case "add_form": add_form(); break; case "edit_form": edit_form_maker($id); break; case "Save": if ($id) { apply_form($id); } else { save_form(); } display_form_lists(); break; case "Apply": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } forchrome($id); break; case "gotoedit": gotoedit(); edit_form_maker($id); break; case "remove_form": remove_form($id); display_form_lists(); break; // Form options. // Form options. case "form_options": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } wd_form_options($id); break; case "Save_form_options": Apply_form_options($id); forchrome($id); break; case "Apply_form_options": Apply_form_options($id); wd_form_options($id); break; case "save_as_copy": save_as_copy(); display_form_lists(); break; default: display_form_lists(); } }
<?php session_start(); header("Cache-Control: private, no-cache, must-revalidate"); require "library.php"; $request = array_merge($_POST, $_GET); $request = clean_hash($request); $account_id = $_SESSION["account_id"]; $form_name = addslashes($request["form_name"]); $form_content = addslashes($request["form_content"]); save_form($account_id, $form_name, $form_content);
<textarea name="data" rows="10" cols="40">Enter data to be encrypted here.</textarea> <br /> Encryption Key: <input type="text" name="key" /> <br /> <input name="submit" type="submit" value="Save" /> </form> FORM; } function save_form() { $algorithm = MCRYPT_BLOWFISH; $mode = MCRYPT_MODE_CBC; /* Encrypt data. */ $iv = mcrypt_create_iv(mcrypt_get_iv_size($algorithm, $mode), MCRYPT_DEV_URANDOM); $ciphertext = mcrypt_encrypt($algorithm, $_POST['key'], $_POST['data'], $mode, $iv); /* Save encrypted data. */ $filename = tempnam('/tmp', 'enc') or exit($php_errormsg); $file = fopen($filename, 'w') or exit($php_errormsg); if (FALSE === fwrite($file, $iv . $ciphertext)) { fclose($file); exit($php_errormsg); } fclose($file) or exit($php_errormsg); return $filename; } if (isset($_POST['submit'])) { $file = save_form(); echo "Encrypted data saved to file: {$file}"; } else { show_form(); }
function Manage_contact_form() { require_once "contact_form_functions.php"; require_once "contact_form_functions.html.php"; if (!function_exists('print_html_nav')) { require_once "nav_function/nav_html_func.php"; } global $wpdb; if (isset($_GET["task"])) { $task = esc_html($_GET["task"]); } else { $task = "show"; } if (isset($_GET["id"])) { $id = (int) $_GET["id"]; } else { $id = 0; } switch ($task) { case "add_form": add_form(); break; case "edit_form": edit_contact_form($id); break; case "Save": if ($id) { apply_form($id); } else { save_form(); } display_form_lists(); break; case "Apply": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } forchrome($id); break; case "gotoedit": gotoedit(); edit_contact_form($id); break; case "remove_form": remove_form($id); display_form_lists(); break; // Actions_after_submission // Actions_after_submission case "Actions_after_submission": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } Actions_after_submission($id); break; case "Save_Actions_after_submission": Apply_Actions_after_submission($id); edit_contact_form($id); break; case "Apply_Actions_after_submission": Apply_Actions_after_submission($id); Actions_after_submission($id); break; // Edit_JavaScript // Edit_JavaScript case "Edit_JavaScript": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } Edit_JavaScript($id); break; case "Save_Edit_JavaScript": Apply_Edit_JavaScript($id); edit_contact_form($id); break; case "Apply_Edit_JavaScript": Apply_Edit_JavaScript($id); Edit_JavaScript($id); break; // Custom_text_in_email_for_administrator // Custom_text_in_email_for_administrator case "Custom_text_in_email_for_administrator": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } Custom_text_in_email_for_administrator($id); break; case "Save_Custom_text_in_email_for_administrator": Apply_Custom_text_in_email_for_administrator($id); edit_contact_form($id); break; case "Apply_Custom_text_in_email_for_administrator": Apply_Custom_text_in_email_for_administrator($id); Custom_text_in_email_for_administrator($id); break; // Custom text in email for user // Custom text in email for user case "Custom_text_in_email_for_user": if ($id) { apply_form($id); } else { save_form(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "formmaker"); } Custom_text_in_email_for_user($id); break; case "Save_Custom_text_in_email_for_user": Apply_Custom_text_in_email_for_user($id); edit_contact_form($id); break; case "Apply_Custom_text_in_email_for_user": Apply_Custom_text_in_email_for_user($id); Custom_text_in_email_for_user($id); break; case "save_as_copy": save_as_copy(); display_form_lists(); break; default: display_form_lists(); } }