/** * @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()); }
<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";
<?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!!";
<?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
$(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>";