0
我有一個生成頭像的腳本。這裏是我的結構:如何限制訪問我的網站的腳本爲他人?
-folder1
-scripts
-MakeAvatar.php
-img
-avatar
我用它在其它頁是這樣的:
$name = 'anything';
$hash = md5($name);
$input = "http://localhost/folder1/scripts/MakeAvatar.php?hash=$hash";
$output = "../../folder1/img/avatar/".$name.".jpg";
file_put_contents($output, file_get_contents($input));
正如你看到的,每個人都可以訪問這個腳本,並進行頭像:
http://localhost/folder1/scripts/MakeAvatar.php?hash=$hash
如何我可以將該腳本專門用於我自己的網站並禁止其他人使用它嗎?
@stack這實際上是一個行業標準。如果你進入MVC或框架,你會發現我們傾向於盡我們所能從用戶那裏儘可能地隔離網站。回答你的問題,不。即使有人可以看到你如何稱呼腳本(他們不能),除非他們有服務器訪問(他們不會),他們看不到腳本。 – amflare