Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "Molgan1337";
- $password = "rekt";
- $dbname = "Molgan1337";
- $tablename = "Tabell";
- $name = $_POST['name'];
- $score = $_POST['score'];
- $recivedHash = $_POST['hash'];
- $secretKey = "Turtle";
- //create connection :)
- $db = new mysqli($servername, $username, $password, $dbname);
- //check connection
- if($db->connect_error)
- {
- die("cunt" . $db->connect_error);
- }
- else
- echo "Connection succesful! \n";
- $hash = md5($name . $score . $secretKey); //the correct hash
- //Check validation (is the recived hash correct)
- if($hash == $recivedHash)
- {
- $sql = "INSERT INTO " . $tablename . " (Name,Score) VALUES ('" . $name . "', '" . $score . "')";
- //query the database
- if($db->query($sql) === true)
- {
- echo "kys fag \n";
- echo $name . " with the score" . $score;
- }
- else echo "Error" . $sql . "\n" . $db->error;
- }
- $db->close();
- ?>
Add Comment
Please, Sign In to add comment