Beispiel #1
0
 public function findDatabases()
 {
     $result = $this->rdsClient->describeDBInstances();
     $rows = $result->search('DBInstances[]');
     $collection = new \AwsInspector\Model\Collection();
     foreach ($rows as $row) {
         $collection->attach(new Database($row));
     }
     return $collection;
 }
Beispiel #2
0
 /**
  * @covers Aws\Rds\RdsClient::factory
  */
 public function testFactoryInitializesClient()
 {
     $client = RdsClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV2', $this->readAttribute($client, 'signature'));
     $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials());
     $this->assertEquals('https://rds.us-west-2.amazonaws.com', $client->getBaseUrl());
 }
Beispiel #3
0
<html>
<title>Gallery</title>
<body>

<?php 
session_start();
$_SESSION['email'] = $_POST['thisemail'];
$email = $_SESSION['email'];
echo "<h1>these are the pictures uploaded by user: "******"</h1>";
require 'vendor/autoload.php';
use Aws\Rds\RdsClient;
$client = RdsClient::factory(array('region' => 'us-west-2'));
$result = $client->describeDBInstances(array('DBInstanceIdentifier' => 'dbmyinstance'));
$endpoint = "";
foreach ($result->getPath('DBInstances/*/Endpoint/Address') as $ep) {
    // Do something with the message
    //echo "============". $ep . "================";
    $endpoint = $ep;
}
//echo "begin database";
$link = mysqli_connect($endpoint, "pmontojo", "pmontojo", "thisMyDb") or die("Error " . mysqli_error($link));
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
//below line is unsafe - $email is not checked for SQL injection -- don't do this in real life or use an ORM instead
$link->real_query("SELECT * FROM items WHERE email = '{$email}'");
//$link->real_query("SELECT * FROM items");
$res = $link->use_result();
//echo "Result set order...\n";
 /**
  * @depends testListsSecurityGroups
  */
 public function testDeletesSecurityGroups()
 {
     self::log('Cleaning up security group');
     $this->client->deleteDBSecurityGroup(array('DBSecurityGroupName' => self::TEST_GROUP));
 }
<?php 
session_start();
require 'vendor/autoload.php';
$_SESSION['upload'] = $_POST["email"];
$sessionUp = $_SESSION['upload'];
# Creating a client for the s3 bucket
use Aws\Rds\RdsClient;
$client = new Aws\Rds\RdsClient(['version' => 'latest', 'region' => 'us-east-1']);
$result = $client->describeDBInstances(['DBInstanceIdentifier' => 'mp1-jgl']);
$endpoint = "";
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
# Connecting to the database
$link = mysqli_connect($endpoint, "controller", "letmein888", "customerrecords") or die("Error " . mysqli_error($link));
/* Checking the database connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
if (!empty($_POST['email'])) {
    $email = $_POST["email"];
    $link->real_query("SELECT * FROM jgldata WHERE email='" . $email . "'");
} else {
    $link->real_query("SELECT * FROM jgldata");
}
$res = $link->use_result();
?>


<!DOCTYPE html>
<html lang="de">
<?php

require 'vendor/autoload.php';
use Aws\Rds\RdsClient;
$client = RdsClient::factory(array('region' => 'us-east-1'));
$result = $client->describeDBInstances(array('DBInstanceIdentifier' => 'itmo544jrhdb'));
$endpoint = "";
foreach ($result->getPath('DBInstances/*/Endpoint/Address') as $ep) {
    // Do something with the message
    echo "============" . $ep . "================";
    $endpoint = $ep;
}
echo "begin database";
$link = mysqli_connect($endpoint, "controller", "ilovebunnies", "itmo544db") or die("Error " . mysqli_error($link));
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
/*
$delete_table = 'DELETE TABLE student';
$del_tbl = $link->query($delete_table);
if ($delete_table) {
        echo "Table student has been deleted";
}
else {
        echo "error!!";

}
*/
$create_table = 'CREATE TABLE IF NOT EXISTS items  
<?php

require 'vendor/autoload.php';
use Aws\Rds\RdsClient;
$client = RdsClient::factory(array('version' => 'latest', 'region' => 'us-east-1'));
$result = $client->describeDBInstances(array('DBInstanceIdentifier' => 'jaysharma-rds'));
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
print_r($endpoint);
echo "begin database";
$link = mysqli_connect($endpoint, "JaySharma", "sharma1234", "datadb", 3306) or die("Error " . mysqli_error($link));
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
$create_table = 'CREATE TABLE IF NOT EXISTS data  
(
    id INT NOT NULL AUTO_INCREMENT,
    email VARCHAR(200) NOT NULL,
    phone VARCHAR(20) NOT NULL,
    filename VARCHAR(255) NOT NULL,
    s3rawurl VARCHAR(255) NOT NULL,
    s3finishedurl VARCHAR(255) NOT NULL,
    status INT NOT NULL,
    issubscribed INT NOT NULL,
    PRIMARY KEY(id)
)';
$create_tbl = $link->query($create_table);
if ($create_table) {
    echo "Table is created or No error returned.";
} else {
    echo "error!!";
Beispiel #8
0
$ec2_outlist = array();
$index_list = array('instance_id', 'image_id', 'dns_name', 'kname', 'instance_type', 'launch_dtime', 'region', 'subnet_id', 'vpc_id', 'local_ip', 'public_ip', 'security_group', 'status');
$ec2_outlist[] = '| ' . implode(' | ', $index_list) . ' |';
foreach ($ec2_infos as $info) {
    $launch_dtime = $info[6]->__toString();
    $launch_dtime = substr($launch_dtime, 0, 19);
    $launch_dtime = str_replace('T', ' ', $launch_dtime);
    $dt = new DateTime($launch_dtime, new DateTimeZone('UTC'));
    $launch_dtime = $dt->setTimeZone(new DateTimeZone('Asia/Tokyo'))->format('Y-m-d H:i:s');
    $tmp = array('instance_id' => $info[0], 'image_id' => $info[1], 'dns_name' => $info[3], 'kname' => $info[4], 'instance_type' => $info[5], 'launch_dtime' => $launch_dtime, 'region' => $info[7], 'subnet_id' => $info[8], 'vpc_id' => $info[9], 'local_ip' => $info[10], 'public_ip' => $info[11], 'security_group' => implode(',', $info[12]), 'status' => $info[2]);
    $ec2_outlist[] = '| ' . implode(' | ', $tmp) . ' |';
}
print "###EC2\n";
print implode("\n", $ec2_outlist) . "\n\n";
//RDS情報取得
$rds = new RdsClient(['region' => 'ap-northeast-1', 'version' => '2014-10-31']);
$dbinstances = $rds->describeDBInstances();
$columns = sprintf("DBInstanceIdentifier," . "DBInstanceClass," . "Engine," . "DBInstanceStatus," . "MasterUsername," . "DBName," . "Endpoint," . "AllocatedStorage," . "InstanceCreateTime," . "DBSecurityGroups," . "VpcSecurityGroups," . "AvailabilityZone," . "MultiAZ," . "EngineVersion," . "PubliclyAccessible," . "StorageType");
$rds_infos = $dbinstances->search('DBInstances[].[' . $columns . ']');
$rds_outlist = array();
$index_list = array('instance_name', 'instance_type', 'db_engine', 'version', 'master_user', 'db_name', 'endpoint', 'port', 'strage', 'strage_type', 'create_dtime', 'security_group', 'region', 'multi_az', 'public', 'status');
$rds_outlist[] = '| ' . implode(' | ', $index_list) . ' |';
foreach ($rds_infos as $info) {
    $launch_dtime = $info[8]->__toString();
    $launch_dtime = substr($launch_dtime, 0, 19);
    $launch_dtime = str_replace('T', ' ', $launch_dtime);
    $dt = new DateTime($launch_dtime, new DateTimeZone('UTC'));
    $launch_dtime = $dt->setTimeZone(new DateTimeZone('Asia/Tokyo'))->format('Y-m-d H:i:s');
    $security_group = '';
    if ($info[9]) {
        $security_group = implode(',', $info[9]);
Beispiel #9
0
<html>
<head><title>JSS Gallery</title>
</head>
<body>

<?php 
session_start();
ini_set('display_errors', 1);
$userEmail = $_POST['userInputEmail'];
echo $userEmail;
require '/var/www/html/vendor/autoload.php';
use Aws\Rds\RdsClient;
$rds = new Aws\Rds\RdsClient(['version' => 'latest', 'region' => 'us-east-1', 'credentials' => ['key' => '', 'secret' => '']]);
$result = $rds->describeDBInstances(array('DBInstanceIdentifier' => 'jss-itmo444-db'));
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
// Do something with the message
echo "============" . $endpoint . "================ <br />";
//echo "begin database";
$link = mysqli_connect($endpoint, "controller", "letmein1234", "jssitmo444db") or die("Error " . mysqli_error($link));
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
//below line is unsafe - $userEmail is not checked for SQL injection -- don't do this in real life or use an ORM instead
$link->real_query("SELECT * FROM jssUserImages WHERE userEmailTable = '{$userEmail}'");
//$link->real_query("SELECT * FROM jssUserImages");
$res = $link->use_result();
echo "Result set order... <br />";
//if the session is valid it uses CSS to show a red header, if not CSS shows a blue header. If the session never occurs it shows a blank page.
while ($row = $res->fetch_assoc()) {
$(document).ready(function(){
$("#pikame").PikaChoose({showToolTips:true});
});
</script>
</head>
<body>
<div class="header"> Image Gallery </div>
<div class="pikachoose">
<ul id ="pikame">
<?php 
session_start();
$_SESSION["email"] = $_POST['email'];
$getemail = $_SESSION["email"];
require 'vendor/autoload.php';
use Aws\Rds\RdsClient;
$client = RdsClient::factory(['region' => 'us-west-2', 'version' => 'latest']);
$result = $client->describeDBInstances(['DBInstanceIdentifier' => 'project1readonly']);
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
//echo "begin database";
$link = mysqli_connect($endpoint, "nandini", "nandinipwd", "Project1db") or die("Error " . mysqli_error($link));
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
if (!empty($getemail)) {
    $link->real_query("SELECT * FROM Projectrec where email='{$getemail}'");
    $res = $link->use_result();
    while ($row = $res->fetch_assoc()) {
        echo " <li><img src =\" " . $row['raws3url'] . "\" /></li>";
        echo " <li><img src =\" " . $row['finisheds3url'] . "\" /></li>";
<!-- 2. Add images to <div class="fotorama"></div>. -->
<div class="fotorama" data-width= "1200" data-ratio="1200/467" data-max-width="100%">

<!-- 3. Enjoy! -->

<body>

 
<?php 
session_start();
$email = $_POST["email"];
echo $email;
require 'vendor/autoload.php';
use Aws\Rds\RdsClient;
$client = new Aws\Rds\RdsClient(['region' => 'us-east-1', 'version' => 'latest']);
$result = $client->describeDBInstances(array('DBInstanceIdentifier' => 'mp1-db'));
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
//echo "begin database";
$link = mysqli_connect($endpoint, "controller", "letmein888", "customerrecords", 3306) or die("Error " . mysqli_error($link));
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
//below line is unsafe - $email is not checked for SQL injection -- don't do this in real life or use an ORM instead
//$link->real_query("SELECT * FROM arshadsTable WHERE email = '$email'");
$link->real_query("SELECT * FROM arshadsTable");
$res = $link->use_result();
echo "Result set order...\n";
while ($row = $res->fetch_assoc()) {