All pastes #750512 Raw Edit

Mine

public text v1 · immutable
#750512 ·published 2007-10-26 15:56 UTC
rendered paste body
The relevant structure from the DB

writer  	int(11)

---- The part that calls the constructor

$threadListQuery = "SELECT * FROM `" . $krconf["forum"]["table"] . "` WHERE `thread`='" . $thread . "' AND `type`='t' ORDER BY `last_time` DESC";
	$result = $sql->query($threadListQuery, __LINE__, __FILE__);
	if ($result->num_rows>0) {
		while ($row = $result->fetch_array()) {
			$query = "SELECT `id` FROM `" . $krconf["forum"]["table"]. "` WHERE `thread`='".$row["id"]."'";
			$count = $sql->query($query, __LINE__, __FILE__)->num_rows;

			try {
				$user = new kr_user($row["writer"]);
			.....
			}
		}
	}


--- kr_user constructor (start)

	function __construct($user) {
		global $sql, $krconf;
		

		if (preg_match("#^[0-9]+$#", $user)) {
			$userQuery = "SELECT * FROM `".$krconf["user"]["table"]."` WHERE `id`='$user'";
		} else {
			$userQuery = "SELECT * FROM `".$krconf["user"]["table"]."` WHERE `user`='$user'";
		}