summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornokonoko <neku@pomf.se>2013-10-31 01:53:15 +0100
committernokonoko <neku@pomf.se>2013-10-31 01:53:15 +0100
commit16a25a85a46ae5315bcc7a7515eccc66d0ff0efe (patch)
treef749c80a55d2c4c704ec10d3448c7f070baa9681
parentf9d6eb33122fe779af90bbba038e741e4b4fe823 (diff)
removed double DB con
-rw-r--r--blackniggers/kittens.php4
-rw-r--r--upload.php4
2 files changed, 2 insertions, 6 deletions
diff --git a/blackniggers/kittens.php b/blackniggers/kittens.php
index e9b81e6..5ba8b06 100644
--- a/blackniggers/kittens.php
+++ b/blackniggers/kittens.php
@@ -25,7 +25,6 @@ if(isset($_FILES['imagedata']['name']))
$do->bindParam(':hash', $filehash);
$do->execute();
$result = $do->fetch();
- $con = null;
if($result[0]==$filehash){
echo 'http://a.pomf.se/' . $result[1];
}else{
@@ -33,7 +32,6 @@ if(isset($_FILES['imagedata']['name']))
$newName = generate_name($_FILES['imagedata']['name'], $catshit);
$delid = sha1($_FILES['imagedata']['tmp_name']);
//Insert info into DB
- $con = new PDO('mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=XXX', 'XXX', 'XXX');
$do = $con->prepare("INSERT INTO files (hash, orginalname, filename, size, date, expire, delid) VALUES (:hash, :orginname, :filename, :size, :date, :expire, :delid)");
$do->bindParam(':hash', $filehash);
$do->bindParam(':orginname', $_FILES['imagedata']['name']);
@@ -43,10 +41,10 @@ if(isset($_FILES['imagedata']['name']))
$do->bindParam(':expire', $expire);
$do->bindParam(':delid', $delid);
$do->execute();
- $con = null;
$hurr = '/mnt/disk1/pomf/files/' . $newName;
move_uploaded_file($_FILES['imagedata']['tmp_name'], $hurr);
echo 'http://a.pomf.se/' . $newName;
}
+$con = null;
}
?>
diff --git a/upload.php b/upload.php
index 5660a58..5c611fc 100644
--- a/upload.php
+++ b/upload.php
@@ -32,7 +32,6 @@ function generate_name ($name, $grill) {
$do->bindParam(':hash', $filehash);
$do->execute();
$result = $do->fetch();
- $con = null;
if($result[0]==$filehash){
$out["files"][] = array(
"name" => $files["name"][$i],
@@ -46,7 +45,6 @@ function generate_name ($name, $grill) {
//Try to upload and other shit
if ($newname && $files["error"][$i] == 0 && move_uploaded_file($files["tmp_name"][$i], $static_root.$newname)) {
//Insert info into DB
- $con = new PDO('mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=XXX', 'XXX', 'XXX');
$do = $con->prepare("INSERT INTO files (hash, orginalname, filename, size, date, expire, delid) VALUES (:hash, :orginname, :filename, :size, :date, :expire, :delid)");
$do->bindParam(':hash', $filehash);
$do->bindParam(':orginname', $files["name"][$i]);
@@ -56,7 +54,6 @@ function generate_name ($name, $grill) {
$do->bindParam(':expire', $expire);
$do->bindParam(':delid', $delid);
$do->execute();
- $con = null;
$out["files"][] = array(
"name" => $files["name"][$i],
"url" => $newname
@@ -70,6 +67,7 @@ function generate_name ($name, $grill) {
}
}
}
+ $con = null;
exit(json_encode($out, JSON_PRETTY_PRINT));
}