[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Login script

Posted on 2006-07-14
5
Medium Priority
?
215 Views
Last Modified: 2008-03-17
Hi guys,

i have this ftp login script on my website. It works just fine. One little problem is that when I enter @ in either name or password it doesn't work. Any ideas?

<?php
$ftp_server = "server.com";
$ftp_user = $_REQUEST['log'];
$ftp_pass = $_REQUEST['pass'];

// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Error!");

// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
   header("Location: ftp://".$ftp_user.":".$ftp_pass."@".$ftp_server);
} else {
   include "error_ftp.htm";
}

// close the connection
ftp_close($conn_id);
?>

0
Comment
Question by:Yury Merezhkov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 1000 total points
ID: 17111760
use urlencode on $ftp_user and $ftp_pass
0
 
LVL 14

Expert Comment

by:ThG
ID: 17111780
it cannot work obviously, because the browser mismatches the "@" in the login for the host part of the URI.

some providers that require the "@" in the login name sometimes accepts a "+" also.. using str_replace("@", "+", $ftp_user); might help.
0
 
LVL 14

Expert Comment

by:ThG
ID: 17111793
well... snoyes_jw's idea ain't bad at all! good point.
0
 
LVL 7

Author Comment

by:Yury Merezhkov
ID: 17111865
I'd say perfect point. It worked. Funny thing is that in Firefox after redirect the url address is ftp://server.com, whereas in IE it becomes ftp://X@server.com. Where X = whatever was after @ in password :)
0
 
LVL 7

Author Comment

by:Yury Merezhkov
ID: 17111876
So basically, if user's password starts with @ the rest of it will be shown in the address bar :) Anyways, who cares. Thank you guys.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question