| | |
ftp help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2004
Posts: 2
Reputation:
Solved Threads: 0
Im new to PHP so please be gentle...
Im trying to make a script that allows a user to enter a user name and pass, but no path, the path should be hidden from the user.
I want them to only be able to view whats in the folder I direct them to and upload a file plus not be able to browse, edit or create other folders.
All the scripts I found allow the user to insert a path to the server and allows them full access to all the folders, which I dont want.
Can I do that? or am I asking to much?
Samples would be nice.
Thanks
Kam
Im trying to make a script that allows a user to enter a user name and pass, but no path, the path should be hidden from the user.
I want them to only be able to view whats in the folder I direct them to and upload a file plus not be able to browse, edit or create other folders.
All the scripts I found allow the user to insert a path to the server and allows them full access to all the folders, which I dont want.
Can I do that? or am I asking to much?
Samples would be nice.
Thanks
Kam
•
•
Join Date: Oct 2004
Posts: 14
Reputation:
Solved Threads: 1
hello kamui,
a part of your answer:
- identification of user
- read all the files/directory of a directory
todo:
- read a file for the transfert
- display only files on the list (actually all elements appears file & dir.)
find it on http://fpepito.dyndns.org/php/test2.php
see you, and hope that help you,
fpepito
[PHP]
<?
$logins = array(
"user" => "php",
"login" => "pass"
);
# quick check of user
function check_user ($log, $pas) {
global $logins;
if (($logins[$log] == $pas) && !($log == "") ) {
return 1;
} else {
return 0;
}
}
# read directory
function read_dir ($path) {
global $PHP_SELF,$login,$pass;
$ls = popen ("/bin/ls $path", "r");
echo "The link does not open the file<BR>\n";
while (!feof($ls)) {
$buffer = fgetss($ls, 4096);
#here the link to read the file
echo "<A HREF=$PHP_SELF?login=$login&pass=$pass&read=$buffer>$buffer</A><BR>";
}
}
if (isset($login) && (check_user($login,$pass)==1)) {
echo "welcome $login<BR>";
read_dir ("/var/cache/man/X11R6");
} else {
echo "for test try:<BR>\nlogin = user<BR>\npass=php<BR>\n";
echo "<FORM ACTION=$PHP_SELF>\n";
echo "Login : <INPUT TYPE=TEXT NAME=login><BR>\n";
echo "Pass : <INPUT TYPE=TEXT NAME=pass><BR>\n";
echo "<INPUT TYPE=submit value=\"Identify\">\n";
echo "</FORM>\n";
}
?>
[/PHP]
a part of your answer:
- identification of user
- read all the files/directory of a directory
todo:
- read a file for the transfert
- display only files on the list (actually all elements appears file & dir.)
find it on http://fpepito.dyndns.org/php/test2.php
see you, and hope that help you,
fpepito
[PHP]
<?
$logins = array(
"user" => "php",
"login" => "pass"
);
# quick check of user
function check_user ($log, $pas) {
global $logins;
if (($logins[$log] == $pas) && !($log == "") ) {
return 1;
} else {
return 0;
}
}
# read directory
function read_dir ($path) {
global $PHP_SELF,$login,$pass;
$ls = popen ("/bin/ls $path", "r");
echo "The link does not open the file<BR>\n";
while (!feof($ls)) {
$buffer = fgetss($ls, 4096);
#here the link to read the file
echo "<A HREF=$PHP_SELF?login=$login&pass=$pass&read=$buffer>$buffer</A><BR>";
}
}
if (isset($login) && (check_user($login,$pass)==1)) {
echo "welcome $login<BR>";
read_dir ("/var/cache/man/X11R6");
} else {
echo "for test try:<BR>\nlogin = user<BR>\npass=php<BR>\n";
echo "<FORM ACTION=$PHP_SELF>\n";
echo "Login : <INPUT TYPE=TEXT NAME=login><BR>\n";
echo "Pass : <INPUT TYPE=TEXT NAME=pass><BR>\n";
echo "<INPUT TYPE=submit value=\"Identify\">\n";
echo "</FORM>\n";
}
?>
[/PHP]
![]() |
Similar Threads
- HELP WITH FTP, PLEASE: (Visual Basic 4 / 5 / 6)
- Tek's FTP (Networking Hardware Configuration)
- FTP files (Geeks' Lounge)
Other Threads in the PHP Forum
- Previous Thread: Feeding a value in a dropdown list to another dropdown list
- Next Thread: Problems with first php file
| Thread Tools | Search this Thread |
advanced alerts apache api archive array autosuggest beginner binary broken cakephp checkbox class clients cms code cron curl database date datepart display dynamic echo email emptydisplayvalue eregi error execute explodefunction file files folder form forms function functions google hack head href htaccess html if...loop image include insert ip javasciptvalidation javascript joomla keywords library limit link login mail matching menu mlm multiple mysql object oop password paypal pdf php phpincludeissue query radio random recursion recursive remote script search searchbox server sessions shot smarty source space speed sql syntax system table tutorial update upload url validator variable vbulletin video web website youtube





