mrudnick Posted December 8, 2006 Share Posted December 8, 2006 Hello all,First let me say that I don't really know PHP at all.What I want to do is have an HTML page where users type in a username and password. After they click submit they are redirected to"ftp://username:[email protected]" where they can download and upload files to their folder.Each username will have a folder in the directory that has the same name as the username. `So if "Mark" logs in, I want him to see the contents of the "Mark" folder where he can upload and download files. I don't want him to have access to anything else.As I know nothing, I did a lot of reading up and researching on how to do this (lots of great information on this site by the way) but the PHP code might still be way off.Here is the code I have so far:for the html login page:<html><body><form name="form" method="post" action="ftp.php">Username: <input name="username" type="text" size="30">Password: <input name="password" type="password" size="30"><input type="Submit" size="8" value="Submit"></p></form></body></html>the code for the ftp.php page is :<?php$ftp_server = 'domain.com'; //domain being the future website domain$ftp_username =$_POST['username'];$ftp_password =$_POST['password'];$location = 'ftp://$ftp_username:$ftp_password@$ftp_server';header('Location: $location');$ftp_connect_id = ftp_connect($ftp_server);$ftp_login = ftp_login($ftp_connect_id, $ftp_username, $ftp_password);if (! $ftp_connect_id || ! $ftp_login){echo "Unable to connect to ".$ftp_server;exit;} else {echo "Connected to host "<p>";}ftp_close($ftp_connect_id);?>right now, when i check it, I log on the html page and go the the php page where all it says is "Connected to host."I don't see the "ftp://username:[email protected]" that I want to see.Any help is greatly appreciated Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/ Share on other sites More sharing options...
damillerva Posted March 4, 2007 Share Posted March 4, 2007 I have the same question regarding the below topic. I did not see any replies to this question. I am trying to use a website to have clients login to the host ftp site. My web template is made with Swish. The below question is the only familiar topic I can find to get assistance with this. Any help?[quote author=mrudnick link=topic=117908.msg481346#msg481346 date=1165613019]Hello all,First let me say that I don't really know PHP at all.What I want to do is have an HTML page where users type in a username and password. After they click submit they are redirected to"ftp://username:[email protected]" where they can download and upload files to their folder.Each username will have a folder in the directory that has the same name as the username. `So if "Mark" logs in, I want him to see the contents of the "Mark" folder where he can upload and download files. I don't want him to have access to anything else.As I know nothing, I did a lot of reading up and researching on how to do this (lots of great information on this site by the way) but the PHP code might still be way off.Here is the code I have so far:for the html login page:<html><body><form name="form" method="post" action="ftp.php">Username: <input name="username" type="text" size="30">Password: <input name="password" type="password" size="30"><input type="Submit" size="8" value="Submit"></p></form></body></html>the code for the ftp.php page is :<?php$ftp_server = 'domain.com'; //domain being the future website domain$ftp_username =$_POST['username'];$ftp_password =$_POST['password'];$location = 'ftp://$ftp_username:$ftp_password@$ftp_server';header('Location: $location');$ftp_connect_id = ftp_connect($ftp_server);$ftp_login = ftp_login($ftp_connect_id, $ftp_username, $ftp_password);if (! $ftp_connect_id || ! $ftp_login){echo "Unable to connect to ".$ftp_server;exit;} else {echo "Connected to host "<p>";}ftp_close($ftp_connect_id);?>right now, when i check it, I log on the html page and go the the php page where all it says is "Connected to host."I don't see the "ftp://username:[email protected]" that I want to see.Any help is greatly appreciated[/quote] Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-199267 Share on other sites More sharing options...
NoDoze Posted March 22, 2007 Share Posted March 22, 2007 This sounds interesting...Can anyone answer? Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-212964 Share on other sites More sharing options...
mattd8752 Posted March 22, 2007 Share Posted March 22, 2007 Maybe you could use META tags to redirect them to the FTP server.For limiting access you want to use Cpanel. Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-212974 Share on other sites More sharing options...
damillerva Posted March 23, 2007 Share Posted March 23, 2007 Thanks, I'll give it a shot. Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-213173 Share on other sites More sharing options...
TheFilmGod Posted March 23, 2007 Share Posted March 23, 2007 Hold your horses! This may be much harder than you think. Simply connecting to the folder isn't enough. You would need to use a ftp program, or a simple one to upload and downlaod files. You would need to create restrictions, and be aware of "bad" files on your server - viruses. I would recommend finding a way to upload and download files through a free ftp program and try posting it on the site. After you got that working worry about connecting to the files. Because right now, there is no point connecting to the folder without FTP.Good Luck! If you get this done it will be an accomplishment! Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-213187 Share on other sites More sharing options...
damillerva Posted April 6, 2007 Share Posted April 6, 2007 Thanks for all the input. I have decided against using this option. Instead, it is much easier to use an FTP software and go that route. I do appreciate the advice. Link to comment https://forums.phpfreaks.com/topic/29978-browser-based-ftp-login/#findComment-223112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.