register.php 456 B

12345678910111213141516171819
  1. <?php
  2. require_once("../db.php");
  3. session_start();
  4. $username = $_POST['username'];
  5. $password = $_POST['password'];
  6. $email = $_POST['email'];
  7. $query = sprintf("INSERT INTO users (username, password, email) VALUES ('%s', MD5('%s'), '%s');",
  8. mysql_real_escape_string($username),
  9. mysql_real_escape_string($password),
  10. mysql_real_escape_string($email));
  11. mysql_query($query);
  12. header("Location: " . $_SERVER['HTTP_REFERER']);
  13. ?>