Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="actions/inscriptions.php">
- <input type="text" name="username" />
- <input type="password" name="password" />
- </form>
- <!-- le php dans le fichier inscriptions.php situé dans le dossier actions par exemple -->
- <?php
- if(!empty($_POST['username']) && !empty($_POST['password']) ) {
- //Ici on a reçu un POST et on fout tout dans un tableau par ex
- $membre['username'] = mysql_real_escape_string(htmlentities($_POST['username']));
- $membre['password'] = sha1($_POST['password']);
- //On met tout ça en bdd (voir SDZ)
- //...
- //Pour la connexion par cookies, on serialize le tableau (voir php.net/serialize)
- setcookie('membre', serialize($membre), time() + 365*24*3600, '/', null, false, true);
- /*Pour la session c'est encore plus simple : avant tout autre instruction on introduit les sessions avec
- session_start();
- */
- $_SESSION['membre'] = serialize($membre);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement