/ Forside / Teknologi / Udvikling / PHP / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
PHP
#NavnPoint
rfh 3959
natmaden 3372
poul_from 3310
funbreak 2700
stone47 2230
Jin2k 1960
Angband 1743
Bjerner 1249
refi 1185
10  Interkril.. 1146
Toolbox
Fra : Erik Jakobsen


Dato : 12-08-05 08:41

Hej.

Jeg har ved hjælp af et færdigt script lavet mig en toolbox med
software, som jeg kan hente fra min server, hvis jeg er ude i "marken",
og mangler et software.

Men det jeg har lavet kan jeg desværre ikke downloade fra.

Jeg kan komme ind på siden:

http://dl.urbakken.dk/dl.php

Der kommer et "/" for meget, hvis der prøves at downloade.

Jeg medsender her scriptet dl.php samt config filen, hvis der så er
nogen af jer, der vil se på det, og fortælle mig, hvad der er forkert.

På forhånd tak:

Config fil:

<?php

/* FolderList v1.1 - by Bruno_Funny $$ classes/config.inc.php */

$ver = "FolderList v1.1";
$by = "by Bruno_Funny";


// Sets /////////////////////////////////////////

$g = $_GET; // Set $g like the global var $_GET
$url_to_domain = "http://dl.urbakken.dk"; // Set the url where this
script is
$url_to_files = "http://dl.urbakken.dk/files/"; // Don't forget the /
(slash) in the end of url
$path_to_files = "/var/www/html/files/"; // LINUX/BSD - Don't forget
the / (slash) in the end of path
// $path_to_files = "c:\windows\path\style\"; // WINDOWS - Don't
forget the / (slash) in the end of path

// Colors /////////////////////////////////////////////////

$bg = "#D0CDC4";
$alert = "#000000";
$link_color = "#A69E8E";
$list_bg = "#A69E8E";
$list_bg2 = "#F1F0ED";
$list_header = "#A69E8E";
$list_header_txt = "#FFFFFF";
$list_bg_folders = "#BBB5A8";
$list_bg_files = "#D4D0C8";
$list_files = "#000000";
$list_folders = "#000000";
$alltextaround = "#000000";

?>


indexfil: dl.php:


<?php
///////////////////////////////////////////////////////////
// Developed by Bruno de Oliveira                    //
// E-Mail: brunodeoliveira@gmail.com                 //
// Read INSTALL.TXT before mail-me for support           //
///////////////////////////////////////////////////////////
// Require PHP 4.x ////////////////////////////////////////
///////////////////////////////////////////////////////////

header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");

require("classes/common.inc.php");
require("classes/config.inc.php");
$dataobj = new Common;



?>
<html>
<head>
<title><?php echo $ver; ?> - <?php echo $by; ?></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1"></head>
<style type="text/css">
<!--
..list_header_txt {font-family: Arial, Helvetica, sans-serif; font-size:
12px; font-weight: bold; color: <?php echo $list_header_txt; ?>; }
..list_files {font-family: Arial, Helvetica, sans-serif;   font-size: 12px;
color: <?php echo $list_files; ?>; }
..list_folders {font-family: Arial, Helvetica, sans-serif; font-size:
12px; color: <?php echo $list_folders; ?>; }
..alert {font-family: Arial, Helvetica, sans-serif;   font-size: 16px;
color: <?php echo $alert; ?>; font-weight: bold; }
..alltextaround {font-family: Arial, Helvetica, sans-serif; font-size:
12px; font-weight: bold; color: <?php echo $alltextaround; ?>; }
..copyright {font-family: Arial, Helvetica, sans-serif; font-size: 12px;
font-weight: bold; color: <?php echo $alltextaround; ?>; }
body { background-color: <?php echo $bg ?> ; }
..style11:link, .style11:active, .style11:visited {font-family: Arial,
Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: <?php
echo $link_color ?>; text-decoration: none; }
..style11:hover {font-family: Arial, Helvetica, sans-serif; font-size:
12px; font-weight: bold; color: <?php echo $link_color; ?>;
text-decoration: underline; }
-->
</style>
<?php
if(isset($g['dir'])) {
   if(ereg(".*\..*", $g['dir'])) {
      echo "<div align=\"center\" class=\"alert\">You do drugs?!<br><br><a
href=\"$url_to_domain\" class=\"style11\">Back</a></div>";
      exit();
   }
   $dir = $path_to_files.$g['dir'];
} else {
   $dir = $path_to_files;
}

if (@is_dir($dir)) {
if (!@opendir($dir)) {
      echo "<div align=\"center\" class=\"alert\">The folder doesn't exist
or <br> you have no access !<br><br><a href=\"$url_to_domain\"
class=\"style11\">Back</a></div>";
   } else {
      $dh = opendir($dir);
      while(($file = readdir($dh)) !== false) {
         $info_name[] = $file;
         $info_type[] = filetype($dir ."/". $file);
         $info_size[] = (@filetype($dir ."/". $file) != "dir") ?
$dataobj->formatSize(filesize($dir ."/". $file)) :
$dataobj->getFolderSize($dir."/".$file);         
      }
   }
} else {
   echo "<div align=\"center\" class=\"alert\">The path isn't a valid
readable path !<br><br><a href=\"$url_to_domain\"
class=\"style11\">Back</a></div>";
}
?>
<table width="558" border="0" align="center" cellpadding="2"
cellspacing="2">
<tr>
<td width="550" align="right"><table width="550" border="0"
cellpadding="0" cellspacing="4" bgcolor="<?php echo $list_bg2; ?>">
<tr>
<td align="left" class="style5"><p align="right" class="copyright">
<?php $ver; ?>
-
<?php $by; ?>
</p></td>
</tr>
<tr>
<td align="left" class="alltextaround">You are in :<br>
&nbsp;&nbsp;&nbsp;| - /&nbsp; <a href="?" class="style11">root</a>
<?php
      $pathline = explode("/",$g['dir']);
      $tmp = "";
      for($i=0;$i<count($pathline);$i++) {
         $tmp .= $pathline[$i] ."/";
         echo "<a class=\"style11\"
href=\"$url_to_domain?dir=".substr($tmp,0,strlen($tmp)-1)."\">$pathline[$i]</a>
";
         if((count($pathline)-1)!=$i) { echo "/ "; }
      }
    ?></td>
</tr>
<tr>
<td bgcolor="<?php echo $list_bg; ?>"><table width="100%"
border="0" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="<?php echo $list_header; ?>">
<td width="21">&nbsp;</td>
<td width="379"><span
class="list_header_txt">Filename</span></td>
<td width="29" align="center"><span
class="list_header_txt">Type</span></td>
<td width="120" align="center"><span
class="list_header_txt">Size</span></td>
</tr>
<?php
      for($i=0;$i<count($info_name);$i++) {
         if($info_type[$i] == "dir" && $info_name[$i] != "." && $info_name[$i]
!= "..") {
   ?>
<tr valign="top" bgcolor="<?php echo $list_bg_folders; ?>"
style="cursor: pointer" onClick="window.location='?dir=<?php echo
$g['dir']?>/<?php echo $info_name[$i]; ?>'">
<td><img src="folder.gif" width="18" height="15"></td>
<td><span class="list_folders">
<?php echo $info_name[$i]; ?>
</span></td>
<td align="center" class="list_folders"><?php echo
$info_type[$i]; ?></td>
<td align="right" class="list_folders"><?php echo
$info_size[$i]; ?></td>
</tr>
<?php
         }
      }
   ?>
<?php
      for($i=0;$i<count($info_name);$i++) {
         if($info_type[$i] != "dir" && $info_name[$i] != "." && $info_name[$i]
!= "..") {
   ?>
<tr valign="top" bgcolor="<?php echo $list_bg_files; ?>">
<td align="center"><a href="<?php echo $url_to_files;
?><?php echo $g['dir']?>/<?php echo $info_name[$i]; ?>"><img
src="disk.gif" width="18" height="15" style="cursor: pointer"
border="0"></a></td>
<td><span class="list_files">
<?php echo $info_name[$i]; ?>
</span></td>
<td align="center" class="list_files"><?php echo
$info_type[$i]; ?></td>
<td align="right" class="list_files"><?php echo
$info_size[$i]; ?></td>
</tr>
<?php
         }
      }
   ?>
</table></td>
</tr>
<tr>
<td align="left" class="style5"><p align="right"
class="copyright"><?php $ver; ?> - <?php $by; ?></p></td>
</tr>
</table></td>
</tr>
</table>
</html>
<?php clearstatcache(); // Free used memory ?>

 
 
kurt.torp@webspeed.d~ (12-08-2005)
Kommentar
Fra : kurt.torp@webspeed.d~


Dato : 12-08-05 11:33

Erik Jakobsen wrote:

> Hej.
>
> Jeg har ved hjælp af et færdigt script lavet mig en toolbox med
> software, som jeg kan hente fra min server, hvis jeg er ude i "marken",
> og mangler et software.
>
> Men det jeg har lavet kan jeg desværre ikke downloade fra.
>
> Jeg kan komme ind på siden:
http://www.urbakken.dk/dl.php
> http://dl.urbakken.dk/dl.php
Hej
dit link virker ikke det gør derimod dette
http://www.urbakken.dk/dl.php
og så kan man også downloade og hente fra dette link
http://www.urbakken.dk/files//Processes/cports.zip
> Der kommer et "/" for meget, hvis der prøves at downloade.
>
> Jeg medsender her scriptet dl.php samt config filen, hvis der så er
> nogen af jer, der vil se på det, og fortælle mig, hvad der er forkert.
>
> På forhånd tak:
>
> Config fil:
>
> <?php
>
> /* FolderList v1.1 - by Bruno_Funny $$ classes/config.inc.php */
>
> $ver = "FolderList v1.1";
> $by = "by Bruno_Funny";
>
>
> // Sets /////////////////////////////////////////
>
> $g = $_GET; // Set $g like the global var $_GET
> $url_to_domain = "http://dl.urbakken.dk"; // Set the url where this
> script is
> $url_to_files = "http://dl.urbakken.dk/files/"; // Don't forget the /
> (slash) in the end of url
> $path_to_files = "/var/www/html/files/"; // LINUX/BSD - Don't forget
> the / (slash) in the end of path
> // $path_to_files = "c:\windows\path\style\"; // WINDOWS - Don't
> forget the / (slash) in the end of path
>
> // Colors /////////////////////////////////////////////////
>
> $bg = "#D0CDC4";
> $alert = "#000000";
> $link_color = "#A69E8E";
> $list_bg = "#A69E8E";
> $list_bg2 = "#F1F0ED";
> $list_header = "#A69E8E";
> $list_header_txt = "#FFFFFF";
> $list_bg_folders = "#BBB5A8";
> $list_bg_files = "#D4D0C8";
> $list_files = "#000000";
> $list_folders = "#000000";
> $alltextaround = "#000000";
>
> ?>
>
>
> indexfil: dl.php:
>
>
> <?php
> ///////////////////////////////////////////////////////////
> // Developed by Bruno de Oliveira //
> // E-Mail: brunodeoliveira@gmail.com //
> // Read INSTALL.TXT before mail-me for support //
> ///////////////////////////////////////////////////////////
> // Require PHP 4.x ////////////////////////////////////////
> ///////////////////////////////////////////////////////////
>
> header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header ("Cache-Control: no-cache, must-revalidate");
> header ("Pragma: no-cache");
>
> require("classes/common.inc.php");
> require("classes/config.inc.php");
> $dataobj = new Common;
>
>
>
> ?>
> <html>
> <head>
> <title><?php echo $ver; ?> - <?php echo $by; ?></title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1"></head>
> <style type="text/css">
> <!--
> .list_header_txt {font-family: Arial, Helvetica, sans-serif; font-size:
> 12px; font-weight: bold; color: <?php echo $list_header_txt; ?>; }
> .list_files {font-family: Arial, Helvetica, sans-serif; font-size: 12px;
> color: <?php echo $list_files; ?>; }
> .list_folders {font-family: Arial, Helvetica, sans-serif; font-size:
> 12px; color: <?php echo $list_folders; ?>; }
> .alert {font-family: Arial, Helvetica, sans-serif; font-size: 16px;
> color: <?php echo $alert; ?>; font-weight: bold; }
> .alltextaround {font-family: Arial, Helvetica, sans-serif; font-size:
> 12px; font-weight: bold; color: <?php echo $alltextaround; ?>; }
> .copyright {font-family: Arial, Helvetica, sans-serif; font-size: 12px;
> font-weight: bold; color: <?php echo $alltextaround; ?>; }
> body { background-color: <?php echo $bg ?> ; }
> .style11:link, .style11:active, .style11:visited {font-family: Arial,
> Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: <?php
> echo $link_color ?>; text-decoration: none; }
> .style11:hover {font-family: Arial, Helvetica, sans-serif; font-size:
> 12px; font-weight: bold; color: <?php echo $link_color; ?>;
> text-decoration: underline; }
> -->
> </style>
> <?php
> if(isset($g['dir'])) {
> if(ereg(".*\..*", $g['dir'])) {
> echo "<div align=\"center\" class=\"alert\">You do drugs?!<br><br><a
> href=\"$url_to_domain\" class=\"style11\">Back</a></div>";
> exit();
> }
> $dir = $path_to_files.$g['dir'];
> } else {
> $dir = $path_to_files;
> }
>
> if (@is_dir($dir)) {
> if (!@opendir($dir)) {
> echo "<div align=\"center\" class=\"alert\">The folder doesn't exist
> or <br> you have no access !<br><br><a href=\"$url_to_domain\"
> class=\"style11\">Back</a></div>";
> } else {
> $dh = opendir($dir);
> while(($file = readdir($dh)) !== false) {
> $info_name[] = $file;
> $info_type[] = filetype($dir ."/". $file);
> $info_size[] = (@filetype($dir ."/". $file) != "dir") ?
> $dataobj->formatSize(filesize($dir ."/". $file)) :
> $dataobj->getFolderSize($dir."/".$file);
> }
> }
> } else {
> echo "<div align=\"center\" class=\"alert\">The path isn't a valid
> readable path !<br><br><a href=\"$url_to_domain\"
> class=\"style11\">Back</a></div>";
> }
> ?>
> <table width="558" border="0" align="center" cellpadding="2"
> cellspacing="2">
> <tr>
> <td width="550" align="right"><table width="550" border="0"
> cellpadding="0" cellspacing="4" bgcolor="<?php echo $list_bg2; ?>">
> <tr>
> <td align="left" class="style5"><p align="right"
> class="copyright">
> <?php $ver; ?>
> -
> <?php $by; ?>
> </p></td>
> </tr>
> <tr>
> <td align="left" class="alltextaround">You are in :<br>
> &nbsp;&nbsp;&nbsp;| - /&nbsp; <a href="?" class="style11">root</a>
> <?php
> $pathline = explode("/",$g['dir']);
> $tmp = "";
> for($i=0;$i<count($pathline);$i++) {
> $tmp .= $pathline[$i] ."/";
> echo "<a class=\"style11\"
>
href=\"$url_to_domain?dir=".substr($tmp,0,strlen($tmp)-1)."\">$pathline[$i]</a>
> ";
> if((count($pathline)-1)!=$i) { echo "/ "; }
> }
> ?></td>
> </tr>
> <tr>
> <td bgcolor="<?php echo $list_bg; ?>"><table width="100%"
> border="0" align="center" cellpadding="2" cellspacing="2">
> <tr bgcolor="<?php echo $list_header; ?>">
> <td width="21">&nbsp;</td>
> <td width="379"><span
> class="list_header_txt">Filename</span></td>
> <td width="29" align="center"><span
> class="list_header_txt">Type</span></td>
> <td width="120" align="center"><span
> class="list_header_txt">Size</span></td>
> </tr>
> <?php
> for($i=0;$i<count($info_name);$i++) {
> if($info_type[$i] == "dir" && $info_name[$i] != "." && $info_name[$i]
> != "..") {
> ?>
> <tr valign="top" bgcolor="<?php echo $list_bg_folders; ?>"
> style="cursor: pointer" onClick="window.location='?dir=<?php echo
> $g['dir']?>/<?php echo $info_name[$i]; ?>'">
> <td><img src="folder.gif" width="18" height="15"></td>
> <td><span class="list_folders">
> <?php echo $info_name[$i]; ?>
> </span></td>
> <td align="center" class="list_folders"><?php echo
> $info_type[$i]; ?></td>
> <td align="right" class="list_folders"><?php echo
> $info_size[$i]; ?></td>
> </tr>
> <?php
> }
> }
> ?>
> <?php
> for($i=0;$i<count($info_name);$i++) {
> if($info_type[$i] != "dir" && $info_name[$i] != "." && $info_name[$i]
> != "..") {
> ?>
> <tr valign="top" bgcolor="<?php echo $list_bg_files; ?>">
> <td align="center"><a href="<?php echo $url_to_files;
> ?><?php echo $g['dir']?>/<?php echo $info_name[$i]; ?>"><img
> src="disk.gif" width="18" height="15" style="cursor: pointer"
> border="0"></a></td>
> <td><span class="list_files">
> <?php echo $info_name[$i]; ?>
> </span></td>
> <td align="center" class="list_files"><?php echo
> $info_type[$i]; ?></td>
> <td align="right" class="list_files"><?php echo
> $info_size[$i]; ?></td>
> </tr>
> <?php
> }
> }
> ?>
> </table></td>
> </tr>
> <tr>
> <td align="left" class="style5"><p align="right"
> class="copyright"><?php $ver; ?> - <?php $by; ?></p></td>
> </tr>
> </table></td>
> </tr>
> </table>
> </html>
> <?php clearstatcache(); // Free used memory ?>


Erik Jakobsen (12-08-2005)
Kommentar
Fra : Erik Jakobsen


Dato : 12-08-05 15:19

kurt.torp@webspeed.dk wrote:

>>Jeg kan komme ind på siden:
> http://www.urbakken.dk/dl.php
>>http://dl.urbakken.dk/dl.php
> Hej
> dit link virker ikke det gør derimod dette
> http://www.urbakken.dk/dl.php
> og så kan man også downloade og hente fra dette link
> http://www.urbakken.dk/files//Processes/cports.zip

Hej Kurt, og tak for svaret.

Det kan jeg jo leve med, men hvordan laver jeg det, så
dl.urbakken.dk/dl.php virker, og der kan downloades, når
url'en er åbnet ?

dl er sat hos min dns isp.

Erik

Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408928
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste