LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-15-2005, 07:17 PM   #1
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Rep: Reputation: 30
ftp web page login


hi there,

i'm looking for a webpage with a login/password box that allows you to log onto a ftp server without having to enter the password/username in clear text in the URL like 'ftp://usernameassword@mydomain.com'. does anyone out there know of something like this?

i'm not looking for a web based ftp client, just a login page.
 
Old 11-15-2005, 07:41 PM   #2
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
why?
 
Old 11-15-2005, 08:09 PM   #3
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Original Poster
Rep: Reputation: 30
becuase i think it would be handy just to have a website that could be linked to and your username/password entered into it and then could logon. i like the IE ftp view.

i've started making a HTML/php script, i'm pretty average at php as you will probably be able to tell

<HTML>
<HEAD>
<TITLE>
</TITLE>
<HEAD>
<BODY>
Username: <input type="text" name="user" value="">
<P>
Password: <input type="text" name="pass" value="">
<P>
<A HREF="ftp://$user:$pass@mydomain.com"><input type="submit" value="Login"></a>
</BODY>
</HTML>

if anyone can fix that up it'd be great, i'm not near my fedora box at the moment so i can't test any php, although i know that wont work.
 
Old 11-15-2005, 08:44 PM   #4
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
so you want to be able to link to an FTP account? One that you don't have acess to? I'm kinda confused as to what you're trying to do. If you have an FTP account on a server, go ahead and use that.
 
Old 11-15-2005, 09:45 PM   #5
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Original Poster
Rep: Reputation: 30
in the website listed below, there is two boxes, one for someone's username one for someone's password, when they enter in there usename/password and press the 'login' button i want to take the information out of the two boxes and place it in a url

ftp://(this is were the information from the username box goes):(this is were the information from the password box goes)@mydomain.com

so it makes a link, all the users has to do is enter there username and password info the box and press login.

all i need to do, is figure out how to output the contents of the two boxes into the URL.

even if someone knows how to output one text box into another text box, or something to push me in the right direction.

Last edited by paul_mat; 11-15-2005 at 10:01 PM.
 
Old 11-15-2005, 10:00 PM   #6
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
so...are you trying to make one of these boxes? or are you trying to take the information given to this box, and use it elsewhere?
 
Old 11-15-2005, 10:13 PM   #7
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Original Poster
Rep: Reputation: 30
that is what the page looks like at the moment

http://www.geocities.com/evilperson85/php-ftp.htm

and if you hover your mouse over the 'login' button in the status part you will see

ftp://$user:$pass@mydomain.com

what i want to do, is enter some data into the two boxes on the page and instead of seeing


ftp://$user:$pass@mydomain.com

i want to see

ftp://[data from first box]:[data from second box]@mydomain.com
 
Old 11-15-2005, 11:15 PM   #8
microsoft/linux
Senior Member
 
Registered: May 2004
Location: Sebec, ME, USA
Distribution: Debian Etch, Windows XP Home, FreeBSD
Posts: 1,445
Blog Entries: 9

Rep: Reputation: 45
ok, I guess I misunderstood what you are trying to do. I don't write PHP, nor do I know anything about it. I'm sorry I can't be of more help, I thought it was a generic FTP question. You might also try asking one of the mods to move this thread to Programming, since that seems to be the type of question you are asking(if I understand correctly)
 
Old 11-15-2005, 11:19 PM   #9
randyding
Member
 
Registered: May 2004
Posts: 552

Rep: Reputation: 31
This is one way to do it with a CGI.
Put this shell script in your cgibin directory, call it ftp.cgi and turn on the r-x flags.
Browsing to it should display the form, pressing submit sends the form data to the same script processes the data and outputs a redirect header to your ftp site.

Code:
#!/bin/bash


printform() {
    echo "Content-type: text/html"
    echo ""
    echo "<html>"
    echo "    <head>"
    echo "        <META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
    echo "        <title>FTP</title>"
    echo "    </head>"
    echo "    <body bgcolor=\"#C0C0C0\" text=\"#000000\" link=\"#0000FF\" vlink=\"#C00000\" alink=\"#FFFF00\">"
    echo "        <center><h2>FTP</h2></center>"
    echo "        <form action=\"${1}\" method=\"GET\">"
    echo "            <input type=\"edit\" size=\"16\" name=\"host\" value=\"localhost\">FTP Server Host Name<p>"
    echo "            <input type=\"edit\" size=\"16\" name=\"user\" value=\"anonymous\">User Name<p>"
    echo "            <input type=\"edit\" size=\"64\" name=\"path\" value=\"\">Path<p>"
    echo "            <input type=\"submit\" value=\"Connect\">"
    echo "        </form>"
    echo "    </body>"
    echo "</html>"
}


# arg1: ftphost
# arg2: ftpuser
# arg3: ftppath
#
print_ftp_redirect() {
    local url
    url="ftp://${2}@${1}/${3}"
    echo "Content-type: text/html"
    echo ""
    echo "<html>"
    echo "    <head>"
    echo "        <META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
    echo "        <META HTTP-EQUIV=\"refresh\" CONTENT=\"0;URL=${url}\">"
    echo "        <title>You are being redirected.</title>"
    echo "    </head>"
    echo "    <body bgcolor=\"#C0C0C0\" text=\"#000000\" link=\"#0000FF\" vlink=\"#C00000\" alink=\"#FFFF00\">"
    echo "        <a href=\"${url}\">You are being redirected.</a>"
    echo "    </body>"
    echo "</html>"
}


printerror() {
    echo "Content-type: text/html"
    echo ""
    echo "<html>"
    echo "    <head>"
    echo "        <META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
    echo "        <title>CGI ERROR</title>"
    echo "    </head>"
    echo "    <body bgcolor=\"#C0C0C0\" text=\"#000000\" link=\"#0000FF\" vlink=\"#C00000\" alink=\"#FFFF00\">"
    echo "        <center><h2>CGI ERROR</h2></center>"
    [ $# -gt 0 ] && echo "$@"
    echo "    </body>"
    echo "</html>"
}


if [ "$REQUEST_METHOD" != "GET" ]; then
    printerror "must use GET request method"
    exit 0
fi


if [ -z "$QUERY_STRING" ]; then
    printform "$(basename $0)"
    exit 0
fi


# some default values if not supplied as CGI arguments
ftphost=localhost
ftpuser=anonymous
ftppath=


for arg in $(echo "$QUERY_STRING" | tr '&' ' '); do
    name="${arg%%=*}"
    value="${arg#*=}"
    [ -z "$name" ] && continue
    [ -z "$value" ] && continue
    [ "$name" = "$value" ] && continue
    case "$name" in
        host)
            ftphost="$value"
        ;;

        user)
            ftpuser="$value"
        ;;

        path)
            ftppath="$value"
        ;;
    esac
done


print_ftp_redirect "$ftphost" "$ftpuser" "$ftppath"
exit 0
 
Old 11-16-2005, 02:13 AM   #10
paul_mat
Member
 
Registered: Nov 2004
Location: Townsville, Australia
Distribution: Fedora Core 5, CentOS 4, RHEL 4
Posts: 855

Original Poster
Rep: Reputation: 30
thanks, that was just what i was looking for.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
login attempts to web-page. (time limits) ldp Linux - Security 2 01-20-2005 12:42 PM
Auto login and run firefox at a specific web page eraser Linux - Newbie 4 11-21-2004 05:34 PM
which FTP program to publish a web page ruwach Linux - Software 2 08-07-2004 02:19 AM
Jerky mouse when web browsers download web page stodge Linux - Software 1 07-08-2003 10:29 PM
cannot see web page, but can see ftp and telnet logos Linux - Networking 5 01-17-2002 03:10 AM


All times are GMT -5. The time now is 05:18 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration