| Current Path : /var/www/html/abdullah/@bdullah/ |
| Current File : /var/www/html/abdullah/@bdullah/upload.php |
<!--Copyright (c) 2015 Affan Ahmad Fahmi. All rights reserved.--!>
<html>
<head>
<title>Upload</title>
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
<link rel="stylesheet" href="./resources/style/main.css">
<link rel="stylesheet" href="./resources/style/form.css">
<script type="text/javascript"
src="./resources/script/js/sec.js">
</script>
</head>
<body background='./resources/pic/bg.jpg'>
<div id="head">
<ul>
<li><a href="index.htm">Home</a></li>
<li><a href="Academics.htm">Academics</a></li>
<li><a href="Research.htm">Research</a></li>
<li><a href="Teaching.php">Teaching</a></li>
<li><a href="Contact.htm">Contact</a></li>
<li><a id="selected" href="#">Upload</a></li>
<li><a href="http://iiita.ac.in/">Go to IIIT-A</a></li>
</ul>
</div>
<div id="body"><br><br>
<div id="login" style="width:50%; margin:0 auto;">
<?php
if(isset($_POST['submit'])){ //check if form was submitted
$username = $_POST['username']; //get input text
$password = $_POST['password'];
if(trim($username)==trim('abdullah')&&trim($password)==trim('#affan123')){
?>
<style type="text/css">
#temp{
display:none;
}</style>
<div id="upload">
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="DOC">
<input type="hidden" value="1qazxsw2" name="pass">
<input name="submitF" type="submit" value=" Upload ">
</form>
<br><br><br>
<form action="" method="post">
<div class="select-style">
<select name="file">
<?php
foreach (glob("./DOC/*.*") as $filename) {
echo "<option value='".$filename."'>";
echo substr(substr($filename,6),0,-4)."</option>";
}
?>
</select>
</div>
<input type="hidden" value="1qazxsw2" name="pass">
<input name="del" type="submit" value=" Delete ">
</form>
</div>
<?php
}else{
?>
<script>alert("Invalid username/password combination. Please try again.!");</script>
<?php
}}else if(isset($_POST['submitF'])&&$_POST['pass']=="1qazxsw2"){
if($_FILES ["DOC"] ["error"] > 0 || empty($_FILES['DOC']['name'])){
?>
<script>alert("No File Uploaded or Invalid File!!");</script>
<?php
}else{
try{
move_uploaded_file($_FILES['DOC']['tmp_name'], "./DOC/".$_FILES['DOC']['name']);
}catch(Exception $e){die("Error:".$e);}
?>
<script>alert("File Upload Successful!");</script>
<?php
}
?>
<style type="text/css">
#temp{
display:none;
}</style>
<div id="upload">
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="DOC" accept="application/pdf">
<input type="hidden" value="1qazxsw2" name="pass">
<input name="submitF" type="submit" value=" Upload ">
</form>
<br><br><br>
<form action="" method="post">
<div class="select-style">
<select name="file">
<?php
foreach (glob("./DOC/*.*") as $filename) {
echo "<option value='".$filename."'>";
echo substr(substr($filename,6),0,-4)."</option>";
}
?>
</select>
</div>
<input type="hidden" value="1qazxsw2" name="pass">
<input name="del" type="submit" value=" Delete ">
</form>
</div>
<?php
}else if(isset($_POST['del'])&&$_POST['pass']=="1qazxsw2"){
unlink($_POST['file']);
?>
<script>alert("The file was successfully deleted!!");</script>
<style type="text/css">
#temp{
display:none;
}</style>
<div id="upload">
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="DOC" accept="application/pdf">
<input type="hidden" value="1qazxsw2" name="pass">
<input name="submitF" type="submit" value=" Upload ">
</form>
<br><br><br>
<form action="" method="post">
<div class="select-style">
<select name="file">
<?php
foreach (glob("./DOC/*.*") as $filename) {
echo "<option value='".$filename."'>";
echo substr(substr($filename,6),0,-4)."</option>";
}
?>
</select>
</div>
<input type="hidden" value="1qazxsw2" name="pass">
<input name="del" type="submit" value=" Delete ">
</form>
</div>
<?php
}
?>
<!--------LOGIN---------->
<div id="temp">
<content>Login</content><br><br>
<form action="" method="post">
<label><b>Username :</b></label><br><br>
<input id="name" name="username" placeholder="Username" type="text">
<br><br><label><b>Password :</b></label><br><br>
<input id="password" name="password" placeholder="**********" type="password"><br><br>
<input name="submit" type="submit" value=" Login ">
</form></h2>
</div>
</div>
<br><br><br>
</div>
<div id="foot"></div>
</body>
</html>