$data = htmlspecialchars($data); return $data; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $enquiry_type = filter_data($_POST['enquiry_type']); $name = filter_data($_POST['name']); $email = filter_data($_POST['email']); $contact_no = filter_data($_POST['contact_no']); $event_date_day = filter_data($_POST['event_date_day']); $event_date_month = filter_data($_POST['event_date_month']); $event_date_year = filter_data($_POST['event_date_year']); $event_location = filter_data($_POST['event_location']); $postal_code = filter_data($_POST['postal_code']); $event_budget = filter_data($_POST['event_budget']); $ice_cream_request = filter_data($_POST['ice_cream_request']); $message = filter_data($_POST['message']); if (empty($enquiry_type)) { $form_validation_error_msg[] = "<p>Enquiry type is required</p>"; $form_validation_errors = true; } if (empty($name)) { $form_validation_error_msg[] = "<p>Name is required</p>"; $form_validation_errors = true; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $form_validation_error_msg[] = "<p>Email is not valid</p>"; $form_validation_errors = true; } if (empty($contact_no)) { $form_validation_error_msg[] = "<p>Contact no is required</p>"; $form_validation_errors = true;
<?php foreach ($contents as $val) { ?> <div class = well well-large> <h3><?php echo esc($val['title']); ?> </h3> <p><small><em>Posted on <?php echo $val['created']; ?> by <?php echo $val['owner']; ?> </em></small></p> <p><?php echo filter_data($val['data'], $val['filter']); ?> </p> <p><a class="btn btn-mini" href='<?php echo create_url("content/edit/{$val['id']}"); ?> '><i class="icon-pencil"></i> Edit</a></p> </div> <?php } } else { ?> <p>No posts exists.</p> <?php }
<?php if (empty($_POST['email']) or empty($_POST['data']) or isset($_GET['debug'])) { echo 'Your request ' . PHP_EOL; print_r($_REQUEST); echo 'Use Ajax post request. An example of how it should look' . PHP_EOL; $example_data = array('email' => '*****@*****.**', 'data' => array('FNAME' => 'Georg', 'PHONE' => '+79262859833', 'CITY' => 'Moscow', 'MMERGE4' => 'Yes', 'WHENMOVE' => 'As soon as posstible', 'BUDGET' => 'Less than $1k')); print_r($example_data); die; } if (!function_exists('curl_version')) { var_dump(extension_loaded('curl')); echo 'we need php Curl!' . PHP_EOL . 'http://php.net/manual/ru/curl.installation.php'; } $settings = array('listID' => 'daca24e046', 'ApiKEY' => '3f087f1041fac47422f807b753dfb88b-us10', 'possible_merge_fields' => 'FNAME, PHONE, CITY, MMERGE4, WHENMOVE, BUDGET'); $data = array('email_address' => $_POST['email'], 'status' => 'subscribed', 'merge_fields' => filter_data($_POST['data'], $settings['possible_merge_fields'])); //request mailchimp api: $ch = curl_init(); list(, $dc_num) = explode('-us', $settings['ApiKEY']); curl_setopt($ch, CURLOPT_URL, 'https://us' . $dc_num . '.api.mailchimp.com/3.0/lists/' . $settings['listID'] . '/members/'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); curl_setopt($ch, CURLOPT_USERPWD, 'apikey:' . $settings['ApiKEY']); curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/3.0'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 9); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); $json = curl_exec($ch); $response = json_decode($json, true); //some debug:
$form_validation_errors = false; function filter_data($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = filter_data($_POST['name']); $email = filter_data($_POST['email']); $recipient = filter_data($_POST['recipient']); $comments = filter_data($_POST['comments']); $company = filter_data($_POST['company']); $phone = filter_data($_POST['phone']); $country = filter_data($_POST['country']); // $g_recaptcha_response = filter_data($_POST['g-recaptcha-response']); // $captcha = filter_data($_POST['captcha']); if (empty($name)) { $form_validation_error_msg[] = "<p>Name is required</p>"; $form_validation_errors = true; } if (empty($recipient)) { $form_validation_error_msg[] = "<p>Recipient is required</p>"; $form_validation_errors = true; } if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $form_validation_error_msg[] = "<p>Email is not valid</p>"; $form_validation_errors = true; } if (empty($comments)) {
echo filter_data($this->Kalkun_model->get_gammu_info('gammu_version')->row('Client')); ?> </td> </tr> <tr valign="top"> <td><?php echo lang('kalkun_gammu_db_schema'); ?> </td> <td>:</td> <td><?php echo filter_data($this->Kalkun_model->get_gammu_info('db_version')->row('Version')); ?> </td> </tr> <tr valign="top"> <td><?php echo lang('kalkun_phone_imei'); ?> </td> <td>:</td> <td><?php echo filter_data($this->Kalkun_model->get_gammu_info('phone_imei')->row('IMEI')); ?> </td> </tr> </table> </div> </div> <?php }
<?php require '../server/fonctions/filter_data.php'; $html = filter_data($_POST['html']); $fileName = filter_data($_POST['fileName']); $file = str_replace('server', 'template', __DIR__) . '/tmp/' . $fileName . '.html'; $fp = fopen($file, 'w'); fwrite($fp, $html); fclose($fp);
public function submit() { if (!$this->visitor->is_login) { header("Location:" . u('user/login')); //header("Location:./login.html"); //print_r("Location:".u('user/login'));exit(); } //$this->redirect('user/login'); if (IS_POST) { $data = $this->post_baoliao_mod->create(); $type = intval($data['type']); if ($type == 1) { $data['title'] = '我要投稿'; } elseif ($type == 2) { $data['title'] = '改进建议'; } $data['info'] = htmlentities($this->_post("info_{$data['type']}", 'trim')); $data['uid'] = $this->visitor->info['id']; $this->post_baoliao_mod->add(filter_data($data)); $tag_arg = array('uid' => $this->visitor->info['id'], 'uname' => $this->visitor->info['username'], 'action' => 'submit'); tag('submit_end', $tag_arg); $this->ajaxReturn(1); } $this->assign('page_seo', array('title' => '用户爆料')); $this->display(); }