Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. $this->db_connection = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  2.  
  3. if (!$this->db_connection->set_charset("utf8")) {
  4. $this->errors[] = $this->db_connection->error;
  5. }
  6.  
  7. if (!$this->db_connection->connect_errno) {
  8.  
  9. $user_name = $this->db_connection->real_escape_string(strip_tags($_POST['user_name'], ENT_QUOTES));
  10. $user_email = $this->db_connection->real_escape_string(strip_tags($_POST['user_email'], ENT_QUOTES));
  11.  
  12. $user_password = $_POST['user_password_new'];
  13.  
  14.  
  15. $user_password_hash = password_hash($user_password, PASSWORD_DEFAULT);
  16.  
  17. $sql = "SELECT * FROM users WHERE user_name = '" . $user_name . "' OR user_email = '" . $user_email . "';";
  18. $query_check_user_name = $this->db_connection->query($sql);
  19.  
  20. if ($query_check_user_name->num_rows == 1) {
  21. $this->errors[] = "Sorry, that username / email address is already taken.";
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement