+ if (param('crelationship')){
+ my $value = escapeHTML(param('relationship'));
+ if ($DBH->do(q{UPDATE alliances SET relationship = ? WHERE id =?}
+ ,undef,$value,$alliance->{id})){
+ $alliance->{relationship} = $value;
+ log_message $ND::UID,"HC set alliance: $alliance->{id} relationship: $value";
+ }else{
+ $error .= "<p> Something went wrong: ".$DBH->errstr."</p>";
+ }
+ }
+ my $coords = param('coords');
+ my $findplanet = $DBH->prepare(q{SELECT id FROM current_planet_stats WHERE x = ? AND y = ? AND z = ?});
+ my $addplanet = $DBH->prepare(q{
+UPDATE planets SET alliance_id = $2, nick = coalesce($3,nick)
+WHERE id = $1;
+ });
+ while ($coords =~ m/(\d+):(\d+):(\d+)(?:\s+nick=\s*(\S+))?/g){
+ my ($id) = $DBH->selectrow_array($findplanet,undef,$1,$2,$3) or $ERROR .= p $DBH->errstr;
+ if ($addplanet->execute($id,$alliance->{id},$4)){
+ my $nick = '';
+ $nick = '(nick $4)' if defined $4;
+ $error .= "<p> Added planet $1:$2:$3 $nick to this alliance</p>";
+ intel_log $ND::UID,$id,"HC Added planet $1:$2:$3 $nick to alliance: $alliance->{id} ($alliance->{name})";
+ }else{
+ $error .= "<p> Something went wrong: ".$DBH->errstr."</p>";
+ }
+ }