本文整理汇总了PHP中addData函数的典型用法代码示例。如果您正苦于以下问题:PHP addData函数的具体用法?PHP addData怎么用?PHP addData使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendNotice
function sendNotice($doc, $text)
{
//$doc = rawurlencode($doc);
$text = rawurlencode($text);
$time = rawurlencode(getTime());
$data = "notice|{$time}|{$text}\n";
return addData($doc, $data);
}
示例2: addNewAcufene
function addNewAcufene()
{
include_once dirname(__FILE__) . '/database/handlerDb.php';
if (addData(array($_POST['id'], $_POST['email'], $_POST['indirizzo'], $_POST['contatto']))) {
$return["status"] = "ok";
} else {
$return["status"] = "error";
$return['errorInfo'] = $GLOBALS['errorSql'];
}
$return["json"] = json_encode($return);
echo json_encode($return);
}
示例3: while
while ($row = mysql_fetch_array($querry)) {
$table_users = $row['username'];
if ($username == $table_users) {
return true;
}
}
return false;
}
function addData($username, $password, $email) {
if (!checkUser($username)) {
if (mysql_query("INSERT INTO users (username, password, email) VALUES ('$username', '$password','$email')")) {
return true;
}
} else {
return false;
}
}
if (getformData()) {
require 'connect.php';
if (addData($username, $password, $email)) {
echo "<script> alert('You're in, Welcome!'); </script>";
} else {
echo "<script> alert('Something went wrong'); </script>";
}
}
?>
</body>
</html>
示例4: StaffReport
function StaffReport()
{
global $sourcedir, $context, $txt, $smcFunc;
require_once $sourcedir . '/Subs-Members.php';
// Fetch all the board names.
$request = $smcFunc['db_query']('', '
SELECT id_board, name
FROM {db_prefix}boards', array());
$boards = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$boards[$row['id_board']] = $row['name'];
}
$smcFunc['db_free_result']($request);
// Get every moderator.
$request = $smcFunc['db_query']('', '
SELECT mods.id_board, mods.id_member
FROM {db_prefix}moderators AS mods', array());
$moderators = array();
$local_mods = array();
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$moderators[$row['id_member']][] = $row['id_board'];
$local_mods[$row['id_member']] = $row['id_member'];
}
$smcFunc['db_free_result']($request);
// Get a list of global moderators (i.e. members with moderation powers).
$global_mods = array_intersect(membersAllowedTo('moderate_board', 0), membersAllowedTo('approve_posts', 0), membersAllowedTo('remove_any', 0), membersAllowedTo('modify_any', 0));
// How about anyone else who is special?
$allStaff = array_merge(membersAllowedTo('admin_forum'), membersAllowedTo('manage_membergroups'), membersAllowedTo('manage_permissions'), $local_mods, $global_mods);
// Make sure everyone is there once - no admin less important than any other!
$allStaff = array_unique($allStaff);
// This is a bit of a cop out - but we're protecting their forum, really!
if (count($allStaff) > 300) {
fatal_lang_error('report_error_too_many_staff');
}
// Get all the possible membergroups!
$request = $smcFunc['db_query']('', '
SELECT id_group, group_name, online_color
FROM {db_prefix}membergroups', array());
$groups = array(0 => $txt['full_member']);
while ($row = $smcFunc['db_fetch_assoc']($request)) {
$groups[$row['id_group']] = empty($row['online_color']) ? $row['group_name'] : '<span style="color: ' . $row['online_color'] . '">' . $row['group_name'] . '</span>';
}
$smcFunc['db_free_result']($request);
// All the fields we'll show.
$staffSettings = array('position' => $txt['report_staff_position'], 'moderates' => $txt['report_staff_moderates'], 'posts' => $txt['report_staff_posts'], 'last_login' => $txt['report_staff_last_login']);
// Do it in columns, it's just easier.
setKeys('cols');
// Get each member!
$request = $smcFunc['db_query']('', '
SELECT id_member, real_name, id_group, posts, last_login
FROM {db_prefix}members
WHERE id_member IN ({array_int:staff_list})
ORDER BY real_name', array('staff_list' => $allStaff));
while ($row = $smcFunc['db_fetch_assoc']($request)) {
// Each member gets their own table!.
newTable($row['real_name'], '', 'left', 'auto', 'left', 200, 'center');
// First off, add in the side key.
addData($staffSettings);
// Create the main data array.
$staffData = array('position' => isset($groups[$row['id_group']]) ? $groups[$row['id_group']] : $groups[0], 'posts' => $row['posts'], 'last_login' => timeformat($row['last_login']), 'moderates' => array());
// What do they moderate?
if (in_array($row['id_member'], $global_mods)) {
$staffData['moderates'] = '<em>' . $txt['report_staff_all_boards'] . '</em>';
} elseif (isset($moderators[$row['id_member']])) {
// Get the names
foreach ($moderators[$row['id_member']] as $board) {
if (isset($boards[$board])) {
$staffData['moderates'][] = $boards[$board];
}
}
$staffData['moderates'] = implode(', ', $staffData['moderates']);
} else {
$staffData['moderates'] = '<em>' . $txt['report_staff_no_boards'] . '</em>';
}
// Next add the main data.
addData($staffData);
}
$smcFunc['db_free_result']($request);
}
示例5: session_start
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
session_start();
include "../include/projectlib.inc.php";
includeHeaders();
$Connect = processInputData();
$flag = "";
if (isset($_GET['add'])) {
$flag = addData();
echo $flag;
} else {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<?php
includeJs();
includeCss();
?>
<script type="text/javascript">
<!--
var isSubmit = true;
function validateGMOForm()
{
示例6: str_replace
$text = str_replace("---", " - - ", $text);
$text = str_replace("listado-log-log", "listado log log", $text);
$name = str_replace("---", " - - ", $name);
//the message is cut of after 500 letters
if (strlen($text) > 500) {
$text = substr($text, 0, 500);
}
//to allow for linebreaks a space is inserted every 50 letters
$text = preg_replace("/([^\\s]{50})/", "\$1 ", $text);
//the name is shortened to 30 letters
if (strlen($name) > 30) {
$name = substr($name, 0, 30);
}
//only if a name and a message have been provides the information is added to the db
if ($name != '' && $text != '') {
addData($name, $text);
//adds new data to the database
//getID(50); //some database maintenance
}
//adds new data to the database
function addData($name, $text)
{
global $db;
logea($text, 'CHAT', $_SESSION["usuario"]);
$result = $db->get_results("select * from log where log_tipo = 'CHAT' order by log_fecha desc limit 60,10");
$row = 0;
while (isset($result[$row]->log_id)) {
$res = $db->get_var("delete from log where log_id= '" . $result[$row]->log_id . "'");
$row++;
}
}
示例7: addCommentData
function addCommentData($tbl, $data = NULL)
{
$count = count($data['comment_text']);
for ($i = 0; $i < $count; $i++) {
$row = array();
$row['comment_text'] = $data['comment_text'][$i];
$row['posted_user_url'] = $data['posted_user_url'][$i];
$row['posted_user_name'] = $data['posted_user_name'][$i];
$row['posted_date'] = $data['posted_date'][$i];
$row['video_info_id'] = $data['video_info_id'];
addData($tbl, $row);
}
}
示例8: uploadFile
}
function uploadFile()
{
global $location, $name, $size, $time, $date;
if (checkfileType() && $size < 4194304) {
$location = "../uploads/" . $_FILES['file']['name'];
$name = $_FILES['file']['tmp_name'];
if (is_uploaded_file($name)) {
move_uploaded_file($name, $location);
addtoServer($time, $date, $location);
return true;
}
}
return false;
}
function addtoServer($time, $date, $location)
{
$status = isPublic();
$user = $_SESSION['user'];
mysql_query("INSERT INTO list(time_posted, date_posted, file_location, user, status) VALUES ('{$time}', '{$date}', '{$location}', '{$user}', '{$status}')") or die("Could not insert image into data base" . mysql_error());
}
if (isset($_POST["text-post"])) {
$data = getData(getformName());
$user = $_SESSION['user'];
addData(getTable(), $data, $time, $date, $user);
} else {
if ($_POST["file"]) {
uploadFile();
}
}
header("location: home.php");
示例9: error_reporting
<?php
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
define('EOL', PHP_SAPI == 'cli' ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** PHPExcel_IOFactory */
global $objPHPExcel;
require_once '../../ppt/Classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("templates/product_kbi_export_template.xlsx");
//############################ FUNCTION INTERFACE ####################################################
$dataArr = (array) json_decode($_REQUEST['dataArr']);
addData($dataArr);
saveAndDownload();
//****************************************************************************************************
function addData($data)
{
global $objPHPExcel;
$baseRow = 5;
foreach ($data as $r => $dataRow) {
$row = $baseRow + (int) $r;
$objPHPExcel->getActiveSheet()->setCellValue('A' . $row, $dataRow->TPNB)->setCellValue('B' . $row, $dataRow->SKU)->setCellValue('C' . $row, $dataRow->VOL_TP)->setCellValue('D' . $row, $dataRow->VOL_PP_VAR)->setCellValue('E' . $row, $dataRow->VOL_PP_VAR_PCT)->setCellValue('F' . $row, $dataRow->VOL_LY_VAR)->setCellValue('G' . $row, $dataRow->VOL_LY_VAR_PCT)->setCellValue('H' . $row, $dataRow->VOL_TP_SHARE)->setCellValue('I' . $row, $dataRow->VOL_PP_SHARE)->setCellValue('J' . $row, $dataRow->VOL_LY_SHARE)->setCellValue('K' . $row, $dataRow->VAL_TP)->setCellValue('L' . $row, $dataRow->VAL_PP_VAR)->setCellValue('M' . $row, $dataRow->VAL_PP_VAR_PCT)->setCellValue('N' . $row, $dataRow->VAL_LY_VAR)->setCellValue('O' . $row, $dataRow->VAL_LY_VAR_PCT)->setCellValue('P' . $row, $dataRow->VAL_TP_SHARE)->setCellValue('Q' . $row, $dataRow->VAL_PP_SHARE)->setCellValue('R' . $row, $dataRow->VAL_LY_SHARE)->setCellValue('S' . $row, $dataRow->PRICE_TP)->setCellValue('T' . $row, $dataRow->PRICE_PP)->setCellValue('U' . $row, $dataRow->PRICE_LY)->setCellValue('V' . $row, $dataRow->DIST_TP)->setCellValue('W' . $row, $dataRow->DIST_PP)->setCellValue('X' . $row, $dataRow->DIST_LY);
//DIST_LY
}
$objPHPExcel->getActiveSheet()->removeRow($baseRow - 1, 1);
}
//---------------------------------------- SAVES AND DOWNLOADS EXCEL FILE --------------------------------------
function saveAndDownload()
示例10: addData
}
if ($http_allowed == 'yes') {
addData($basedir . $session . "/http_allowed.txt", $proxy);
$out['http_allowed']++;
}
if ($https_allowed == 'no') {
echo "\t [HTTPS]";
addData($basedir . $session . "/https_forbidden.txt", $proxy);
$out['https_forbidden']++;
$bad = true;
} else {
$out['https_allowed']++;
}
if (!$bad) {
echo " [GOOD]";
addData($basedir . $session . "/good.txt", $proxy);
}
echo "\n";
} else {
echo " \r";
$out['down']++;
}
}
echo "\n============ STATS ==============\n";
echo "Proxies tested:\t" . $out['tested'] . "\n";
echo "Online:\t" . $out['up'] . "\n";
echo "Offline:\t" . $out['down'] . "\n";
echo "HTTP only\t" . $out['https_forbidden'] . "\n";
echo "Altered JS\t" . $out['altered_js'] . "\n";
echo "Altered HTML\t" . $out['altered_html'] . "\n";
echo "IP not hidden\t" . $out['nonaltered_ip'] . "\n";
示例11: error_reporting
<?php
require 'include/overall/header.php';
error_reporting(0);
require 'core/database/connect.php';
require 'core/function/users.php';
if (empty($_POST) === false) {
$name = $_POST['name'];
$contact = $_POST['contact'];
$email = $_POST['email'];
$place = $_POST['place'];
$comment = $_POST['comment'];
$category = $_POST['category'];
$order = $_POST['order'];
addData($name, $order, 'Negotiate', 'None', $contact, $email, $place, $comment, $category, $order);
}
?>
<div class="collapse navbar-collapse" id="my-navbar">
<ul class="nav navbar-nav">
<li><a href="./">Home</a></li><li >
<a href="cakes.php">Cakes</a></li><li>
<a href="service.php">Services</a></li><li class="active">
<a href="contact.php">Contact Us</a></li><li>
<a href="about.php">About</a></li><li>
</ul>
</div>
</div>
<img src="images/tarp.png" alt="Responsive image"style="position:fixed; margin-top: 0px">
</div>
示例12: filter_input
$tell = filter_input(INPUT_POST, 'telephone');
$street = filter_input(INPUT_POST, 'street');
$town = filter_input(INPUT_POST, 'town');
$state = filter_input(INPUT_POST, 'state');
$zipcode = filter_input(INPUT_POST, 'zip');
$website = filter_input(INPUT_POST, 'website');
$birthday = filter_input(INPUT_POST, 'birthday');
$message = checkData($address_id, $firstName, $lastName, $birthday, $email, $street, $town, $state, $tell, $zipcode);
try {
$image = uploadImage('upfile');
} catch (RuntimeException $ex) {
$image = '';
}
$address = $street . "|" . $town . "|" . $state . "|" . $zipcode;
if (!empty($tell) && !empty($email) && !empty($fullName) && !empty($address_id) && !empty($address) && !empty($birthday) && empty($message)) {
addData($address_id, $fullName, $email, $tell, $address, $website, $birthday, $image);
header("Location: index.php");
}
} else {
$address_id = NULL;
$fullName = NULL;
$email = NULL;
$tell = NULL;
$street = NULL;
$town = NULL;
$state = NULL;
$zipcode = NULL;
$website = NULL;
$birthday = NULL;
$image = NULL;
}
示例13: session_start
<?php
session_start();
require '../include/config.php';
require '../functions/functions_checkuser.php';
header("Content-type:text/html;charset=UTF-8");
$select = isset($_GET['select']) ? $_GET['select'] : '';
switch ($select) {
case 'add':
addData();
break;
case 'edit':
editData();
break;
case 'del':
deleteData();
break;
case 'delimg':
deleteImg();
break;
default:
header('Location: ../index.php');
break;
}
/*
Add a user
*/
function addData()
{
require '../include/config.php';
$user_name = $_POST['txtusername'];
示例14: action_staff
/**
* Report for showing all the forum staff members - quite a feat!
* functions ending with "Report" are responsible for generating data
* for reporting.
* they are all called from action_index.
* never access the context directly, but use the data handling
* functions to do so.
*/
public function action_staff()
{
global $txt;
require_once SUBSDIR . '/Members.subs.php';
require_once SUBSDIR . '/Boards.subs.php';
require_once SUBSDIR . '/Membergroups.subs.php';
// Fetch all the board names.
$boards = fetchBoardsInfo('all');
$moderators = allBoardModerators(true);
$boards_moderated = array();
foreach ($moderators as $id_member => $rows) {
foreach ($rows as $row) {
$boards_moderated[$id_member][] = $row['id_board'];
}
}
// Get a list of global moderators (i.e. members with moderation powers).
$global_mods = array_intersect(membersAllowedTo('moderate_board', 0), membersAllowedTo('approve_posts', 0), membersAllowedTo('remove_any', 0), membersAllowedTo('modify_any', 0));
// How about anyone else who is special?
$allStaff = array_merge(membersAllowedTo('admin_forum'), membersAllowedTo('manage_membergroups'), membersAllowedTo('manage_permissions'), array_keys($moderators), $global_mods);
// Make sure everyone is there once - no admin less important than any other!
$allStaff = array_unique($allStaff);
// This is a bit of a cop out - but we're protecting their forum, really!
if (count($allStaff) > 300) {
fatal_lang_error('report_error_too_many_staff');
}
// Get all the possible membergroups!
$all_groups = getBasicMembergroupData(array('all'), array(), null, false);
$groups = array(0 => $txt['full_member']);
foreach ($all_groups as $row) {
$groups[$row['id']] = empty($row['online_color']) ? $row['name'] : '<span style="color: ' . $row['online_color'] . '">' . $row['name'] . '</span>';
}
// All the fields we'll show.
$staffSettings = array('position' => $txt['report_staff_position'], 'moderates' => $txt['report_staff_moderates'], 'posts' => $txt['report_staff_posts'], 'last_login' => $txt['report_staff_last_login']);
// Do it in columns, it's just easier.
setKeys('cols');
// Get the latest activated member's display name.
$result = getBasicMemberData($allStaff, array('moderation' => true, 'sort' => 'real_name'));
foreach ($result as $row) {
// Each member gets their own table!.
newTable($row['real_name'], '', 'left', 'auto', 'left', 200, 'center');
// First off, add in the side key.
addData($staffSettings);
// Create the main data array.
$staffData = array('position' => isset($groups[$row['id_group']]) ? $groups[$row['id_group']] : $groups[0], 'posts' => $row['posts'], 'last_login' => standardTime($row['last_login']), 'moderates' => array());
// What do they moderate?
if (in_array($row['id_member'], $global_mods)) {
$staffData['moderates'] = '<em>' . $txt['report_staff_all_boards'] . '</em>';
} elseif (isset($boards_moderated[$row['id_member']])) {
// Get the names
foreach ($boards_moderated[$row['id_member']] as $board) {
if (isset($boards[$board])) {
$staffData['moderates'][] = $boards[$board]['name'];
}
}
$staffData['moderates'] = implode(', ', $staffData['moderates']);
} else {
$staffData['moderates'] = '<em>' . $txt['report_staff_no_boards'] . '</em>';
}
// Next add the main data.
addData($staffData);
}
}
示例15: error_reporting
require 'database/connect.php';
require 'core/database/connect.php';
require 'core/function/users.php';
error_reporting(0);
if (empty($_GET['name']) === false) {
$name = $_GET['name'];
$items = $_GET['items'];
$price = $_GET['price'];
$quantity = $_GET['quantity'];
$contact = $_GET['contact'];
$email = $_GET['email'];
$place = $_GET['place'];
$comment = $_GET['comment'];
$category = $_GET['category'];
$order = $_GET['order_type'];
addData($name, $items, $price, $quantity, $contact, $email, $place, $comment, $category, $order);
}
?>
<div class="collapse navbar-collapse" id="my-navbar">
<ul class="nav navbar-nav">
<li><a href="./">Home</a></li><li >
<a href="cakes.php">Cakes</a></li><li>
<a href="service.php">Services</a></li><li>
<a href="contact.php">Contact Us</a></li><li>
<a href="about.php">About</a></li><li>
</ul>
</div>
</div>
<img src="images/tarp.png" alt="Responsive image"style="position:fixed; margin-top: 0px">
</div>