
Untitled
By: a guest on
Sep 14th, 2012 | syntax:
PHP | size: 0.73 KB | hits: 9 | expires: Never
<?php
if(isset($_POST['submit']))
{
$username = $_POST['username'];
if (file_exists($dirname)) {
echo "Name already taken.";
} else {
mkdir($username, 0755);
}
fopen(".$username./.htaccess", "r+");
$content = "AuthUserFile /.htpasswd\nAuthType Basic\n\nrequire user $username";
file_put_contents(".$username./.htaccess",
echo "Please <a href='$username'>click here</a> to login.";
}
?>
<!DOCTYPE HTML>
<head>
<meta charset="UTF-8">
<title>Register</title>
</head>
<body>
<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit" value="submit">
</body>
</html>