All pastes #248236 Raw Edit

Untitled

public php v1 · immutable
#248236 ·published 2006-11-14 12:36 UTC
rendered paste body
function bot_karma_add_karma($object, $good, $reason, $who) {  $positive = '';  $negative = '';  $select = db_fetch_object(db_query("SELECT * from {bot_karma} WHERE object = '%s'", $object));  if (!$good) {    $negative = $select->negative + 1;  }  else {    $positive = $select->positive + 1;  }// is reason an array?//  $reasons = implode(",", $select->reason);//  $reasons .= ',' . $reason;// this makes the string into an array again//  $reasons = explode(",", $reasons);// is select who an array?//  $whos = implode(",", $select->who);//  $whos .= ',' . $who;// this makes the string into an array again// you also add $who a second time//  $whos = explode(",", $whos . $who);// this might work?   $reasons = $select->reason .',' . $reason;  $whos = $select->who . ',' . $who;  if ($select) {    $query = "UPDATE {bot_karma} SET type = '%s' positive = '%d' negative = '%d' reason = '%s' who = '%s' WHERE object = '%s'";  }  else {    $query = "INSERT INTO {bot_karma} (type, object, positive, negative, reason, who) VALUES ('%s', '%d', '%d', '%s', '%s') WHERE object = '%s'";    }  db_query($query, 'irc', $positive, $negative, $reasons, $whos, $object);}