function delete_data($id) { $data = get_data(); unset($data[$id]); $data = array_values($data); store_data($data); }
err("The two email addresses you have given us do not agree. Please check the email fields again."); } $hash['mond'] = $_POST['mond']; $hash['elisa'] = $_POST['elisa']; $hash['dinner'] = $_POST['dinner']; if ($hash['mond'] != "on" && $hash['elisa'] != "on") { err("Please enroll for at least one meeting."); } $hash['mond'] == "on" ? $mond_checked = "checked" : ($mond_checked = ""); $hash['elisa'] == "on" ? $elisa_checked = "checked" : ($elisa_checked = ""); $hash['dinner'] == "on" ? $dinner_checked = "checked" : ($dinner_checked = ""); $hash['date'] = date("d.m.Y", time()); if (!$ERROR) { $data = get_data(); $data[] = $hash; store_data($data); $hash['mond'] == "on" ? $attends_mond = "yes" : ($attends_mond = "no"); $hash['elisa'] == "on" ? $attends_elisa = "yes" : ($attends_elisa = "no"); $hash['dinner'] == "on" ? $attends_dinner = "yes" : ($attends_dinner = "no"); $mailbody = $hash['firstname'] . " " . $hash['lastname'] . " <" . $hash['email'] . "> \n" . $hash['affiliation'] . "\n\nAttended meetings:\nLPF/MoND: {$attends_mond}\neLISA Consortium meeting: {$attends_elisa}\n\nAttends conference dinner: {$attends_dinner}"; mail_utf8("*****@*****.**", "New Registration: " . $hash['firstname'] . " " . $hash['lastname'], $mailbody); print "<center><h3><font color=\"red\">Thank you, you have been registered.</font></h3><br><br>You can find a list of hotels on the <a href=\"index.php?page=accomodation\">accomodation</a> page.</center>"; } } if ($ERROR || !isset($_POST['register'])) { ?> <h2>Registration form</h2> <table border="0" width="70%"> <tr>
<?php ini_set('display_errors', 1); require_once 'TwitterAPIExchange.php'; require_once 'helper.php'; /* retrieve data from twitter */ $init_time = microtime(true); // $data = retrieve_data(array('Letsintern','StarSportsIndia','Favstar500Favs','high_on_glitter','Tesco','ZeeNews','technicalhumans','finance_news__','BillGates','iamsrk','narendramodi','MTVIndia')); $data = retrieve_data('espn'); $final_time = microtime(true); echo "<br/>Time taken to retreive data from twitter : " . ($final_time - $init_time) . " seconds <br/>"; // store the data to the database $init_time = microtime(true); store_data($data, 'sports'); $final_time = microtime(true); echo "Time taken to store data to the database : " . ($final_time - $init_time) . " seconds <br/>";
target="_blank" href="http://www.dokuwiki.org/security#web_access_security"></a> </div> <div style="float: left; width: 58%;"> <?php if (!(check_functions() && check_permissions())) { echo '<p>' . $lang['i_problems'] . '</p>'; print_errors(); print_retry(); } elseif (!check_configs()) { echo '<p>' . $lang['i_modified'] . '</p>'; print_errors(); } elseif (check_data($_REQUEST['d'])) { // check_data has sanitized all input parameters if (!store_data($_REQUEST['d'])) { echo '<p>' . $lang['i_failure'] . '</p>'; print_errors(); } else { echo '<p>' . $lang['i_success'] . '</p>'; } } else { print_errors(); print_form($_REQUEST['d']); } ?> </div> <div style="clear: both"> <a href="http://dokuwiki.org/"><img src="lib/tpl/default/images/button-dw.png" alt="driven by DokuWiki" /></a>
$con = mysql_connect("localhost", "root", "revive"); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db("server", $con)) { die('Error: ' . mysql_error()); } mysql_query("SET NAMES UTF8"); /* ###################################### */ /* ##### Set Initial Values ##### */ $oid = get_oid(); $data = array(); /* ############################## */ /* ##### Get User Input ##### */ if (isset($_POST) && !empty($_POST)) { $data = store_data(); if (isset($_POST["select_cid"]) && $_POST["select_cid"] == "新客戶") { /* ##### Add Customer Data ##### */ if (isset($_POST["add"]) && $_POST["add"] == "新增") { /* ##### Check if customer exists. If not, insert a new record ##### */ $found = check_customer($data["tax_id"]); if (!$found) { /* ##### Add customer ##### */ $cid = add_customer($data); if ($cid != false) { $output = "客戶資料建立完成~"; } /* ######################## */ } else { $cid = $found; $output = "客戶資料已存在~";
<?php require "common.php"; function store_data() { global $privateconfig; if (isset($privateconfig["paths"]["errorlog"])) { $path = $privateconfig["paths"]["errorlog"]; $handle = fopen($path, "a"); $date = date(DATE_RFC2822); $a = array("date" => $date, "HTTP_REFERER" => $_SERVER["HTTP_REFERER"], "HTTP_ACCEPT_LANGUAGE" => $_SERVER["HTTP_ACCEPT_LANGUAGE"], "HTTP_USER_AGENT" => $_SERVER["HTTP_USER_AGENT"], "HTTP_ACCEPT_ENCODING" => $_SERVER["HTTP_ACCEPT_ENCODING"], "REMOTE_ADDR" => $_SERVER["REMOTE_ADDR"], "_REQUEST" => $_REQUEST); $buffer = yaml_emit($a, YAML_UTF8_ENCODING); fwrite($handle, $buffer); fclose($handle); } } function fake_callback() { # Output this in jsonP compatible format. $callback = param_val("callback", "/^[a-zA-Z0-9_]+\$/"); $json = '({"dummy":"response"})'; if ($callback) { header("Content-type: application/javascript;charset=ascii"); echo $callback . ' (' . $json . ');'; } else { header("Content-type: text/plain;charset=ascii"); echo "callback" . ' (' . $json . ');'; } } store_data(); fake_callback();