本文整理汇总了PHP中connectToEncryptedMySQL函数的典型用法代码示例。如果您正苦于以下问题:PHP connectToEncryptedMySQL函数的具体用法?PHP connectToEncryptedMySQL怎么用?PHP connectToEncryptedMySQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了connectToEncryptedMySQL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
/**
* sets up the database connection and provides it to PHPUnit
*
* @see <https://phpunit.de/manual/current/en/database.html#database.configuration-of-a-phpunit-database-testcase>
* @return \PHPUnit_Extensions_Database_DB_IDatabaseConnection PHPUnit database connection interface
*/
public final function getConnection()
{
//If the connection has not been established yet, create it
if ($this->connection === null) {
//connect to mySQL and provide the interface to PHPUnit
$config = readConfig("/etc/apache2/capstone-mysql/jpegery.ini");
$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/jpegery.ini");
$this->connection = $this->createDefaultDBConnection($pdo, $config["database"]);
}
return $this->connection;
}
示例2: getConnection
/**
* sets up the database connection and provides it to PHPUnit
*
* @see <https://phpunit.de/manual/current/en/database.html#database.configuration-of-a-phpunit-database-testcase>
* @return \PHPUnit_Extensions_Database_DB_IDatabaseConnection PHPUnit database connection interface
**/
public final function getConnection()
{
// if the connection hasn't been established, create it
if ($this->connection === null) {
// connect to mySQL and provide the interface to PHPUnit
$config = readConfig("/etc/apache2/data-design/dmcdonald21.ini");
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/dmcdonald21.ini");
$this->connection = $this->createDefaultDBConnection($pdo, $config["database"]);
}
return $this->connection;
}
示例3: connectToEncryptedMySQL
<?php
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "profile.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/vhooker.ini");
$profile = new Profile(null, 1, "this is from PHP");
$profile->insert($pdo);
$profile->setProfile("now I changed the message");
$profile->update($pdo);
$profile->delete($pdo);
示例4: dirname
<?php
//namespace Edu\Cnm\Dmancini1\Cnn;
require_once dirname(__DIR__) . "/lib/validate-date.php";
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/dmancini1.ini");
//LOCAL DEVELOPMENT Connection
//$pdo = new PDO('mysql:host=localhost;dbname=dmancini1', 'dmancini1', 'password');
/*
* Article
*
* Article is the actual content of a news article, including title, description, and content (copy)
* Article does not contain any media or media ids; the link to media is located in articleMedia.
*
* @author David Mancini <mancini.david@gmail.com>
*/
//Secure and Encrypted PDO Database Connection
class Article
{
/*
* id is primary key
* @var int articleId
*/
private $articleId;
/*
* author id a foreign key from the author class
* @var int authorId
*/
private $authorId;
/*
* title is the article title
示例5: session_start
<?php
require_once __DIR__ . "/php/classes/autoload.php";
require_once __DIR__ . "/lib/xsrf.php";
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
use Edu\Cnm\Jpegery\Profile;
use Edu\Cnm\Jpegery\Image;
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$reply = new stdClass();
$reply->status = 200;
try {
$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/jpegery.ini");
$caption = filter_input(INPUT_POST, "caption", FILTER_SANITIZE_STRING);
$image = new Image(null, $_SESSION["profile"]->getProfileId(), "temporaryType", "temporaryName", $caption, null);
$image->insert($pdo);
$image->imageUpload();
//Connect to encrypted mySQL
$image->update($pdo);
$reply->message = "This worked. Or didn't and you somehow screwed it up so much you got a false positive. Either way, good job.";
$reply->data = $image;
} catch (Exception $exception) {
$reply->status = $exception->getCode();
$reply->data = $exception->getMessage();
}
//Echo the json, encode the $reply.
header("Content-type: application/html");
echo json_encode($reply);
示例6: session_start
/**
* controller/api for the teamStatistic class
*
* @author Jude Chavez <chavezjude7@gmail.com>
*/
//verify the xsrf challenge
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
//prepare an empty reply
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
//grab the mySQL connection
try {
$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini");
//determine which HTTP method was used
$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
//sanitize inputs
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
//make sure the id is valid for methods that require it
if (($method === "DELETE" || $method === "PUT") && (empty($id) === true || $id < 0)) {
throw new InvalidArgumentException("id can not be empty or negitive", 405);
}
//sanitize and trim other fields
$teamStatisticGameId = filter_input(INPUT_GET, "gameId", FILTER_SANITIZE_NUMBER_INT);
$teamStatisticTeamId = filter_input(INPUT_GET, "teamId", FILTER_SANITIZE_NUMBER_INT);
$teamStatisticStatisticId = filter_input(INPUT_GET, "statisticId", FILTER_SANITIZE_NUMBER_INT);
$teamStatisticValue = filter_input(INPUT_GET, "statisticValue", FILTER_SANITIZE_NUMBER_INT);
//handle REST calls, while only allowing administrators to access database-modifying methods
if ($method === "GET") {
示例7: connectToEncryptedMySQL
<?php
// secure PDO connection
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/zleyba.ini");
/**
*Item is an individual listing at a given location
*
*An item is used to contain all relevant info for an
*individual classified listing. This info includes a
*unique identification number, the general location,
*the title, description of item, and contact info for
*the seller. Additionally it may include the price and
*photos of the item(s)
*
*@author Zach Leyba <zleyba@cnm.edu>
**/
class Item
{
/**ID for this item, this is the primary key
* @var int $itemId
**/
private $itemId;
/**ID# of the user who posted the item, this is the foreign key
* @var int $userId
**/
private $userId;
/** Full length description of the item to be sold
* @var string $itemDescription
*/
private $itemDescription;
示例8: dirname
require_once dirname(__DIR__, 2) . "/classes/autoload.php";
require_once dirname(__DIR__, 3) . "/lib/xsrf.php";
require_once "/etc/apache2/encrypted-config/encrypted-config.php";
/**
* api for the event class
* @author Eliot Ostling
**/
// verify the session, start if not active
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
try {
$pdo = connectToEncryptedMySQL("/etc/apache2/encrypted-config/ng-abq-dev.ini");
$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
$profileId = filter_input(INPUT_GET, "profileId", FILTER_VALIDATE_INT);
if ($method === "GET") {
//set XSRF cookie
setXsrfCookie();
if (empty($id) === false) {
$event = Beta\Event::getEventByEventId($pdo, $id);
if ($event !== null) {
$reply->data = $event;
}
} else {
if (empty($profileId) === false) {
$events = Beta\Event::getEventByEventProfileId($pdo, $profileId)->toArray();
if ($events !== null) {
示例9: session_start
/**
* controller/api for activation
*
* @author Denzyl Fontaine
*/
//verify the xsrf challenge
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
//prepare a empty reply
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
try {
//Grab MySQL connection
$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/timecrunch.ini");
//determine which http method was used
$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
//handle REST calls, while allowing administrators to access database modifying methods
if ($method === "GET") {
//set Xsrf cookie
setXsrfcookie("/");
//get the Sign Up based on the given field
$emailActivation = filter_input(INPUT_GET, "emailActivation", FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
if (empty($emailActivation)) {
throw new \RangeException("No Activation Code");
}
$user = User::getUserByUserActivation($pdo, $emailActivation);
if (empty($user)) {
throw new \InvalidArgumentException("no user for activation code");
}
示例10: calculateTrailDistance
/**
* calculates trail distance using phpgeo composer package.
**/
public static function calculateTrailDistance()
{
$pdo = connectToEncryptedMySQL("/var/www/trailquail/encrypted-mysql/trailquail.ini");
$trails = Trail::getAllTrails($pdo);
$testNum = 0;
foreach ($trails as $trail) {
$testNum++;
$trailRelationships = TrailRelationship::getTrailRelationshipByTrailId($pdo, $trail->getTrailId());
$track = new Polyline();
foreach ($trailRelationships as $trailRelationship) {
$segment = Segment::getSegmentBySegmentId($pdo, $trailRelationship->getSegmentId());
$track->addPoint(new Coordinate($segment->getSegmentStart()->getY(), $segment->getSegmentStart()->getX()));
$track->addPoint(new Coordinate($segment->getSegmentStop()->getY(), $segment->getSegmentStop()->getX()));
}
$trailDistanceM = $track->getLength(new Vincenty());
$trailDistanceMi = $trailDistanceM / 1609.344;
$trailDistance = $trailDistanceMi;
$trail->setTrailDistance($trailDistance);
$trail->update($pdo);
}
}
示例11: getGames
function getGames(string $league)
{
try {
// grab the db connection
$pdo = connectToEncryptedMySQL("/etc/apache2/capstone-mysql/sprots.ini");
$config = readConfig("/etc/apache2/capstone-mysql/sprots.ini");
$apiKeys = json_decode($config["fantasyData"]);
$opts = array('http' => array('method' => "GET", 'header' => "Content-Type: application/json\r\nOcp-Apim-Subscription-key: " . $apiKeys->{$league}, 'content' => "{body}"));
$context = stream_context_create($opts);
// response from api
$seasoning = ["2015", "2016"];
foreach ($seasoning as $season) {
$response = file_get_contents("https://api.fantasydata.net/{$league}/v2/JSON/Games/{$season}", false, $context);
$data = json_decode($response);
foreach ($data as $game) {
$badDate = str_replace("T", " ", $game->DateTime);
if (empty($badDate) === false) {
$teamChavez = Team::getTeamByTeamApiId($pdo, $game->AwayTeamID);
$teamPaul = Team::getTeamByTeamApiId($pdo, $game->HomeTeamID);
if ($teamChavez !== null && $teamPaul !== null) {
$gameToInsert = new Game(null, $teamChavez->getTeamId(), $teamPaul->getTeamId(), $badDate);
$gameToInsert->insert($pdo);
} else {
echo "<p>* * * SIX OF THIRTEEN SKIPPED THIS GAME * * *</p>" . PHP_EOL;
}
}
}
}
} catch (Exception $exception) {
echo "Something went wrong: " . $exception->getMessage() . PHP_EOL;
} catch (TypeError $typeError) {
echo "Something went wrong: " . $typeError->getMessage() . PHP_EOL;
}
}
示例12: connectToEncryptedMySQL
<?php
//put this on the top of the file
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "ramchip.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/enajera2.ini");
//now you can use the PDO object normally
$ramChip = new RamChip(null, 1, "this is from PHP");
$ramChip->insert($pdo);
$ramChip->setProductId("now I added an id");
$ramChip->setProductName("now I added a name for the ram chip, many words");
$ramChip->setManufacturerName("now I added a manufacturer name for the ram chip, there is no need to worry");
$ramChip->setPrice("now I added a price for the ram chip, wow such price");
$ramChip->update($pdo);
$ramChip->delete($pdo);
示例13: connectToEncryptedMySQL
<?php
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "your-class-file.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/jchavez790");
///now produce nomally
$track = new Track(null, 1, "this is form PHP");
$track->insert($pdo);
$track->setTrackContent("now I changed the message");
$track->update($pdo);
$track->delete($pdo);
示例14: connectToEncryptedMySQL
<?php
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/cpaul9.ini");
require_once "profile.php";
$profile = new Profile(null, 1, "this is from PHP");
$profile->insert($pdo);
$profile->setprofilecontent("now i changed the message");
$profile->update($pdo);
$profile->delete($pdo);
示例15: session_start
*
* @author Louis Gill <lgill7@cnm.edu>
*/
// verify the xsrf challenge
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
// prepare an empty reply
$reply = new stdClass();
$reply->status = 200;
$reply->data = null;
$ipAddress = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
try {
// grab the mySQL connection
$pdo = connectToEncryptedMySQL("/var/www/trailquail/encrypted-mysql/trailquail.ini");
//determine which HTTP method was used
$method = array_key_exists("HTTP_X_HTTP_METHOD", $_SERVER) ? $_SERVER["HTTP_X_HTTP_METHOD"] : $_SERVER["REQUEST_METHOD"];
// sanitize the commentId
$commentId = filter_input(INPUT_GET, "commentId", FILTER_VALIDATE_INT);
if (($method === "DELETE" || $method === "PUT") && (empty($commentId) === true || $commentId < 0)) {
throw new InvalidArgumentException("comment ID cannot be empty or negative", 405);
}
// sanitize and trim the other fields
// trailId, userId, browser, createDate, ipAddress, commentPhoto, commentPhotoType, commentText // only fields are commentPhoto, commentPhotoType, & commentText?!?!?!!?!?!?
$commentText = filter_input(INPUT_GET, "commentText", FILTER_SANITIZE_STRING);
$userId = filter_input(INPUT_GET, "userId", FILTER_VALIDATE_INT);
$trailId = filter_input(INPUT_GET, "trailId", FILTER_VALIDATE_INT);
// handle all RESTful calls to listing
//get some or all Comments
if ($method === "GET") {