<commit_before><?php
//Start the session
session start();
//In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
//of $_FILES.

echo $_POST['useremail'];

$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 attact!\n";

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";
require 'vendor/autoload.php';
use Aws\S3\S3Client;

$client = S3Client::factory();
$bucket = uniqid("php-lsl-",false);

$result = $client->createBucket(array(
'Bucket' => $bucket
));

$client->waitUntilBucketExists(array('Bucket' => $bucket));
Skey = $uploadfile;
$result = $client->putObject(array(
'ACL' => 'public-read',
'Bucket' => $bucket,
'Key' => $key,
'SourceFile' => $uploadfile
));
$url = $result['ObjectURL'];
echo $url;

use Aws\Rds\RdsClient;
$client = RdsClient::factory(array(
'region' => 'us-east-1'
));
$result = $client->describeDBIntances(array(
'DBInstanceIdentifier' => 'itmo544lsldb',
));

$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));<commit_msg>updated php sdk 3<commit_after><?php
//Start the session
session start();
//In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
//of $_FILES.

echo $_POST['useremail'];

$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 attact!\n";

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";
require 'vendor/autoload.php';
use Aws\S3\S3Client;

$client = S3Client::factory();
$s3 = new Aws\S3\S3Client([
'version' => 'latest',
'region' => 'us-east-1'
]);

$bucket = uniqid("php-lsl-",false);

#$result = $client->createBucket(array(
#'Bucket' => $bucket
#));
# AWS PHP SDK version 3 create bucket
$result = $s3->createBucket([
'ACL' => 'public-read',
'Bucket' => $bucket
)];

#$client->waitUntilBucketExists(array('Bucket' => $bucket));
#Old PHP version 2
#Skey = $uploadfile;
#$result = $client->putObject(array(
#'ACL' => 'public-read',
#'Bucket' => $bucket,
#'Key' => $key,
#'SourceFile' => $uploadfile
#));

#PHP version 3
$result = $client->putObject([
'ACL' => 'public-read',
'Bucket' => $bucket,
'Key' => $uploadfile
)];


$url = $result['ObjectURL'];
echo $url;

use Aws\Rds\RdsClient;
$client = RdsClient::factory(array(
'region' => 'us-east-1'
));
$result = $client->describeDBIntances(array(
'DBInstanceIdentifier' => 'itmo544lsldb',
));

$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));
{'fraction_non_alphanumeric': 0.22376776534623527, 'fraction_numerical': 0.01058361052313275, 'mean_word_length': 6.023354564755839, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3767022', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1153, 'n_words': 271}