Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $myFile = "config.txt";
- $fh = fopen($myFile, 'w') or die("can't open file");
- ?>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
- <p><input type="text" name="username" /> Username</p>
- <p><input type="text" name="password" /> Password</p>
- <p><input type="text" name="address" /> Connection Address</p>
- <p><input type="text" name="port" /> Port Number</p>
- <p><input type="text" name="database" /> Database</p>
- <?
- $port = $_POST['port'];
- fwrite($fh, $port);
- $user = $_POST['username'];
- fwrite($fh, $user);
- $pass = $_POST['password'];
- fwrite($fh, $pass);
- $address = $_POST['address'];
- fwrite($fh, $address);
- $data1 = $_POST['database'];
- $data = "$data1";
- fwrite($fh, $data);
- fclose($fh);
- if(isset($_POST['submit'])) {
- if(!empty($_POST['port']) && !empty($_POST['password']) && !empty($_POST['username']) && !empty($_POST['database']) && !empty($_POST['address'])) {
- $accept = "Thank you for contacting me.";
- } else {
- $error = "Please fill out the entire form.";
- }
- }
- ?>
- <?php if(!empty($error)) echo '<div class="error">'.$error.'</div>'; ?>
- <?php if(!empty($accept)) echo '<div class="accept">'.$accept.'</div>'; ?>
- <?php
- echo "Write yes to prove it!"
- ?>
- <p><input type="submit" name="submit" value="Send" class="button" /></p>
- </form>
- ?>
Add Comment
Please, Sign In to add comment