本文整理汇总了PHP中saveData函数的典型用法代码示例。如果您正苦于以下问题:PHP saveData函数的具体用法?PHP saveData怎么用?PHP saveData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveData
/**
*
* Registro en DB
*
*/
function saveData()
{
static $result = array();
$codigo = rand(100000, 10000000);
try {
$ubicacion = new Ubicacion();
$ubicacion->codigo = $codigo;
$ubicacion->usuario_id = Auth::user()->id;
$ubicacion->categoria_id = Input::get('categoria');
$ubicacion->tipo_acceso_id = Input::get('tipo');
$ubicacion->x = Input::get('x');
$ubicacion->y = Input::get('y');
$ubicacion->nombre = Input::get('nombre');
$ubicacion->descripcion = Input::get('descripcion');
$ubicacion->etiquetas = Input::get('etiquetas');
$ubicacion->contacto = Input::get('contacto');
$ubicacion->estado = 1;
$ubicacion->vigencia = Input::get('date') . " " . Input::get('time');
$ubicacion->usuario_creacion = Auth::user()->id;
$ubicacion->save();
$result['flag'] = true;
$result['msg'] = $ubicacion->id;
} catch (Exception $err) {
//return $err->getCode() . " / " . $err->getMessage();
if ($err->getCode() == 23000 and strpos($err->getMessage(), "Duplicate entry") !== false) {
saveData();
} else {
$result['flag'] = false;
$result['msg'] = "Ocurrio un problema. (ID: {$codigo})";
}
}
return $result;
}
示例2: processForm
/**
* Process the formfields, if set. Takes fields pgnratingcomment<id>, pgnratingvote<id>,
* pgnratingsend<id>
*/
function processForm($sourceId)
{
if (value("pgnratingsend" . $sourceId) == "1") {
return saveData(value("pgnrating" . $sourceId, "NUMERIC"), value("pgnratingcomment" . $sourceId, "", ""), $sourceId);
}
return false;
}
示例3: addPage
public function addPage($site, $name, $page)
{
$data = \H::getJSONData("{$site}Pages");
var_dump($data);
$name = strtolower($name);
$pages[$name] = $page;
saveData("{$site}Pages", json_encode($pages));
return true;
}
示例4: login
public function login($username, $password)
{
$this->post($this->server);
$response = $this->post($this->server . "/login.php", array("email" => $username, "pass" => $password, "charset_test" => "%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84", "m_ts" => $this->getCookie("m_ts"), "li" => $this->getCookie("li")));
$parts = parse_url($response[1]['url']);
if ($parts['path'] == "/login.php" && isset($parts['query']) && preg_match("/\\&email\\=/", $parts['query'])) {
return false;
} else {
saveData("network_facebook_user", $this->getCookie("c_user"));
return true;
}
}
示例5: addPage
public function addPage($site, $name, $page)
{
$data = getData("{$site}Pages");
$name = strtolower($name);
if ($data) {
$pages = json_decode($data, true);
$pages = !is_array($pages) ? array() : $pages;
} else {
$pages = array();
}
$pages[$name] = $page;
saveData("{$site}Pages", json_encode($pages));
return true;
}
示例6: saveJSONData
/**
* Save JSON as a value of App's Data Storage
*/
public static function saveJSONData($key, $values)
{
$a = getData($key);
$a = json_decode($a, true);
$a = is_array($a) ? $a : array();
$new = array_merge_recursive($a, $values);
foreach ($values as $k => $v) {
if ($v === false) {
unset($new[$k]);
}
}
$new = json_encode($new);
saveData($key, $new);
return true;
}
示例7: main
function main()
{
for ($i = 1;; $i++) {
sleep(1000);
$baseUri = "http://www.dianping.com/search/category/2/45/g146p" . $i;
$urls = getItems($baseUri);
$urls = removeRepeit($urls);
if ($urls <= 0) {
break;
}
for ($j = 0; $j < count($urls); $j++) {
$result = getItemdetails($urls[$j]);
saveData($result);
}
}
}
示例8: getLinks
function getLinks($page)
{
global $destination, $id, $from_city, $pisah;
$id = 0;
$source = scraperWiki::scrape($page);
$html = new simple_html_dom();
$html->load($source);
$id = $id + 1;
$ticketvalues = $html->find("td[@class='ticketvalue']");
$from_city = $ticketvalues[0]->plaintext;
$destination = $ticketvalues[5]->plaintext;
$pisah = $ticketvalues[2]->plaintext;
$railway = array("id" => $id, "from_city" => $from_city, "destination" => $destination, "pisah" => $pisah);
// Save the record.
saveData(array("from_city", "destination", "pisah"), $railway);
}
示例9: KeyAdd
public function KeyAdd($master, $password, $key, $value)
{
if ($this->MasterExists($master)) {
require_once APP_DIR . "/src/Inc/Crypto.php";
$items = getData("master_" . $master . "_items");
$pass_salt = getData("master_" . $master . "_password_salt");
$items = $items == null ? array() : json_decode($items, true);
$items[$key] = $value;
$items = json_encode($items);
$key = $this->master_salt . $password . $pass_salt;
Crypto::$KEY_BYTE_SIZE = mb_strlen($key, '8bit');
$items = Crypto::encrypt(base64_encode($items), $key);
$items = base64_encode($items);
saveData("master_" . $master . "_items", $items);
return true;
} else {
return false;
}
}
示例10: dispatch
function dispatch()
{
$cmd = $_POST["cmd"];
$cid = $_POST["cid"];
$uid = $_POST["uid"];
$data = $_POST["data"];
if (!matchCredentials($uid, $cid)) {
echo "Not allowed";
//exit();
} else {
switch ($cmd) {
case "load":
return loadData($uid, $cid);
break;
case "save":
$result = saveData($uid, $cid, $data);
do_action("gnlms_user_course_data_saved", $uid, $cid, $data);
return $result;
break;
default:
echo "42";
break;
}
}
}
示例11: sec_session_start
<?php
include_once 'auth_connect.php';
include_once 'data_connect.php';
include_once 'functions.php';
sec_session_start();
if (login_check($mysqli) == true) {
echo saveData($_POST["data_sending"], $mysqli, $mysqli_content);
} else {
echo false;
}
示例12: scrapeHTML
function scrapeHTML($param, $type)
{
$html = scraperWiki::scrape("http://www.butxaca.com/");
$dom = new simple_html_dom();
$dom->load($html);
foreach ($dom->find("table.eventtable TR") as $data) {
$tds = $data->find("td");
$td = 0;
foreach ($tds as $cell) {
switch ($i) {
case 0:
$horas[] = $cell->plaintext . PHP_EOL;
break;
case 2:
$titles[] = $cell->find('a.enllasEsdeveniment span.titol')->innertext . PHP_EOL;
break;
}
$i++;
// Set the date.
$dates[] = date("m.d.y");
}
}
// Build up record to store.
$flight_data = array("date" => $dates, "hora" => $horas, "time" => $titles);
// Save the record.
saveData(array("date"), $flight_data);
exit;
// Iterate over table rows and get flight details.
foreach ($dom->find("TR[@HEIGHT='25']") as $data) {
// Flight details.
$tds = $data->find("td");
$airline = removeSpaces($tds[0]->plaintext);
$flight_type = $type;
$flight_num = removeSpaces($tds[1]->plaintext);
$destination = removeSpaces($tds[2]->plaintext);
$time = removeSpaces($tds[3]->plaintext);
$gate = removeSpaces($tds[4]->plaintext);
$remarks = removeSpaces($tds[5]->plaintext);
// Skip header row. Cheesy, but effective.
if ($airline == "Airline") {
continue;
}
// Set the date.
$date = date("m.d.y");
// Build up record to store.
$flight_data = array("date" => $date, "airline" => $airline, "flight_type" => $flight_type, "flight_num" => $flight_num, "destination" => $destination, "time" => $time, "gate" => $gate, "remarks" => $remarks);
// Save the record.
saveData(array("date", "airline", "flight_num"), $flight_data);
}
}
示例13: elements
}
if (!empty($_POST['submitted'])) {
$data = elements(array('name', 'surname', 'email', 'password', 'password_confirm'), $_POST);
$allGood = true;
foreach ($data as $value) {
if ($value === null || empty($value)) {
$allGood = false;
break;
}
}
if (strcmp($data['password'], $data['password_confirm']) != 0) {
$allGood = false;
}
if ($allGood) {
// put data into database or whatever needs to be done
saveData($data);
header('Location: login.php');
exit;
} else {
echo "There was a problem with your registration, please try again.. ";
}
}
//zadnji koristeni ID je trenutno u fajlu
function saveData($data)
{
//dohvati ID
$id = getIdentificator("identifikatori.txt", 'id_korisnika');
//spremi u bazu
$handle = fopen("korisnici.txt", "a");
if ($handle) {
fwrite($handle, $id . ';' . htmlentities($data['name']) . ';' . htmlentities($data['surname']) . ';' . htmlentities($data['email']) . ';' . sha1($data['password']) . "\n");
示例14: array
for ($i = 4; $i <= 197; $i += 8) {
// Negative row class is <tr class="fbOuterAddComm"><td class="fbOuterAddComm">
// If negrow then only save specified fields
// if($tds[$i+6]->plaintext !=" ") // Feedback from supplier
$record = array('Data_autocount' => $i, 'data_blank' => $tds[$i]->plaintext, 'data_Feedback' => $tds[$i + 1]->plaintext, 'data_MemberID_AND_FeedbackScore' => $tds[$i + 2]->plaintext, 'data_Date-Time' => $tds[$i + 3]->plaintext, 'data_blank2' => $tds[$i + 4]->plaintext, 'data_Item_Weight_Price_ItemNumber' => $tds[$i + 5]->plaintext, 'data_Price' => $tds[$i + 6]->plaintext, 'data_ViewItemLink' => $tds[$i + 7]->plaintext);
// else
// {
// $record = array(
// 'Data_autocount' =>$i,
// 'data_blank' => $tds[$i]->plaintext,
// 'data_Feedback' => $tds[$i+1]->plaintext,
// 'data_MemberID_AND_FeedbackScore' => $tds[$i+2]->plaintext,
// 'data_Date-Time' => $tds[$i+3]->plaintext,
// 'data_blank2' => $tds[$i+4]->plaintext,
// 'data_Item_Weight_Price_ItemNumber' => $tds[$i+5]->plaintext
// );
// //$i -= 1;
// }
//print_r($record);
for ($d = 1; $d <= 10; $d++) {
//print_r($d);
// Save the record.
saveData(array("Data_autocount"), $record);
}
}
// for ($i=4; $i<=197; $i+= 8)
}
// foreach($dom->find("table.FbOuterYukon") as $data){
}
// for ($paqes=1; $i<=3; $i+= 1)
// Save to magic SQL record
示例15: saveData
saveData("female_candidates", serialize($candidates));
}
}
if (isset($_POST['add_male_candidates']) || isset($_POST['add_female_candidates'])) {
$data = array();
$i = isset($_POST['add_male_candidates']) ? 0 : 50;
foreach ($_POST['candidates'] as $candidate_name) {
$data[$i] = $candidate_name;
$i++;
}
if (isset($_POST['add_female_candidates'])) {
// Girls
saveData("female_candidates", serialize($data));
} else {
// Boys
saveData("male_candidates", serialize($data));
}
}
?>
<div class="content-full">
<h2>Boys</h2>
<p>Use the below form to change details of the <b>Boys</b> Candidates</p>
<?php
if ($ELEC->isElection("male")) {
$candidates = unserialize(getData("male_candidates"));
echo "<form method='POST'>";
foreach ($candidates as $id => $candidate) {
echo "<div class='item'>";
echo "<input type='text' size='30' name='candidates[{$id}]' value='{$candidate}' />";
echo "</div>";
}