Log in

View Full Version : $else problems with an ftp login script



Come2theDarkSide
12-01-2008, 06:37 PM
ok, so im making an ftp login script, and i have tried to put a mechinism in access.php to stop users from logging in with no username or password. The code looks ok, i dont get any php errors, but it just doesnt work, even when you type in a value in for the username and password fields, it still redirects back to index.htm, i only want it to do this when the user hasnt put any info into the user and password fields. Thanks :D

index.htm


<form action="access.php" method="POST">
Username: <input type="text" name="user"><br>
Password: <input type="password" name="pass"><br>
<input type="submit" value="Login"></form>

access.php

<?php

if ($_POST['user']=="") { $_POST['user'] = ""; }

@header( 'Location: index.htm' ) ;

$else ;

if ($_POST['pass']=="") { $_POST['pass'] = ""; }

@header( 'Location: index.htm' ) ;

$else ;

$conn = ftp_connect("domain.com") or die("Could not connect to FTP Server, Please contact an Administrator");
ftp_login($conn,$_POST["user"],$_POST["pass"]);
?>