|
użytkowników online: 61
|
OPINIE UŻYTKOWNIKÓW
|
Przyznam, że jestem pod sporym wrażeniem. Od wielu lat zajmuje się grafiką przeznaczoną do druku ze szczególnym uwzględnieniem opakowań. Z radością stwierdzam, iż twórca serwisu jest moim ulubionym typem potencjalnego współpracownika (choć branża troszeczkę inna) tzn. pada pytanie i błyskawicznie pada konkretna odpowiedź bez względu na stopień skomplikowania pytania. Gorąco polecam współpracę, gdyż macie pewność że nie zostaniecie potraktowani sloganami typu "oczywiście", "nie ma sprawy" tylko otrzymacie konkretną pomoc. Tak trzymać! Na pewno jeszcze nie raz skorzystam
Paweł
Studio Gama
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
symlink (PHP 3, PHP 4, PHP 5) symlink -- Creates a symbolic link Descriptionbool symlink ( string target, string link )
symlink() creates a symbolic link
from the existing target with
the specified name link.
Zwraca TRUE w przypadku sukcesu, FALSE w
przypadku porażki.
Notatka: Ta funkcja nie jest dostępna na
platformie Windows.
See also link() to create hard links,
and readlink() along with
linkinfo().
User Contributed Notes29-Dec-2005 04:21
Olszewski seems pretty good, but just to boost the security a bit, the fifth line of his script should read
<?
...
$q = rand(1,26);
...
?>
instead of rand(1,24).
contact at tcknetwork dot com
11-Sep-2005 05:04
To make your code portable on unix AND win32, do the following
1. Download http://www.dynawell.com/reskit/microsoft/win2000/linkd.zip
2. Unzip, put linkd.exe in C:\Windows\System32 or C:\WINNT\System32
3. Include in your code the following
<?
function _syslink($t ,$l ) {
if ($_SERVER["WINDIR"]) {
$p=dirname($_SERVER["SCRIPT_FILENAME"])."/";
exec("linkd ".$p.$t." ".$p.$l);
} else syslink($t,$l);
}
function _unlink($l ) {
if ($_SERVER["WINDIR"]) {
$p=dirname($_SERVER["SCRIPT_FILENAME"])."/";
exec("linkd ".$p.$l." /D");
} else unlink($l);
}
?>
4. Enjoy
_symlink(TARGET,LINK) works like symlink() on *nix
_unlink(LINK) to delete properly the link created
11-May-2005 08:12
aircha at cix dot co dot uk
15-Mar-2005 05:49
Olszewski's method of creating downloadable links on the fly is pretty good.
I use a different technique under Apache where if you want a file, you might use a url like:
mydomain.com/files/mysecretfile.doc
But in fact Apache redirects this to a script with a url like:
mydomain.com/utilities/downloadfile.php?filename=mysecretfile.doc
(The browser address bar will still show the first url).
The script downloadfile.php can then handle all the mucky stuff like checking session variables to see if someone is logged on, whether they have access to mysecretfile.doc, and if you want to encrypt before download.
An advantage of this is that the php code to achieve the equivalent of Olszewski's is shorter, so might execute faster. But more importantly, a casual hacker might think all he has to do is find myverysecurefile.doc under the /home/user/public_html/files/mysecretfile.doc, or copy the url - but there's nothing there! He won't find it or get an Apache error page.
khaireel at gmail dot com
17-Oct-2004 06:27
I find olszewski's method of utilizing symlink is great. Solved my problem of hiding the URLs that I dont wish users to know about.
Although, just to point out, I had to write a special page (or condition on a page) to allow the download process to be effective. The server wont allow direct downloads from the $downloadURL.
veronique at talafone dot com
29-May-2003 11:23
This might sound obvious, but sometimes these details slip from our minds...
Make sure the directory in which you are trying to create the symbolic link (AND the directory you are trying to link to in the case of directory linking) has the proper permissions, or you will get a "permission denied" from PHP. If you use for example,
echo shell_exec("ln -sv $target $name")
you might get the correct "link created" message, but without the link being actually created.
It's probably the same thing with hard links, I just haven't tried it.
stephen at opido dot com
07-Feb-2002 09:38
Faking Symlinks on Windows (Win2K + NTFS)
Every once in a while I'll bang my head against something really difficult. I needed to make symlinks, Windows won't let me. The workaround is a couple files in the Win2K Resource Kit called linkd.exe and delrp.exe
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q205524
It only works on folders as far as I can tell, there is another program from SysInternals called Junction which will do both (although I only had success with files, not folders).
http://www.sysinternals.com/ntw2k/source/misc.shtml#junction
I hope this helps those who have experienced this same problem. One step closer to portable applications :)
olszewski_marek at yahoo dot com
04-Dec-2000 05:54
Here is a simple way to control who downloads your files...
You will have to set: $filename, $downloaddir, $safedir and $downloadURL.
Basically $filename is the name of a file, $downloaddir is any dir on your server, $safedir is a dir that is not accessible by a browser that contains a file named $filename and $downloadURL is the URL equivalent of your $downloaddir.
The way this works is when a user wants to download a file, a randomly named dir is created in the $downloaddir, and a symbolic link is created to the file being requested. The browser is then redirected to the new link and the download begins.
The code also deletes any past symbolic links created by any past users before creating one for itself. This in effect leaves only one symbolic link at a time and prevents past users from downloading the file again without going through this script. There appears to be no problem if a symbolic link is deleted while another person is downloading from that link.
This is not too great if not many people download the file since the symbolic link will not be deleted until another person downloads the same file.
Anyway enjoy:
$letters = 'abcdefghijklmnopqrstuvwxyz';
srand((double) microtime() * 1000000);
$string = '';
for ($i = 1; $i <= rand(4,12); $i++) {
$q = rand(1,24);
$string = $string . $letters[$q];
}
$handle = opendir($downloaddir);
while ($dir = readdir($handle)) {
if (is_dir($downloaddir . $dir)){
if ($dir != "." && $dir != ".."){
@unlink($downloaddir . $dir . "/" . $filename);
@rmdir($downloaddir . $dir);
}
}
}
closedir($handle);
mkdir($downloaddir . $string, 0777);
symlink($safedir . $filename, $downloaddir . $string . "/" . $filename);
Header("Location: " . $downloadURL . $string . "/" . $filename);
shrike at il dot fontys dot nl
09-Jun-1999 06:48
symlink doesn't check if a target is present (at least 3.0.9-linux doesn't). Fortunately, since you can still store info in the target-part of a symlink.
|