if ($page == "uploadcomic"){
$getisadmin = mysql_query("SELECT * FROM rush_users WHERE username = '$_SESSION[rush_username]'")or die("Admin: ".mysql_error());
$isadmin = mysql_fetch_array($getisadmin);
if ($isadmin['group'] != 4){die("Error! You must be an admin to upload a comic!");}
if ($_POST['upload']){
$date = date("m/d/y, g:i a");
$comic = $HTTP_POST_FILES['comic']['name'];
$name = $_POST['name'];
$fetch_last = mysql_query("SELECT * FROM rush_comics ORDER BY id DESC")or die("Last: ".mysql_error());
$last = mysql_fetch_array($fetch_last);
$lastid = $last['id'] + 1;
$newfile = $lastid."_".$comic;
$path = "comics/".$newfile;
if(copy($HTTP_POST_FILES['comic']['tmp_name'], $path))
{
echo("Comic uploaded sucessfully! Click <a href='viewcomic&id=$lastid'>here</a> to view $name!");
}else{
die("There was en error uploading the comic. Sorry for the inconvience :(.");
}
}
if (!$_POST['upload']){
echo("
Welcome, administrator $_SESSION[rush_username]! Fill out the information below to upload a comic!<br><br>
<form name='upload' method='post' enctype='multipart/form-data' id='upload'>
<strong>File</strong><br>
<input name='comic' type='file' id='comic' size='24'><br>
<strong>Comic Title</strong><br>
<input type='text' name='name'><br>
<input type='submit' name='comic' value='Submit!'>
</form>
");
}
}