<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv = 'refresh' content = '2000; url = displaylinks.php'>
<link rel="stylesheet" href="PopupWindowModal.css">

<link href="img_favicon.png" rel="icon">
<link href="img_favicon.png" rel="apple-touch-icon">

<style>
body{max-width:1200px; margin:5px auto; font-family:arial;}
.sdm{margin-top:-15px;}
.paper { column-count: 3; column-gap: 5px; column-rule: 1px solid lightblue; font-size:18px; line-height:14px;}
title {background:yellow; font-size:20px; color:red; padding:3px; border:1px solid black;}
alt {background:yellow; font-size:20px; color:red; padding:3px; border:1px solid black;}

.clgr {color:red;}
.clgr2 {color:blue;}
.clgr3 {color:limegreen;}
.clgr4 {color:#000099;}
.clgr5 {color:#ff6600;}
.clgr6 {color:#cc0099;}
.clgr7 {color:#00cc00;}
.clgr8 {background:rgba(255,0,0,0.2);}
.clgr8:hover {background:rgba(255,0,0,1.0);}


@media only screen and (max-width: 600px) {
body {font-size:18px; margin-top:5px;}
.paper { font-size:19px; column-count: 1; width: 90%; line-height:17px;}
}

</style>


<!-- <a href='../SingleFileDelete.php?do=$image'> <center> Delete </center> </a> <br> -->

<?php
$delete = 'extraimages/'. $_GET['do'].'';
if(unlink("$delete")){echo "<center> <h3 style='font-family:arial; color:red; font-size:25px; line-height:33px;'> '$delete'<br> <span style='color:limegreen;'> File is deleted succesfully </span> </h3> </center>
<br> <meta http-equiv = 'refresh' content = '2; url = displaylinks.php?done'>";}
elseif(unlink("$delete")) {echo "<center> <h3 style='font-family:arial; font-size:25px; color:red;'>Select File and Delete </h3> </center><br>";}
else {echo "<center> <h3 style='font-family:arial; font-size:25px; color:red;'> Select File View and Delete</h3> </center><br>";}

/*
echo "<div style='margin-top:-50px;'>";
$dir = "extraimages";
$file= scandir($dir,1);
echo "<ol class='paper'>";
foreach ($file as $value) {
  echo "<span style='color:black; font-family:arial; font-size:20px; line-height:18px;'> 
  <li> <a href='displaypage.php?sk3=extraimages/$value' title='OPEN FILE'> $value </a>
  &nbsp;- <a href='?do=$value' class='clgr8' style='color:white;' title='DELETE FILE'> 
  <span style='font-family:arial; padding:0px 4px; border-radius:5px;'> <b> X </b></a> </li> </span><br>";
}
echo "</ol>";
echo "</div>";
*/

echo "<div style='margin-top:-50px;'>";
$dir = 'extraimages/';
echo "<ol class='paper'>";
  if (file_exists($dir) && is_dir($dir) ) {
      $scan_arr = scandir($dir,1);
      $files_arr = array_diff($scan_arr, array('.','..','index.php','error_log','delete.php'));

      foreach ($files_arr as $value) {
echo "<span style='color:black; font-family:arial; font-size:20px; line-height:18px;'>
<li> <a href='displaylinks.php?id=extraimages/$value#popup1' title='OPEN FILE'> $value </a>
         <!-- displaypage.php?sk3=extraimages/$value -->
  &nbsp;- <a href='?do=$value' class='clgr8' style='color:white;' title='DELETE FILE'> 
  <span style='font-family:arial; padding:0px 4px; border-radius:5px;'> <b> X </b></a> </li> </span><br>";
      }
  }
  else {
    echo "Directory does not exist";
  }
echo "</ol>";
echo "</div>";
?>





<!DOCTYPE html>
<html>
<head>
<title>DISPLAY LINKS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="favicon.png" rel="icon">
  <link href="favicon.png" rel="apple-touch-icon">
  
<style>
body{font-family:arial;}
a:visited, a:link, a:active{color:blue; text-decoration:none;}
a:hover{color:red;}
.sd{background:red; color:white; }
.sd:hover{background:limegreen; color:yellow; }
</style>

</head>

<body style="background: linear-gradient(to bottom right, #ffffff 50%, #e6ffff 70%, #ffccff 100%); 
background-repeat: no-repeat; background-attachment: fixed;">


<!-- Upload Files Start -->
<?php  
$target_dir = "extraimages/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) 
{
echo "<center><h2 style='color:#00cc00; font-family:arial; line-height:33px;'><b> 
<img src='$target_file' width='125' height='125'> <br> $target_file </b> <br> 
<span style='color:blue;'> The file has been successfully upload.</span> </h2> </center> 
<meta http-equiv = 'refresh' content = '4; url = displaylinks.php'> ";
} 
else
{
echo "<center><h2 style='color:#009900; font-family:arial;'><b> Select Any-File and Upload </b></h2></center>";
}
?>

 <div style="background: linear-gradient(to top, #0066ff 0%, #ccffff 100%); 
padding:5px; max-width:340px; font-family:arial; margin:5px auto; border-radius:12px;">
    
<center>
<span style='color:#006600;'> You Have Upload Anytype file. </span>
<h2 style='margin:4px;color:#000;'><b> Select Any-File to Upload</b></h2>
</center>

<form action="" method="post" enctype="multipart/form-data">
<center><input type="file" name="fileToUpload" id="fileToUpload" style="font-size:20px; 
font-family:arial; background:white; padding:2px; max-width:330px; cursor:pointer; color:#000;"></center>
<center><input type="submit" value="Upload File" name="submit" style="margin-top:5px; 
font-size:18px; font-family:arial; background:white; padding:5px; cursor:pointer; border-radius:5px;"></center>
</form>
</div>

<!--
<center> Your Uploaded File Image </center>

<div style="background:url(img_favicon.png); background-repeat:no-repeat; width:125px; height:125; margin:1px auto;">
<img src="<?php echo $target_file ;?>" widt='125px' height='125px'>
</div>
-->
<br>
<br>
<br>

<!-- Upload Files End -->





<!-- Popup Window Details -->
<div id="popup1" class="overlay" >
<div class="popup">
<center><h2>--- Details ---</h2></center>
<a class="close" href="displaylinks.php" title="CLOSE">&times;</a>
<div class="content">
    
<?php
$id = $_GET['id'];
echo "<center> Image Name: $id </center>";
echo "<a href='/db71/all/loginsystem1/postsbyusers/aaa/$id' target='_blank'> 
<center> <img src='/db71/all/loginsystem1/postsbyusers/aaa/$id' width='200' height='200' vspace='9px'> </center> </a>";
echo "<center> click image to enlarge </center><br>";
echo "<center> Back to <a href='displaylinks.php'> <b>HomePage</b></a> </center><br>";
?>

</div>
</div>
</div>

<!-- End Popup Window Details -->


</body>
</html>

