Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>form1</title>
- </head>
- <body>
- <form action="form1.php" method="POST">
- <table class="tabel-beli">
- <tr>
- <td>Username</td>
- <td>:</td>
- <td><input type="text" name="username" placeholder="masukan username" /></td>
- </tr>
- <tr>
- <td>Password</td>
- <td>:</td>
- <td><input type="password" name="password" placeholder="password"></td>
- </tr>
- <tr>
- <td>Metode Pembayaran</td>
- <td>:</td>
- <td><select name="bayar">
- <option>Telkomsel</option>
- <option>BNI</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><input type="submit" name="submit" value="Beli"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <?php
- if (isset($_POST['submit'])) {
- /*
- CREATE TABLE IF NOT EXISTS `user` (
- `user_id` int(11) NOT NULL AUTO_INCREMENT,
- `username` varchar(32) NOT NULL,
- `password` varchar(32) NOT NULL,
- `server` varchar(32) NOT NULL,
- `status` enum('aktif','mati') NOT NULL,
- `kode_bayar` varchar(64) NOT NULL,
- PRIMARY KEY (`user_id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
- */
- // include_once("/ssh/function/helper.php");
- // include_once("/ssh/function/connection.php");
- $connection=mysqli_connect("localhost","root","a","tes");
- $username = $_POST['username'];
- $password = $_POST['password'];
- $server = "INDONESIA";
- $status = "mati";
- $dataForm = http_build_query($_POST);
- $query = mysqli_query($connection, "SELECT * FROM user WHERE username='$username'");
- if (empty($username) || empty($password)) {
- // header("location: /ssh/index.php?page=main¬if=require&$data");
- // }elseif (mysqli_num_rows($query) == 1) {
- // header("location: /ssh/index.php?page=main¬if=username&data");
- }else{
- mysqli_query($connection, "INSERT INTO user (username, password, server, status)
- VALUES ('$username', '$password', '$server', '$status')");
- // header("location: /ssh/index.php?page=konfirm");
- echo mysqli_error($connection);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement