Ett stycke php-kod:
<?php
error_reporting(0);
if($_GET['user'])
{
$user = $_GET['user'].'.txt';
if (fopen("ftp://***:***@***/public_ftp/lostpass/".$user, "r"))
{
echo "
<h2 class='title'>New password</h2>
<div class='entry'>
<p>Fill in a new password.<br />
<form action='newpassword.php?user=".$_GET['user']."' method='post'>
<table align='center'>
<tr>
<td valign='top' align='left'>
Password: <br />
Confirm:
</td>
<td align='left'>
<input type='password' name='password' /><br />
<input type='password' name='password_2' /><br />
<input type='submit' name='post' value='Change password' />
</td>
</tr>
</table>
</form>";
if($_POST['post']) {
$password = $_POST['password'];
$password_1 = $_POST['password_2'];
$ftp_server = "*****";
$ftp_user_name = "******";
$ftp_user_pass = "********";
$file = "$username.txt";
$file2 = explode("-", $file);
$file2 = $file2[0];
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
ftp_chdir($conn_id, 'public_ftp/');
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
echo "Try again.";
exit;
} else {
if(ftp_get($conn_id,'lostpass/'.$user,'tmp/'.$user,FTP_BINARY)){
$username = file_get_contents('tmp/'.$user);
$fh = fopen('tmp/'.$username.'.txt', 'w+') or die("error!");
$stringData = $password;
fwrite($fh, $stringData);
fclose($fh);
if($password == $password_1) {
if(ftp_put($conn_id, 'lostpass/'.$username.'.txt','tmp/'.$username.'.txt', FTP_BINARY)){
echo "<font size='+1' color='green'>Your password is changed!</font>";
}
else
echo "error!!";
}
else
echo "<font size='+1' color='red'>Passwords didnt match!</font>";
}
}
}
echo"
design kod.....
";
}
else
echo "<font size='+1' color='red'>This page doesnt exists, sorry</font>";
}
?>
would´nt it be ironic ifyou died in the living room?