本文整理汇总了PHP中save_data函数的典型用法代码示例。如果您正苦于以下问题:PHP save_data函数的具体用法?PHP save_data怎么用?PHP save_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了save_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main($txt, $cmd)
{
global $SIDU;
$eng = $SIDU['eng'];
$txt = @strip($txt, 1, 0, 1);
if ($txt && $cmd) {
$err = @save_data($SIDU, $txt, $eng);
}
if (!$txt) {
$txt = "CREATE TABLE " . ($eng == 'my' ? "`{$SIDU['1']}`.`table_name`" : ($eng == 'pg' ? "\"{$SIDU['2']}\".\"table_name\"" : "table_name")) . "(\ncolname int" . ($eng == 'my' ? "(8)" : "") . ($eng == 'sl' ? "" : " NOT NULL DEFAULT 0") . " PRIMARY KEY,\n\n)";
}
echo "<div class='web'><p class='b dot'>", @lang(4101), " <span class='red'>", $eng == 'my' ? $SIDU[1] : "{$SIDU['1']}.{$SIDU['2']}", "</span></p>";
if ($err) {
echo "<p class='err'>{$err}</p>";
}
echo "<form action='tab-new.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},{$SIDU['3']},{$SIDU['4']},{$SIDU['5']},{$SIDU['6']}' method='post' name='myform'>\n\t<table><tr><td valign='top'>" . @html_form("textarea", "txt", $txt, 420, 320, "spellcheck='false' class='box'") . "<br /><br />" . @html_form("submit", "cmd", @lang(4102)) . "</td><td valign='top' style='padding-left:10px'>";
$str = "9|0|smallint|smallint(5)\n0|1|32768|smallint(5) unsigned NOT NULL DEFAULT 0\n1|0|int|int(9)\n0|1|2,147,483,647|int(9) unsigned NOT NULL DEFAULT 0\n1|0|numeric|numeric(7,2)\n0|1|(7,2)|numeric(7,2) unsigned NOT NULL DEFAULT 0.00\n2|0|char|char(255)\n0|1|255|char(255) NOT NULL DEFAULT \\'\\'\n0|0|binary|char(255) binary NOT NULL DEFAULT \\'\\'\n1|0|varchar|varchar(255)\n0|1|255|varchar(255) NOT NULL DEFAULT \\'\\'\n0|0|binary|varchar(255) binary NOT NULL DEFAULT \\'\\'\n1|0|text|text\n0|1|65535|text NOT NULL DEFAULT \\'\\'\n2|0|date|date\n0|1|YYYY-MM-DD|date NOT NULL DEFAULT \\'0000-00-00\\'\n1|0|timestamp|timestamp\n0|1|YmdHis|timestamp NOT NULL DEFAULT \\'0000-00-00 00:00:00\\'\n0|0|now|timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP\n2|0|auto|auto_increment\n0|1|!null|NOT NULL\n0|0|PK|NOT NULL auto_increment PRIMARY KEY\n1|0|PK|PRIMARY KEY\n0|1|PK(a)|PRIMARY KEY (col1,col2)\n0|0|UK|UNIQUE uk (col1,col2)\n0|1|idx|INDEX idx (col1,col2)\n2|0|MyISAM|ENGINE = MyISAM\n0|1|InnoDB|ENGINE = InnoDB";
if ($eng == 'pg') {
$str = @strtr($str, @array("smallint(5)" => "smallint", "int(9)" => "int", " DEFAULT \\'0000-00-00\\'" => "", " DEFAULT \\'0000-00-00 00:00:00\\'" => "", "CURRENT_TIMESTAMP" => "now()", "auto|auto_increment" => "serial|serial", "NOT NULL auto_increment" => "serial NOT NULL", "0|0|binary|char(255) binary NOT NULL DEFAULT \\'\\'" => "", "0|0|binary|varchar(255) binary NOT NULL DEFAULT \\'\\'" => "", "MyISAM|ENGINE = MyISAM" => "With OID|WITH (OIDS=TRUE)", "0|1|InnoDB|ENGINE = InnoDB" => "", " unsigned" => "", "PRIMARY KEY (" => "CONSTRAINT pk PRIMARY KEY (", "UNIQUE uk (" => "CONSTRAINT uk UNIQUE (", "idx|INDEX idx (col1,col2)" => "FK|CONSTRAINT fk FOREINGN KEY (col) REFERENCES tab(pk) MATCH SIMPLE\\n\\tON UPDATE NO ACTION ON DELETE NO ACTION"));
} elseif ($eng == 'sl') {
$str = "9|0|int|int,\\n\n0|1|PK|int PRIMARY KEY\n1|0|text|text,\\n\n1|0|real|real,\\n";
}
$arr = @explode("\n", $str);
foreach ($arr as $v) {
@main_add_txt(@trim($v));
}
if ($eng == 'my') {
@main_add_txt("2|0|enum(Y,N)|enum(\\'Y\\',\\'N\\') NOT NULL DEFAULT \\'Y\\',\\n");
}
echo "</td></tr></table></form></div>";
}
示例2: import_users_from_file
/**
* Import users into database from a file located on the server.
* Function registered as service.
* @param string The csv (only csv) file containing users tom import
* @param string Security key (as found in configuration file)
* @return string Error message
*/
function import_users_from_file($filepath, $security_key)
{
global $_configuration;
$errors_returned = array(0 => 'success', 1 => 'file import does not exist', 2 => 'no users to import', 3 => 'wrong datas in file', 4 => 'security error');
// Check whether this script is launch by server and security key is ok.
if (empty($_SERVER['REMOTE_ADDR']) || $_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR'] || $security_key != $_configuration['security_key']) {
return $errors_returned[4];
}
// Libraries
require_once 'import.lib.php';
// Check is users file exists.
if (!is_file($filepath)) {
return $errors_returned[1];
}
// Get list of users
$users = parse_csv_data($filepath);
if (count($users) == 0) {
return $errors_returned[2];
}
// Check the datas for each user
$errors = validate_data($users);
if (count($errors) > 0) {
return $errors_returned[3];
}
// Apply modifications in database
save_data($users);
return $errors_returned[0];
// Import successfull
}
示例3: main
function main($imp, $cmd)
{
global $SIDU;
if (!$SIDU[1]) {
$err = @lang(2201);
} elseif ($SIDU['eng'] == 'pg' && !$SIDU[2]) {
$err = @lang(2202);
}
echo "<form action='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']}' method='post' enctype='multipart/form-data'>\n\t<div class='web'><p class='dot'><b>", @lang(2203), ": <i class='red'>DB = {$SIDU['1']}", $SIDU[2] ? ".{$SIDU['2']}" : "", "</i></b></p>";
if ($err) {
echo "<p class='err'>{$err}</p></div></form>";
return;
}
if ($cmd) {
$SIDU[4] = $imp['tab'];
}
if ($SIDU[4]) {
$res = @tm("SQL", "SELECT * FROM " . @goodname($SIDU[4]) . " LIMIT 1");
$col = @get_sql_col($res, $SIDU['eng']);
foreach ($col as $v) {
$imp['cols'][] = $v[0];
}
}
if (!$imp['col']) {
$imp['col'] = @implode("\n", $imp['cols']);
}
if ($cmd) {
$err = @valid_data($SIDU, $imp);
if ($err) {
echo "<p class='err'>{$err}</p>";
} else {
return @save_data($SIDU, $imp);
}
}
if ($SIDU['eng'] == 'my') {
$sql = "SHOW TABLES from `{$SIDU['1']}`";
} elseif ($SIDU['eng'] == 'sl') {
$sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY 1";
} else {
$sql = "SELECT relname FROM pg_class a,pg_namespace b\nWHERE a.relnamespace=b.oid AND b.nspname='public' AND a.relkind='r' ORDER BY 1";
}
$arr = @sql2arr($sql, 1);
$tabs[0] = @lang(2204);
foreach ($arr as $v) {
$tabs[$v] = $v;
}
echo "<table><tr><td>", @lang(2205), ":</td><td>", @html_form("select", "imp[tab]", $SIDU[4], "", "", "onchange=\"location='imp.php?id={$SIDU['0']},{$SIDU['1']},{$SIDU['2']},r,'+this.options[this.selectedIndex].value\"", $tabs), "</td></tr>";
if ($SIDU[4]) {
echo "<tr><td valign='top'>", @lang(2206), ":</td><td>", @html_form("textarea", "imp[col]", $imp['col'], 350, 90), "</td></tr>";
}
echo "<tr><td valign='top'>", @lang(2207), ":</td><td><input type='file' name='f'/> ", @lang(2208, '2MB'), "</td></tr></table>\n\t<p class='dot'><br/><b>", @lang(2209), ":</b></p>\n\t<p class='dot'>", @lang(2210), ": ", @html_form("text", "imp[sepC]", $imp['sepC'] ? $imp['sepC'] : ',', 50), " eg \\t , ; « | »\n\t<br/>", @lang(2211), " ", @html_form("text", "imp[cut1]", $imp['cut1'], 50), " ", @lang(2212), " ", @html_form("text", "imp[cut2]", $imp['cut2'], 50), " ", @lang(2213), "\n\t<br/>", @lang(2214), ": ", @html_form("text", "imp[pk]", $imp['pk'], 150), " eg. c1;c2\n\t<br/>", @html_form("checkbox", "imp[del]", $imp['del'], "", "", "", array(1 => '')), @lang(2215), "\n\t<br/>", @html_form("checkbox", "imp[merge]", $imp['merge'], "", "", "", array(1 => '')), @lang(2216), "\n\t<br/>", @html_form("checkbox", "imp[stop]", $imp['stop'], "", "", "", array(1 => '')), @lang(2217), "</p>\n\t<p>", @html_form("submit", "cmd", @lang(2218)), "</p></div></form>";
}
示例4: main
function main()
{
global $SIDU;
$typ = @array("B" => @lang(1705), "S" => "SQL", "E" => @lang(1706), "D" => @lang(1707));
$css = @array("B" => "grey", "S" => "", "E" => "red", "D" => "green");
if ($_POST['cmd']) {
@save_data($_POST['cmd'], $SIDU[0]);
}
echo "<form id='dataTab' name='dataTab' action='his.php?id={$SIDU['0']}' method='post'>\n\t<table class='grid' id='dataTable'><tr class='th'><td class='cbox'><input type='checkbox' onclick='checkedAll()'/></td>\n\t<td align='right'><a href='his.php?id={$SIDU['0']}", $_GET['sort'] ? "" : "&sort=a", "'>ID</a></td><td>", @lang(1708), "</td><td>", @lang(1709), "</td><td align='right'>ms</td><td>", @lang(1710), "</td></tr>";
foreach ($_SESSION['siduhis'][$SIDU[0]] as $i => $his) {
$arr = @explode(" ", $his, 5);
$cur = "<tr><td class='cbox'><input type='checkbox' name='his[]' value='{$i}'/></td><td align='right'>{$i}</td><td>{$arr['1']}</td><td>{$typ[$arr[2]]}</td><td align='right'>{$arr['3']}</td><td class='{$css[$arr[2]]}'>" . @nl2br(@html8($arr[4])) . "</td></tr>";
$str = $_GET['sort'] ? $str . $cur : $cur . $str;
}
echo $str, "</table><input type='hidden' name='cmd' id='cmd'/></form>";
}
示例5: set_time_limit
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
set_time_limit(0);
$form = new FormValidator('class_user_import');
$form->addElement('header', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
//$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
$errors = array();
if ($form->validate()) {
$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_classes);
if (count($errors) == 0) {
$deleteUsersNotInList = isset($_REQUEST['unsubscribe']) && !empty($_REQUEST['unsubscribe']) ? true : false;
$return = save_data($users_classes, $deleteUsersNotInList);
}
}
Display::display_header($tool_name);
if (isset($return) && $return) {
echo $return;
}
if (count($errors) != 0) {
$error_message = "\n";
foreach ($errors as $index => $error_class_user) {
$error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
$error_message .= "<br />";
}
$error_message .= "\n";
Display::display_error_message($error_message, false);
}
示例6: array
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
set_time_limit(0);
// Creating the form.
$form = new FormValidator('course_user_import');
$form->addElement('header', '', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addButtonImport(get_lang('Import'));
$form->setDefaults(array('subscribe' => '1', 'unsubscribe' => 1));
$errors = array();
if ($form->validate()) {
$users_courses = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_courses);
if (count($errors) == 0) {
$inserted_in_course = save_data($users_courses);
// Build the alert message in case there were visual codes subscribed to.
if ($_POST['subscribe']) {
$warn = get_lang('UsersSubscribedToBecauseVisualCode') . ': ';
} else {
$warn = get_lang('UsersUnsubscribedFromBecauseVisualCode') . ': ';
}
if (!empty($inserted_in_course)) {
$warn = $warn . ' ' . get_lang('FileImported');
// The users have been inserted in more than one course.
foreach ($inserted_in_course as $code => $info) {
$warn .= ' ' . $info . ' (' . $code . ') ';
}
} else {
$warn = get_lang('ErrorsWhenImportingFile');
}
示例7: date_default_timezone_set
<?php
date_default_timezone_set("PRC");
include "./sqlite_lib.php";
$raw_name = $_POST["raw_name"];
$target_name = $_POST["target_name"];
$user_name = $_POST["user"];
$filesize = getRealSize("../books/{$target_name}");
$ctime = date("Y-m-d H:i:s", time());
save_data(array($target_name, $raw_name, $user_name, $ctime, "", 0, $filesize, "", ""));
function getRealSize($file)
{
$size = filesize($file);
$kb = 1024;
// Kilobyte
$mb = 1024 * $kb;
// Megabyte
$gb = 1024 * $mb;
// Gigabyte
$tb = 1024 * $gb;
// Terabyte
if ($size < $kb) {
return $size . " B";
} else {
if ($size < $mb) {
return round($size / $kb, 2) . " KB";
} else {
if ($size < $gb) {
return round($size / $mb, 2) . " MB";
} else {
if ($size < $tb) {
示例8: explode
$es = explode('<p', $events);
print "PeventsP" . $events;
foreach ($es as $event) {
print "infop";
$info = explode('</p>', $event);
print_r($info);
$data = date_time_place($date, $info[0]);
$data['info'] = trim(utf8_encode(strip_tags($info[1])));
$urlweek = $week;
# - 1;
$url = "http://president.ie/index.php?section=6&engagement=" . $urlweek . "&lang=eng";
$data['url'] = $url;
$data['type'] = "engt";
$data['startdate'] = $data['date'] . "T" . $data['time'] . ":00Z";
$data['latlng'] = "53.36018,-6.3175";
save_data($data);
}
} else {
echo 'No parser for: ' . $events . "\n";
}
}
}
}
function date_time_place($date, $str)
{
// Grab out the time in hh:mm & the am/pm
preg_match('|([0-9]{1,2}[:.]{1}[0-9]{1,2}) ?([apm.]{2,4})|i', $str, $timeplace);
print "timeplace";
print_r($timeplace);
$hours = $timeplace[1];
$apm = $timeplace[2];
示例9: save_sticky_data
function save_sticky_data($post_id)
{
global $box_array;
// verify nonce
if (isset($_POST['sticky_meta_box_nonce']) && !wp_verify_nonce($_POST['sticky_meta_box_nonce'], basename(__FILE__))) {
return $post_id;
}
// check autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
return $post_id;
}
// check permissions
if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_id)) {
return $post_id;
}
} elseif (!current_user_can('edit_post', $post_id)) {
return $post_id;
}
foreach ($box_array as $box) {
if ($box["fields"][0]["type"] == "datepicker") {
save_datepicker($box);
} else {
save_data($box);
}
}
}
示例10: array
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
// Set this option to true to enforce strict purification for usenames.
$purification_option_for_usernames = false;
set_time_limit(0);
$form = new FormValidator('class_user_import');
$form->addElement('header', $tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
//$form->addElement('checkbox', 'subscribe', get_lang('Action'), get_lang('SubscribeUserIfNotAllreadySubscribed'));
//$form->addElement('checkbox', 'unsubscribe', '', get_lang('UnsubscribeUserIfSubscriptionIsNotInFile'));
$form->addElement('style_submit_button', 'submit', get_lang('Import'), 'class="save"');
if ($form->validate()) {
$users_classes = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users_classes);
if (count($errors) == 0) {
$return = save_data($users_classes);
}
}
Display::display_header($tool_name);
if (isset($return) && $return) {
echo $return;
}
if (count($errors) != 0) {
$error_message = "\n";
foreach ($errors as $index => $error_class_user) {
$error_message .= get_lang('Line') . ' ' . $error_class_user['line'] . ': ' . $error_class_user['error'] . '</b>';
$error_message .= "<br />";
}
$error_message .= "\n";
Display::display_error_message($error_message, false);
}
示例11: redirectMsg
redirectMsg("users.php?" . $q, __('Users deleted successfully!', 'rmcommon'), 0);
}
// get the action
$action = RMHttpRequest::request('action', 'string', '');
switch ($action) {
case 'new':
user_form();
break;
case 'edit':
user_form(true);
break;
case 'save':
save_data();
break;
case 'saveedit':
save_data(true);
break;
case 'mailer':
show_mailer();
break;
case 'sendmail':
send_mail();
break;
case 'deactivate':
activate_users(0);
break;
case 'activate':
activate_users(1);
break;
case 'delete':
delete_users();
示例12: stripslashes
//$payment_currency = $_POST['mc_currency'];
//$txn_id = $_POST['txn_id'];
//$receiver_email = $_POST['receiver_email'];
//$payer_email = $_POST['payer_email'];
//variable parsing comes here
$custom = stripslashes(urldecode($_POST['custom']));
error_log(date('[Y-m-d H:i e] ') . "custom: {$custom} " . PHP_EOL, 3, LOG_FILE);
$customArr = json_decode($custom, 1);
error_log(date('[Y-m-d H:i e] ') . "customArr: " . var_export($customArr, 1) . PHP_EOL, 3, LOG_FILE);
$id = !empty($customArr['id']) ? $customArr['id'] : '';
$user_id = !empty($customArr['user_id']) ? $customArr['user_id'] : '';
$coupon = !empty($customArr['coupon']) ? $customArr['coupon'] : '';
$data = $_POST;
error_log(date('[Y-m-d H:i e] ') . "post: " . var_export($_POST, 1) . PHP_EOL, 3, LOG_FILE);
//custom logic comes here
save_data($id, $user_id, $data);
if (!empty($_POST['txn_type'])) {
switch ($_POST['txn_type']) {
case 'subscr_signup':
subscr_signup($id, $user_id, $data, $coupon);
break;
case 'subscr_payment':
subscr_payment($id, $user_id, $data, $coupon);
break;
case 'subscr_cancel':
subscr_cancel($id, $user_id, $data, $coupon);
break;
default:
break;
}
}
示例13: explode
$ext = explode('.', basename($filenames[$i]));
$target = "uploads" . DIRECTORY_SEPARATOR . md5(uniqid()) . "." . array_pop($ext);
if (move_uploaded_file($anexos['tmp_name'][$i], $target)) {
$success = true;
$paths[] = $target;
} else {
$success = false;
break;
}
}
// check and process based on successful status
if ($success === true) {
// call the function to save all data to database
// code for the following function `save_data` is not
// mentioned in this example
save_data($userid, $username, $paths);
// store a successful response (default at least an empty array). You
// could return any additional response info you need to the plugin for
// advanced implementations.
$output = [];
// for example you can get the list of files uploaded this way
// $output = ['uploaded' => $paths];
} elseif ($success === false) {
$output = ['error' => 'Error while uploading anexos. Contact the system administrator'];
// delete any uploaded files
foreach ($paths as $file) {
unlink($file);
}
} else {
$output = ['error' => 'No files were processed.'];
}
示例14: array
<input type="password" name="password">
</div>
<div><button type="submit" name="access">check</button></div>
</form>
<?php
} else {
$f = array();
for ($i = 1; $i < 200; $i++) {
$a = find_followers($i);
$f = array_merge($f, $a);
if (!$a) {
break;
}
}
$oald = (array) json_decode(get_oald());
save_data(json_encode($f));
$persi = array();
foreach ($oald as $x) {
if (!in_array($x, $f)) {
$persi[] = $x;
}
}
if (!$oald) {
echo '<h2>' . count($f) . ' followers</h1>' . '<h3>Informations saved, come back later if you\'ve lost some followers.</h3>';
}
if ($oald && !$persi) {
echo '<h2>' . count($f) . ' followers</h1>' . '<h3>No changes since your last check.</h3>';
}
if ($oald && $persi) {
echo '<h2>lost follower(s)</h2><ul>';
}
示例15: extract_csv
//
// mails dump back
/*
* published under the GPL Licence
*
* (c) Mar 2010
* by Karsten Hinz
*/
require_once "./config.php";
require_once "./formmail.lib.php";
require_once './Template.php';
//testing
extract_csv(0);
$daten_org = recive_formular();
$daten_no_html = $daten_org;
//ka ob das nur die addresse rüber kopiert ist hier aber auch egal
//löscht die zeilenumbrüche
clean_array($daten_no_html, 0);
//ersetzt alle sonderzeichen durch html
clean_array($daten_org, 1);
$stat = statistics($daten_org, $preise);
if (!empty($daten_org["bemerkung"])) {
sends_info($daten_org, $stat);
}
//die nicht escapte version, damit man die datei einfacher wo anders importieren kann
save_data($daten_no_html);
//erzeugt eine Rechnung aus einen Template
$rechnung = generate_bill($daten_org, $preise);
$fehler = generate_mail($daten_org, $rechnung);
//und auch noch was anzeigen
print_page($daten_org, $rechnung, $fehler);