Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'dbh.php';
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- function cryptPass($input, $rounds = 9) {
- $salt = "";
- $saltChars = array_merge(range('A', 'Z'), range('a', 'z'), range(0, 9));
- for($i = 0; $i < 22; $i++) {
- $salt .= $saltChars[array_rand($saltChars)];
- }
- return crypt($input, sprintf('$2y$%02d$', $rounds).$salt);
- }
- $username = $_POST['username'];
- $password = cryptPass($_POST['password']);
- $stmt = $conn->prepare('INSERT INTO users (Username, Password) VALUES(?, ?)');
- $stmt->bind.param('si', $username, $password)
- $stmt->execute();
- $result1 = $stmt->get_result();
- $stmt = "INSERT INTO scores (Score2, Score3) VALUES('0', '0');";
- $result2 = mysqli_query($conn, $stmt);
- header("Location: index.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement