El sitio más completo sobre programación, recursos web y herramientas online para Webmasters
Fecha: 25/11/2005

Administracion php

Trucos php:
Una herramienta de administración


Código Php


<?
//rmdir("d:\\Inetpub\\wwwroot\\IE\\management\\del")
//rename("d:\\Inetpub\\wwwroot\\IE\\management\\txt", "d:\\Inetpub\\wwwroot\\IE\\management\\del");
if($doit == "upload")
{
$dirtmp = $dir;
$pos = strrpos($userfile , "\\");
$filefull = substr($userfile, ($pos+1), 200);
if($dirtmp != "")
{
$a = 0;
$putstr = "";
$check = "GO";
$pos1 = strpos($dirtmp, "/");
$dirtmp = substr($dirtmp, ($pos1+1), 200);
$check1 = "/";
$check2 = "\\";
$putstr = ereg_replace("$check1", "$check2", $dir);
$dest = "d:\\Inetpub\\wwwroot\\IE\\$putstr\\$filefull";
copy($userfile, $dest);
}
else
{
$dest = "d:\\Inetpub\\wwwroot\\IE\\$filefull";
copy($userfile, $dest);
}
$doit = "make";
}
if($doit == "make")
{
if($type == "dir")
{
mkdir("..$dir/$name", 7777);
}
if($type == "file")
{
if($extension != "")
{
$name .= $extension;
}
$myFile = fopen("..$dir/$name", "w");
if(!(myFile))
{
print("file could not be saved");
exit;
}
fputs($myFile, " ");
fclose($myFile);
}
$tmp = $dir;
$dir = "..";
$dir .= $tmp;
}
?>
<html>
<body>
<style TYPE="text/css">
A:link, A:visited, A:active
{
text-decoration: none;
color: black;
}
</style>
<font face='Verdana' size='1'>
<?
////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($dir == "")
{
$dir = "..";
$level = 0;
}
$dirr = $dir;
$myDir = dir("$dir");
$count = 0;
while($entryName = $myDir->read())
{
if($count > 1)
{
$tmp = strrpos($entryName , ".");
if($tmp != "")
{
$files[] = $entryName;
}
if($tmp == "")
{
$dirs[] = $entryName;
}
}
$count++;
}
$myDir->close();
print("<b>Curent directory<br>");
if($dir == "..")
{
print("<a href='main_left.php?dir='>Root://</a>");
}
else
{
print("<a href='main_left.php?dir='>Root://</a>");
}
$counter = 0;
$dirW = $dir;
$dirW .= "/";
$pos2 = 1;
$lenght = strlen("$dirW");
while($pos2 != "")
{
$write2 .= "$write";
print(" <a href='main_left.php?dir=..$write2'>$write</a> <br>");
$pos = strpos($dirW, "/");
$dirA = substr($dirW, $pos , $lenght);
$dirW = substr($dirW, $pos+1 , $lenght);
$pos2 = strpos($dirW, "/");
$write = substr($dirA, 0 , $pos2+1);
$counter++;
if($counter == 100)
{
break;
}
}
print("</b><p>");
print("<b><a href='main_left.php?type=dir&dir=$dirr'>Dirs</a></b><br>");
for($a = 0; $a < count($dirs); $a++)
{
print("<a href='main_left.php?dir=$dir/$dirs[$a]'><img src='images/map.jpg' border='0'></a> $dirs[$a]<br>");
}
print("<p>");
print("<b><a href='main_left.php?type=file&dir=$dirr'>Files</a></b><br>");
for($a = 0; $a < count($files); $a++)
{
$position = strrpos($files[$a], ".");
$temp = substr($files[$a] , $position+1, 5);
print("<a href='main_right.php?file=..$write2/$files[$a]' target='main_right'><img src='images/$temp.jpg' border='0' width='14' height='14'></a>$files[$a]<br>");
}
print("</b><p>");
print("<b><a href='main_left.php?type=upload&dir=$dirr'>Upload</a></b><br>");
?>
<?
if($type != "")
{
?>
<form action='main_left.php' method='post'>
<?
if($type == "dir")
{
?>
Directory<br>
<input type='hidden' name='doit' value='make'>
<input type='hidden' name='type' value='dir' >
<input type='hidden' name='dir' value='<?print("$write2");?>'>
<input type='text' name='name' size='18' style='font-family:verdana;font-size: 10px'><br>
<input type='submit' value='make dir' style='font-family:verdana;font-size: 10px'>
</from>
<?
}
if($type == "file")
{
?>
File<br>
<input type='hidden' name='doit' value='make'>
<input type='hidden' name='type' value='file'>
<input type='hidden' name='dir' value='<?print("$write2");?>'>
<input type='text' name='name' size='18' style='font-family:verdana;font-size: 10px'><br>
<select name='extension' style='font-family:verdana;font-size: 10px'>
<option value='.html' selected> .html</option>
<option value='.txt'> .txt</option>
<option value=''>type extension</option>
<!--
<option value='.php'> .php</option>
<option value='.asp'> .asp</option>
<option value='.pl'> .pl</option>
-->
</select><br>
<input type='submit' value='make file' style='font-family:verdana;font-size: 10px'>
</from>
<?
}
if($type == "upload")
{
?>
<form enctype='multipart/form-data' action='' method='POST'>
<input type='hidden' name='doit' value='upload'>
<input type='hidden' name='dir' value='<?print("$write2");?>'>
<input type='hidden' name='MAX_FILE_SIZE' value='10000'>
Filename:<br>
<input name='userfile' type='file' size='12' style='font-family:verdana;font-size: 10px'><br>
<input type='submit' value='Send File' style='font-family:verdana;font-size: 10px'>
</form>
<?
}
}
?>
</body>
</html>
Administracion php Categoría: Trucos, Php


Scripts Similares:

» Administrar BD php
» Buscar item php
» Buscar php
» Buscar y reemplazar php
» Campos ocultos php
» Contador en php
» Contador php
» Crear carpetas php
» Dropdown php
» Editar pagina php

Privacidad ּ Publicidad ּ Prensa ּ Premios ּ Colaborar ּ Enlazarnos ּ Mapa del Sitio ּ Aviso legal ּ Boletín ּ Contacto
2001 - 2011 | Sitio creado y mantenido por Gabriel Marcelo Rodríguez
Hosting de alta calidad a bajo costo Neolo.com.ar