Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- try {
- $bdd = new PDO("mysql:host=localhost;dbname=chat", "root", "************");
- }
- catch (Exception $e) {
- die ($e->getMessage());
- }
- if(strlen($_POST["pseudo"]) < 25 AND strlen($_POST["pseudo"]) > 4 AND strlen($_POST["message"]) > 0) {
- $req = $bdd->prepare("INSERT INTO messages VALUES (NULL, ?, ?)");
- $req->execute(array($_POST["pseudo"], $_POST["message"]));
- $_SESSION["pseudo"] = $_POST["pseudo"];
- }
- header("Location:index.php");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment