+ $tmp_name) {
- $name = basename($_FILES['rom-files']['name'][$key]);
- $ext = explode(".", $name);
- $ext = end($ext);
+ if ((isset($_GET["console"])) and ($_GET["console"] !== "")) {
+ buildRomList($_GET["console"]);
- if (in_array($ext, $snes)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/snes")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/snes");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/snes/" . $name);
- echo("
SNES rom $name successfully uploaded.
");
+ } else {
- } else if (in_array($ext, $gba)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/gba")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/gba");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/gba/" . $name);
- echo("
GBA rom $name successfully uploaded.
");
-
- } else if (in_array($ext, $gb)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/gb")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/gb");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/gb/" . $name);
- echo("
GB rom $name successfully uploaded.
");
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/nes/")) { mkdir("./users/".$_COOKIE["user"]."/roms/nes"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/snes/")) { mkdir("./users/".$_COOKIE["user"]."/roms/snes"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/n64/")) { mkdir("./users/".$_COOKIE["user"]."/roms/n64"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/gb/")) { mkdir("./users/".$_COOKIE["user"]."/roms/gb"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/gba/")) { mkdir("./users/".$_COOKIE["user"]."/roms/gba"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/nds/")) { mkdir("./users/".$_COOKIE["user"]."/roms/nds"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/vb/")) { mkdir("./users/".$_COOKIE["user"]."/roms/vb"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/segaMS/")) { mkdir("./users/".$_COOKIE["user"]."/roms/segaMS"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/segaMD/")) { mkdir("./users/".$_COOKIE["user"]."/roms/segaMD"); }
+ if(!is_dir("./users/".$_COOKIE["user"]."/roms/segaGG/")) { mkdir("./users/".$_COOKIE["user"]."/roms/segaGG"); }
- } else if (in_array($ext, $nes)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/nes")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/nes");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/nes/" . $name);
- echo("
NES rom $name successfully uploaded.
");
- } else if (in_array($ext, $vb)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/vb")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/vb");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/vb/" . $name);
- echo("
VB rom $name successfully uploaded.
");
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/nes/")) == 2)) {
+ echo('
Nintendo Entertainment System');
+ }
- } else if (in_array($ext, $nds)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/nds")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/nds");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/nds/" . $name);
- echo("
NDS rom $name successfully uploaded.
");
-
- } else if (in_array($ext, $n64)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/n64")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/n64");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/n64/" . $name);
- echo("
N64 rom $name successfully uploaded.
");
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/snes/")) == 2)) {
+ echo('
Super Nintendo');
+ }
- } else if (in_array($ext, $sms)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/segaMS")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/segaMS");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/segaMS/" . $name);
- echo("
SMS rom $name successfully uploaded.
");
-
- } else if (in_array($ext, $smd)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/segaMD")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/segaMD");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/segaMD/" . $name);
- echo("
SMD rom $name successfully uploaded.
");
-
- } else if (in_array($ext, $gg)) {
- if(!is_dir("users/" . $_COOKIE["user"] . "/roms/segaGG")) {
- mkdir("users/" . $_COOKIE['user'] . "/roms/segaGG");
- }
- move_uploaded_file($tmp_name, "users/" . $_COOKIE["user"] . "/roms/segaGG/" . $name);
- echo("
SGG rom $name successfully uploaded.
");
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/n64/")) == 2)) {
+ echo('
Nintendo 64');
+ }
- } else {
- print("
Error: Unsupported filetype!
");
- }
- }
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/gb/")) == 2)) {
+ echo('
Game Boy');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/gba/")) == 2)) {
+ echo('
Gameboy Advance');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/nds/")) == 2)) {
+ echo('
Nintendo DS');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/vb/")) == 2)) {
+ echo('
Nintendo Virtual Boy');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/segaMS/")) == 2)) {
+ echo('
Sega Master System');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/segaMD/")) == 2)) {
+ echo('
Sega Mega Drive');
+ }
+
+ if (!(count(scandir("./users/".$_COOKIE["user"]."/roms/segaGG/")) == 2)) {
+ echo('
Sega Game Gear');
}
}
- }
- ?>
-
-
+
+ ?>
+