summaryrefslogtreecommitdiff
path: root/web/uploader.php.cpp
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-11-10 08:49:51 +1100
committerRusty Russell <rusty@rustcorp.com.au>2008-11-10 08:49:51 +1100
commit963fa5ca9303d146d635e2fba04814f4f791c559 (patch)
treed43fe3ff32ef4db75b6222fff13c53c00e3a9767 /web/uploader.php.cpp
parentad8da11f6d0664e0fb3c8707a869425088daea7e (diff)
Upload now works, with a bit of hackery.
Also, fixed "Archieve" typo in header (Thanks Tim Connors)
Diffstat (limited to 'web/uploader.php.cpp')
-rw-r--r--web/uploader.php.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/web/uploader.php.cpp b/web/uploader.php.cpp
new file mode 100644
index 00000000..ed7f76a6
--- /dev/null
+++ b/web/uploader.php.cpp
@@ -0,0 +1,27 @@
+<?php
+session_start();
+?>
+#include "logo.html"
+#include "menulist.html"
+#include "static-configuration"
+<?php
+
+// We just email notification for now. Auto-analysis RSN.
+if ($_FILES["uploadedfile"]["error"] > 0) {
+ echo "Error: " . $_FILES["uploadedfile"]["error"] . "<br />";
+ exit();
+}
+
+$dest = tempnam($tempfolder, "upload-");
+move_uploaded_file($_FILES["uploadedfile"]["tmp_name"], $dest);
+
+$subject = "CCAN: code upload by '" . $_POST['email'] . "' with name " . $_FILES["uploadedfile"]["name"];
+$message = "File type: ".$_FILES["uploadedfile"]["type"]."\n".
+ "Size: ".$_FILES["uploadedfile"]["size"]."\n".
+ "Claimed email: ".$_POST['email']."\n".
+ "File destination: ".$dest."\n";
+
+mail($ccanadmin, $subject, $message, "From: $frommail");
+echo "<div align=\"center\"> Thanks!<br>
+ Mail will be send to admin to publish the code.<//div>";
+?>