Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['formsub'])) {
- $username = $_POST['user_input'];
- $password = $_POST['pass_input'];
- $pdo = new PDO("mysql:host=localhost;dbname=database", 'username', 'password');
- $query = $pdo->prepare("INSERT INTO users (user,pass) VALUES (:user_token,:pass_token)");
- $values = array(
- "user_token" => $username,
- "pass_token" => sha1($password)
- );
- $query->execute($values);
- }
- ?>
- <form action="index.php" method="post">
- username: <input type="text" name="user_input"><br>
- password: <input type="password" name="pass_input"><br>
- <input type="hidden" name="formsub" value="1">
- <input type="submit">
- </form>
Add Comment
Please, Sign In to add comment