<?php

require __DIR__ . '/vendor/autoload.php';
$sns = new Aws\Sns\SnsClient(['region' => 'ap-northeast-1', 'version' => '2010-03-31']);
$topics = $sns->listTopics();
// Subscribe an email address to each topic
foreach ($topics['Topics'] as $topic) {
    $response = $sns->subscribe(['TopicArn' => $topic['TopicArn'], 'Protocol' => 'email', 'Endpoint' => '*****@*****.**']);
    printf('Subscribe to "%s": %s' . PHP_EOL, $topic['TopicArn'], $response['SubscriptionArn']);
}
$result = $rds->describeDBInstances(array('DBInstanceIdentifier' => 'db1'));
$endpoint = $result['DBInstances'][0]['Endpoint']['Address'];
echo "============\n" . $endpoint . "================";
$link = mysqli_connect($endpoint, "testconnection1", "testconnection1", "Project1");
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
} else {
    echo "Success";
}
#create sns client
$sns = new Aws\Sns\SnsClient(['version' => 'latest', 'region' => 'us-east-1']);
#print_r($result);
//echo "sns Topic";
//to list topics
$result = $sns->listTopics(array());
foreach ($result['Topics'] as $key => $value) {
    if (preg_match("/ImageTopicSK/", $result['Topics'][$key]['TopicArn'])) {
        $topicARN = $result['Topics'][$key]['TopicArn'];
    }
}
$uname = $_POST['username'];
$email = $_POST['useremail'];
$phoneforsms = $_POST['phone'];
$raws3url = $url;
$finisheds3url = "none";
$jpegfilename = basename($_FILES['userfile']['name']);
$state = 0;
$res = $link->query("SELECT * FROM MiniProject1 where email='{$email}'");
if ($res->num_rows > 0) {
    if (!($stmt = $link->prepare("INSERT INTO MiniProject1 (uname,email,phoneforsms,raws3url,finisheds3url,jpegfilename,state) VALUES (?,?,?,?,?,?,?)"))) {
Beispiel #3
0
<link rel="stylesheet" type="text/css" href="mystyle.css">
<?php 
// Start the session
session_start();
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
require 'vendor/autoload.php';
#use Aws\S3\S3Client;
#$client = S3Client::factory();
$s3 = new Aws\S3\S3Client(['version' => 'latest', 'region' => 'us-east-1']);
echo $_POST['useremail'];
$email = $_POST['useremail'];
$sn = new Aws\Sns\SnsClient(['version' => 'latest', 'region' => 'us-east-1']);
$resARN = $sn->createTopic(['Name' => 'testmp2']);
print "List All Platform Applications:\n";
$Model1 = $sn->listTopics();
foreach ($Model1['Topics'] as $App) {
    print $App['TopicArn'] . "\n";
}
print "\n";
$AppArn = $Model1['Topics'][0]['TopicArn'];
$resSetTopicAttr = $sn->setTopicAttributes(['AttributeName' => 'DisplayName', 'AttributeValue' => 'mp2tester', 'TopicArn' => $AppArn]);
$uploaddir = '/tmp/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';