本文整理汇总了PHP中DB_Functions类的典型用法代码示例。如果您正苦于以下问题:PHP DB_Functions类的具体用法?PHP DB_Functions怎么用?PHP DB_Functions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DB_Functions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processForm
function processForm()
{
$db = new DB_Functions();
$error_msg = "";
//validate user input
if ($_POST['companyName'] == "") {
printForm();
echo "Invalid Company Name.\n";
return;
} else {
if ($_POST['lastTradedPrice'] == "") {
printForm();
echo "Invalid Last Traded Price Value.\n";
return;
} else {
if ($_POST['previousPrice'] == "") {
printForm();
echo "Invalid Previous Price Value.\n";
return;
}
}
}
//save data to table
$change = $_POST['lastTradedPrice'] - $_POST['previousPrice'];
$result = $db->addShareListingEntry($_POST['companyName'], $_POST['lastTradedPrice'], $_POST['previousPrice'], $change);
if (!$result == false) {
//data was successfully saved to database
header('Location: http://localhost/eserver/account.php');
} else {
$error_msg = "Data could not be saved in database.\n";
printForm();
}
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:33,代码来源:createAShareListing.php
示例2: send_notification
/**
* Sending Push Notification
*/
public function send_notification($title, $message)
{
// include config
include_once './config.php';
include_once './db_functions.php';
$db = new DB_Functions();
$ids = $db->getRegisteredIds();
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array('registration_ids' => $ids, 'notification' => array('title' => $title, 'body' => $message));
$headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
echo $result;
}
开发者ID:callmegoon,项目名称:digital-summit-app,代码行数:33,代码来源:gcm.php
示例3: getUltimoPacienteId
function getUltimoPacienteId()
{
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
$id = $db->getUltimoPacienteInserido();
return $id;
}
开发者ID:joseAugustoCR,项目名称:TCC_Servidor,代码行数:7,代码来源:recepcionista.php
示例4: storePatient
/**
* Storing new user
* returns user details
*/
public function storePatient($name, $email, $password, $address, $telephone)
{
require_once 'DB_Functions.php';
$dbFunctions = new DB_Functions();
$resultP = mysqli_query($this->mysqli, "INSERT INTO per_all_people_f(name, email, person_type, telephone ) VALUES('{$name}', '{$email}', 'P' , '{$telephone}');");
// check for successful store
if ($resultP) {
// get user details
$personId = mysqli_insert_id($this->mysqli);
// last inserted id
$uuid = uniqid('', true);
$hash = $dbFunctions->hashSSHA($password);
$encrypted_password = $hash["encrypted"];
// encrypted password
$salt = $hash["salt"];
// salt
$resultU = mysqli_query($this->mysqli, "INSERT INTO users(unique_id, name, email, person_id, encrypted_password, salt, created_at) VALUES('{$uuid}', '{$name}', '{$email}', '{$personId}', '{$encrypted_password}', '{$salt}', NOW())");
$resultPatient = mysqli_query($this->mysqli, "INSERT INTO patient(person_id) VALUES('{$personId}')");
$patientId = mysqli_insert_id($this->mysqli);
// last inserted id
$patientIdUpdate = mysqli_query($this->mysqli, "update per_all_people_f set patient_id = {$patientId} where person_id = {$personId}");
$resultAddress = mysqli_query($this->mysqli, "INSERT INTO address(house_no,person_id) VALUES('{$address}','{$personId}')");
$result = mysqli_query($this->mysqli, "SELECT * FROM per_all_people_f WHERE person_id = {$personId}");
if ($resultU && $resultPatient && $resultAddress && $patientIdUpdate) {
return mysqli_fetch_array($result);
} else {
return FALSE;
}
} else {
return false;
}
}
开发者ID:anuprathi321,项目名称:erx,代码行数:36,代码来源:DB_Functions_Patient.php
示例5: smartpush
function smartpush($uid, $message)
{
include "db_functions.php";
include "gcm.php";
$gcm = new GCM();
$db = new DB_Functions();
$users = $db->getAllUsers();
if ($users != false) {
$no_of_users = mysql_num_rows($users);
} else {
$no_of_users = 0;
}
if ($no_of_users > 0) {
while ($row = mysql_fetch_array($users)) {
$regId = $row['gcm_regid'];
// $message = "สวัสดีชาวโลก";
$registatoin_ids = array($regId);
// $message = array("price" => $message);
$result = $gcm->send_notification($registatoin_ids, $message);
//echo $result;
}
} else {
echo "ไม่มีข้อมูล";
}
}
开发者ID:aclub88,项目名称:amss,代码行数:25,代码来源:smartpush.php
示例6: processForm
function processForm()
{
$db = new DB_Functions();
$error_msg = "";
//validate user input
if ($_POST['currency'] == "") {
printForm();
echo "Invalid Currency Entered.\n";
return;
} else {
if ($_POST['buyingRate'] == "") {
printForm();
echo "Invalid Buying Rate.\n";
return;
} else {
if ($_POST['sellingRate'] == "") {
printForm();
echo "Invalid Selling Rate.\n";
return;
}
}
}
//save data to table
$result = $db->addExchangeRate($_POST['currency'], $_POST['buyingRate'], $_POST['sellingRate']);
if (!$result == false) {
//data was successfully saved to database
header('Location: http://localhost/eserver/account.php');
} else {
$error_msg = "Data could not be saved in database.\n";
printForm();
}
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:32,代码来源:createNewCurrency.php
示例7: testChangeBeliebt
public function testChangeBeliebt()
{
$db = new DB_Functions();
$this->assertTrue($db->changeBeliebt(1, 1));
$irgendneVariable = $db->getSpeisen();
$this->assertEquals(1, $irgendneVariable[0]['beliebt'], 'Beliebtheit nicht gestiegen');
}
开发者ID:SvenKt,项目名称:CBR,代码行数:7,代码来源:DatabaseTest.php
示例8: searchDB
function searchDB($query, $extra)
{
// Get Database connector
include_once 'config/db_functions.php';
$db = new DB_Functions();
$result = $db->searchTable($query, $extra);
//$result =$extra;
return $result;
}
开发者ID:jur1,项目名称:Moz-News,代码行数:9,代码来源:stories.php
示例9: send_notification
/**
* Sending Push Notification
*/
public function send_notification($registration_ids, $message)
{
// include config
require_once 'config.php';
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array('registration_ids' => $registration_ids, 'data' => $message);
$headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
die('Curl failed: ' . curl_error($ch));
} else {
$jsonres = json_decode($result);
if (!empty($jsonres->results)) {
require_once 'db_functions.php';
$db = new DB_Functions();
for ($i = 0; $i < count($jsonres->results); $i++) {
if (isset($jsonres->results[$i]->registration_id)) {
$new = $db->updateUser($registration_ids[$i], $jsonres->results[$i]->registration_id);
} else {
if (isset($jsonres->results[$i]->error)) {
if ($jsonres->results[$i]->error == "NotRegistered") {
$res = $db->deleteUser($registration_ids[$i]);
}
}
}
}
echo $result . "\n";
$canonical_ids_count = $jsonres->canonical_ids;
if ($canonical_ids_count) {
echo count($canonical_ids_count) . " registrations updated\n";
}
}
}
// Close connection
curl_close($ch);
}
开发者ID:MumbaiHackerspace,项目名称:kzpa,代码行数:51,代码来源:GCM.php
示例10: processForm
function processForm()
{
$db = new DB_Functions();
$error_msg = "";
//validate user input
if ($_POST['ad'] == "") {
printForm();
echo "Invalid Adert value.\n";
return;
} else {
if ($_POST['ad_url'] == "") {
printForm();
echo "Invalid Advert URL value.\n";
return;
} else {
if ($_POST['ad_category'] == "") {
printForm();
echo "Invalid Advert category value.\n";
return;
}
}
}
//save data to table
$result = $db->addNewAdvert($_POST['ad'], $_POST['ad_url'], $_POST['ad_category']);
if (!$result == false) {
//data was successfully saved to database
header('Location: http://localhost/eserver/account.php');
} else {
$error_msg = "Data could not be saved in database.\n";
printForm();
}
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:32,代码来源:createNewAd.php
示例11: reportList
function reportList()
{
$db = new DB_Functions();
$reportNames = $db->getAllReportList();
if ($reportNames != false) {
$no_of_reports = mysql_num_rows($reportNames);
} else {
$no_of_reports = 0;
}
echo '<li><a>NA</a></li>';
if ($no_of_reports > 0) {
while ($row = mysql_fetch_array($reportNames)) {
echo '<li><a >' . $row["ReportName"] . '</a></li>';
}
} else {
echo '<li>No Reports Added Yet!</li>';
}
}
开发者ID:ameerhamza26,项目名称:audit,代码行数:18,代码来源:reportView.php
示例12: usersList
function usersList()
{
$db = new DB_Functions();
$users = $db->getAllUsers();
if ($users != false) {
$no_of_users = mysql_num_rows($users);
} else {
$no_of_users = 0;
}
echo '<li><a>NA</a></li>';
if ($no_of_users > 0) {
while ($row = mysql_fetch_array($users)) {
echo '<li><a >' . $row["Name"] . '</a></li>';
}
} else {
echo '<li>No Users Registered Yet!</li>';
}
}
开发者ID:ameerhamza26,项目名称:audit,代码行数:18,代码来源:profile.php
示例13: processForm
function processForm()
{
$db = new DB_Functions();
//validate user input
if ($_POST['rangeFrom'] == "") {
printForm();
echo "Invalid From Range.\n";
return;
} else {
if ($_POST['rangeTo'] == "") {
printForm();
echo "Invalid Invalid Range To.\n";
return;
} else {
if ($_POST['1MonthPa'] == "") {
printForm();
echo "Invalid 1 month pa Value.\n";
return;
} else {
if ($_POST['3MonthPa'] == "") {
printForm();
echo "Invalid 3 month pa Value.\n";
return;
} else {
if ($_POST['6MonthPa'] == "") {
printForm();
echo "Invalid 6 month pa Value.\n";
return;
} else {
if ($_POST['1YearPa'] == "") {
printForm();
echo "Invalid 1 Year pa Value.\n";
return;
}
}
}
}
}
}
//save data to table
$result = $db->addFixedDepositRate($_POST['rangeFrom'], $_POST['rangeTo'], $_POST['1MonthPa'], $_POST['3MonthPa'], $_POST['6MonthPa'], $_POST['1YearPa']);
if (!$result == false) {
//data was successfully saved to database
header('Location: http://localhost/eserver/account.php');
} else {
$error_msg = "Data could not be saved in database.\n";
printForm();
}
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:49,代码来源:createNewFixedDeposit.php
示例14: processForm
function processForm()
{
$db = new DB_Functions();
$error_msg = "";
//validate user input
if ($_POST['adminname'] == "") {
printForm();
echo "Invalid Name.\n";
return;
} else {
if ($_POST['idNo'] == "") {
printForm();
echo "Invalid IdNo.\n";
return;
} else {
if ($_POST['password'] == "") {
printForm();
echo "Invalid Password.\n";
return;
} else {
if ($_POST['password'] != $_POST['passwordConfirm']) {
printForm();
echo "Passwords do not match!\n";
return;
} else {
if ($_POST['username'] == "") {
printForm();
echo "Invalid Username.\n";
return;
}
}
}
}
}
//save data to table
$result = $db->administratorSignUp($_POST['username'], md5($_POST['password']), $_POST['idNo'], $_POST['adminname']);
if (!$result == false) {
//data was successfully saved to database
header('Location: http://localhost/eserver/account.php');
} else {
$error_msg = "Data could not be saved in database.\n";
printForm();
}
}
开发者ID:zuozhiyu,项目名称:BankingApp-Server,代码行数:44,代码来源:createNewAdmin.php
示例15: ini_set
<?php
ini_set('default_charset', 'utf-8');
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['userID']) && isset($_POST['building']) && isset($_POST['floor']) && isset($_POST['room'])) {
// receiving the post params
$userID = $_POST['userID'];
$building = $_POST['building'];
$floor = $_POST['floor'];
$room = $_POST['room'];
$company = $_POST['company'];
$phone = $_POST['phone'];
// check if user is already existed with this user_ID
if ($db->isUserIDExisted($userID)) {
// create a new user
$userAddress = $db->updateUserAddress($userID, $building, $floor, $room, $company, $phone);
if ($userAddress) {
$response["error"] = FALSE;
$response["userAddress"]["building"] = $userAddress["building"];
$response["userAddress"]["floor"] = $userAddress["floor"];
$response["userAddress"]["room"] = $userAddress["room"];
$response["userAddress"]["company"] = $userAddress["company"];
$response["userAddress"]["phone"] = $userAddress["phone"];
echo json_encode($response, JSON_UNESCAPED_UNICODE);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in updating address!";
开发者ID:singtolee,项目名称:PHP_END,代码行数:31,代码来源:updatingaddress.php
示例16: DB_Functions
<?php
include_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
//$response = array("error" => FALSE);
if (isset($_POST['room_type'])) {
// receiving the post params
$Br_id = $_POST['branch_id'];
$Room_Type = $_POST['room_type'];
// check if Room already exists
if ($db->isRoomTypeExisted($Room_Type)) {
// Room already exists
$response["response"] = 0;
$response["message"] = $Room_Type . " already exists";
echo json_encode($response);
} else {
// create a new user$Cust_Name, $Cust_Email, $Cust_Phone,$Cust_Address,$Cust_City,$Cust_State
//$user = $db->insertLaboratory($Br_ID, $Lab_Name);
$user = $db->insertRoomType($Br_id, $Room_Type);
if ($user) {
// Room stored successfully
$response["response"] = 1;
$response["message"] = "Room Type Inserted.";
echo json_encode($response);
} else {
// Room failed to store
$response["response"] = 2;
$response["message"] = "Unknown error occurred in registration!";
echo json_encode($response);
}
开发者ID:skillfroprojects,项目名称:HMS-WebService,代码行数:31,代码来源:roomtype_insert.php
示例17: DB_Functions
<?php
include_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
//$response = array("error" => FALSE);
if (isset($_POST['br_id']) && isset($_POST['ambulance_id'])) {
// receiving the post params
$Br_id = $_POST['br_id'];
$Ambulance_Type = $_POST['ambulance_type'];
$Ambulance_Id = $_POST['ambulance_id'];
$Pat_Name = $_POST['pat_name'];
$Address = $_POST['address'];
$Date = $_POST['date'];
$Time = $_POST['time'];
$Am_Sch_Id = $_POST['am_sch_id'];
if ($_POST['am_sch_id'] == "") {
// check if patient already exists
if ($db->isAmbulanceSchedule($Ambulance_Id)) {
// Bed already allocated
$response["response"] = 0;
$response["message"] = $Ambulance_Id . " already exists";
echo json_encode($response);
} else {
// create a new user$Cust_Name, $Cust_Email, $Cust_Phone,$Cust_Address,$Cust_City,$Cust_State
$user = $db->insertAmbulanceSchedule($Br_Id, $Ambulance_Type, $Ambulance_Id, $Pat_Name, $Address, $Date, $Time);
if ($user) {
// Bed allocated successfully
$response["response"] = 1;
$response["message"] = "Ambulance Scheduled.";
echo json_encode($response);
开发者ID:skillfroprojects,项目名称:HMS-WebService,代码行数:31,代码来源:ambulanceschedule_insert.php
示例18: DB_Functions
<?php
//this file is used for signing up or logging in/out users.
include_once "./system/db_functions.php";
include_once './system/db_connect.php';
include_once './system/GCM.php';
$db = new DB_Functions();
if (isset($_POST['username'])) {
$user = $db->sanitize($_POST['username']);
if (isset($_POST['password'])) {
$pass = $db->sanitize($_POST['password']);
if (isset($_POST['email'])) {
$email = $db->sanitize($_POST['email']);
if (isset($_GET['login'])) {
$db->login($user, $pass, $email);
}
if (isset($_GET['signup'])) {
$db->signup($user, $pass, $email);
}
}
} else {
if (isset($_POST['hash'])) {
$hash = $_POST['hash'];
if (isset($_GET['logout'])) {
$db->logout($user, $hash);
}
}
}
}
开发者ID:xujb,项目名称:OpenFireMessenger,代码行数:29,代码来源:user.php
示例19: DB_Functions
<?php
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['tokenName'])) {
// receiving the post params
$tname = $_POST['tokenName'];
// check if user is already existed with the same email
// create a new token
$token = $db->storeToken($tname);
if ($token) {
// user stored successfully
$response["error"] = FALSE;
$response["token"] = $token["token"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Unknown error occurred in registration!";
echo json_encode($response);
}
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Required parameters (token) is missing!";
echo json_encode($response);
}
开发者ID:Ricardo-Costa-Oliveira,项目名称:Vou-Levar-te-Comigo,代码行数:28,代码来源:storeToken.php
示例20: DB_Functions
<?php
/**
PHP API for Login, Register
**/
if (isset($_POST['tag']) && $_POST['tag'] != '') {
//Get the tag
$tag = $_POST['tag'];
//Include Databse handler
require_once 'include/DB_FunctionsSam.php';
$db = new DB_Functions();
//Response Array
$response = array("tag" => $tag, "success" => 0, "error" => 0);
//Check for tag type
if ($tag == 'login') {
//Request type is check login
$username = $_POST['username'];
$password = $_POST['password'];
//check for user_error
$user = $db->getUser($username, $password);
//print_r($user);
if ($user != false) {
//user found
//echo json with success = 1
$response["success"] = 1;
$response["user"]["username"] = $user["username"];
//$response["user"]["password"] = $user["encrypted_passwd"];
$response["user"]["created"] = $user["created"];
//print_r($response);
echo json_encode($response);
} else {
开发者ID:CSCE499,项目名称:PHPServer,代码行数:31,代码来源:indexSam.php
注:本文中的DB_Functions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论