<commit_before><?php
include_once("qblog.php");//this is the base

class User{
	private $user_username, $user_id, $user_type, $user_passhash;
	
	/// Loads the user with $id from database to this class
	/// returns true on succcess, false on error
	public function load(){
		$conn = qb_conn_get();
		
		$query = "SELECT * FROM users WHERE id=".qb_str_process(strval($id));
		$res = $conn->query($query);
		if ($res){
			if ($res->num_rows > 0){
				$r = $res->fetch_assoc();
				$user_username = $r["username"];
				$user_passhash = $r["password"];
				$user_type = $r["type"];
				$user_id = $r["id"];
				return true;
			}else{
				qb_error_set("User not found");
				return false;
			}
		}else{
			$error = "Failed to load user";
			if (qb_debug_get()){
				$error .= "; \n".$conn->error;
			}
			qb_error_set($error);
			return false;
		}
	}
	
	/// updates the user in database, which has the id same as this one, with this one's propertes
	/// returns true on success & false on error
	public function update(){
		$conn = qb_conn_get();
		
		$username = qb_str_process($this->user_username);
		$passhash = qb_str_process($this->user_passhash);
		$type = qb_str_process($this->user_type);<commit_msg>Fixed some syntax mistakes where I forgot to add `$this->`<commit_after><?php
include_once("qblog.php");//this is the base

class User{
	private $user_username, $user_id, $user_type, $user_passhash;
	
	/// Loads the user with $id from database to this class
	/// returns true on succcess, false on error
	public function load($id){
		$conn = qb_conn_get();
		
		$query = "SELECT * FROM users WHERE id=".qb_str_process(strval($id));
		$res = $conn->query($query);
		if ($res){
			if ($res->num_rows > 0){
				$r = $res->fetch_assoc();
				$this->user_username = $r["username"];
				$this->user_passhash = $r["password"];
				$this->user_type = $r["type"];
				$this->user_id = $r["id"];
				return true;
			}else{
				qb_error_set("User not found");
				return false;
			}
		}else{
			$error = "Failed to load user";
			if (qb_debug_get()){
				$error .= "; \n".$conn->error;
			}
			qb_error_set($error);
			return false;
		}
	}
	
	/// updates the user in database, which has the id same as this one, with this one's propertes
	/// returns true on success & false on error
	public function update(){
		$conn = qb_conn_get();
		
		$username = qb_str_process($this->user_username);
		$passhash = qb_str_process($this->user_passhash);
		$type = qb_str_process($this->user_type);
{'fraction_non_alphanumeric': 0.16303470540758677, 'fraction_numerical': 0.0008071025020177562, 'mean_word_length': 3.5822550831792976, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2427855', 'n_tokens_mistral': 1000, 'n_tokens_neox': 869, 'n_words': 234}