SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | ||
| 3 | if(isset($_POST['formsub'])) {
| |
| 4 | $username = $_POST['user_input']; | |
| 5 | $password = $_POST['pass_input']; | |
| 6 | ||
| 7 | $pdo = new PDO("mysql:host=localhost;dbname=database", 'username', 'password');
| |
| 8 | $query = $pdo->prepare("INSERT INTO users (user,pass) VALUES (:user_token,:pass_token)");
| |
| 9 | $values = array( | |
| 10 | "user_token" => $username, | |
| 11 | - | "pass_token" => $password |
| 11 | + | "pass_token" => sha1($password) |
| 12 | ); | |
| 13 | $query->execute($values); | |
| 14 | } | |
| 15 | ||
| 16 | ?> | |
| 17 | ||
| 18 | <form action="index.php" method="post"> | |
| 19 | username: <input type="text" name="user_input"><br> | |
| 20 | password: <input type="password" name="pass_input"><br> | |
| 21 | <input type="hidden" name="formsub" value="1"> | |
| 22 | <input type="submit"> | |
| 23 | </form> |