anchor.diff:  	var/player_ckey = sanitizeSQL(ckey(player_key))
   	player_ip = sanitizeSQL(player_ip)
   	player_cid = sanitizeSQL(player_cid)
  -	var/datum/DBQuery/query_create_ban_get_player = SSdbcore.NewQuery("SELECT byond_key, INET_NTOA(ip), computerid FROM [format_table_name("player")] WHERE ckey = '[player_ckey]'")
  -	if(!query_create_ban_get_player.warn_execute())
  -		qdel(query_create_ban_get_player)
  -		return
  -	if(query_create_ban_get_player.NextRow())
  -		player_key = query_create_ban_get_player.item[1]
  -		if(use_last_connection)
  -			player_ip = query_create_ban_get_player.item[2]
  -			player_cid = query_create_ban_get_player.item[3]
  -	else
  -		if(use_last_connection)
  -			to_chat(usr, "<span class='danger'>Ban not created. [player_key]/([player_ckey]) hasn't been seen before, unable to use IP and CID from last connection.</span>")
  +	if(player_ckey)
  +		var/datum/DBQuery/query_create_ban_get_player = SSdbcore.NewQuery("SELECT byond_key, INET_NTOA(ip), computerid FROM [format_table_name("player")] WHERE ckey = '[player_ckey]'")
  +		if(!query_create_ban_get_player.warn_execute())
   			qdel(query_create_ban_get_player)
   			return
  +		if(query_create_ban_get_player.NextRow())
  +			player_key = query_create_ban_get_player.item[1]
  +			if(use_last_connection)
  +				player_ip = query_create_ban_get_player.item[2]
  +				player_cid = query_create_ban_get_player.item[3]
   		else
  -			if(alert(usr, "[player_key]/([player_ckey]) has not been seen before, are you sure you want to create a ban for them?", "Unknown key", "Yes", "No", "Cancel") != "Yes")
  +			if(use_last_connection)
  +				to_chat(usr, "<span class='danger'>Ban not created. [player_key]/([player_ckey]) hasn't been seen before, unable to use IP and CID from last connection.</span>")
   				qdel(query_create_ban_get_player)
   				return
  -	qdel(query_create_ban_get_player)
  +			else
  +				if(alert(usr, "[player_key]/([player_ckey]) has not been seen before, are you sure you want to create a ban for them?", "Unknown key", "Yes", "No", "Cancel") != "Yes")
  +					qdel(query_create_ban_get_player)
  +					return
  +		qdel(query_create_ban_get_player)
   	var/admin_ckey = sanitizeSQL(usr.client.ckey)
   	if(applies_to_admins)
   		var/datum/DBQuery/query_check_adminban_count = SSdbcore.NewQuery("SELECT COUNT(DISTINCT bantime) FROM [format_table_name("ban")] WHERE a_ckey = '[admin_ckey]' AND applies_to_admins = 1 AND unbanned_datetime IS NULL AND (expiration_time IS NULL OR expiration_time > NOW())")
  
positive.code: 			var/unban_datetime = query_unban_search_bans.item[15]
  			var/unban_key = query_unban_search_bans.item[16]
  			var/unban_round_id = query_unban_search_bans.item[17]
  			output += "<div class='banbox'><div class='header [unban_datetime ? "unbanned" : "banned"]'><b>[player_key]</b>[applies_to_admins ? " <b>ADMIN</b>" : ""] banned by <b>[admin_key]</b> from <b>[role]</b> on <b>[ban_datetime]</b> during round <b>#[ban_round_id]</b>.<br>"
  			if(!expiration_time)
  				output += "<b>Permanent ban</b>."
  			else
  
negative.code: 		))
  	if(!SSdbcore.MassInsert(format_table_name("ban"), sql_ban, warn = 1))
  		return
  	var/target = ban_target_string(player_key, player_ip, player_cid)
  	var/msg = "has created a [isnull(duration) ? "permanent" : "temporary [time_message]"] [applies_to_admins ? "admin " : ""][roles_to_ban[1] == "Server" ? "server ban" : "role ban from [roles_to_ban.len] roles"] for [target]."
  	log_admin_private("[kn] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join(", ")]"] Reason: [reason]")
  	message_admins("[kna] [msg][roles_to_ban[1] == "Server" ? "" : " Roles: [roles_to_ban.Join("\n")]"]\nReason: [reason]")
  	if(applies_to_admins)
  		send2irc("BAN ALERT","[kn] [msg]")
  <<<<<<< HEAD
  	create_message("note", player_ckey, admin_ckey, note_reason, null, null, 0, 0, null, 0) // yogs - removed severity
  =======
  	if(player_ckey)
  		create_message("note", player_ckey, admin_ckey, note_reason, null, null, 0, 0, null, 0, severity)
  >>>>>>> 2b9c04c6ec... Merge pull request #42562 from Jordie0608/idontrememberwhythecidcolumnisavarcharsoimnotsureifthatshouldbechangedornot
  	var/client/C = GLOB.directory[player_ckey]
  	var/datum/admin_help/AH = admin_ticket_log(player_ckey, msg)
  	var/appeal_url = "No ban appeal url set!"
  	appeal_url = CONFIG_GET(string/banappeals)
  	var/is_admin = FALSE
  	if(C)
  		build_ban_cache(C)
  		to_chat(C, "<span class='boldannounce'>You have been [applies_to_admins ? "admin " : ""]banned by [usr.client.key] from [roles_to_ban[1] == "Server" ? "the server" : " Roles: [roles_to_ban.Join(", ")]"].\nReason: [reason]</span><br><span class='danger'>This ban is [isnull(duration) ? "permanent." : "temporary, it will be removed in [time_message]."] The round ID is [GLOB.round_id].</span><br><span class='danger'>To appeal this ban go to [appeal_url]</span>")
  		if(GLOB.admin_datums[C.ckey] || GLOB.deadmins[C.ckey])
  			is_admin = TRUE
  		if(roles_to_ban[1] == "Server" && (!is_admin || (is_admin && applies_to_admins)))
  			qdel(C)
  	if(roles_to_ban[1] == "Server" && AH)
  		AH.Resolve()
  