コード例 #1
0
 $type = 'result';
 $sql = "Insert into challenge(id,user_id,question_id,answer,answer_time,status,created_on) values(DEFAULT,:uid,:question_id,:answer,:answer_time,:status,NOW())";
 $sth = $conn->prepare($sql);
 $sth->bindValue('uid', $uid);
 $sth->bindValue('question_id', $question_id);
 $sth->bindValue('answer', $answer);
 $sth->bindValue('status', $win_status);
 $sth->bindValue('answer_time', $answer_time);
 try {
     $sth->execute();
     $success = "1";
     $msg = "Challenge Played";
     //remove challenge after play
     GeneralFunctions::removeChallenge($uid, $oid);
     //add scoring for challenge
     GeneralFunctions::addScoring($uid, $question_id, $score);
     //opponent notification
     GeneralFunctions::addNotification($uid, $oid, $question_id, $type, $message['msg']);
     //my notification
     GeneralFunctions::addNotification($oid, $uid, $question_id, $type, $other_message);
     //my profile
     $my_profile = Users::get_profile($uid);
     //opponent profile
     $opponent_profile = Users::get_profile($oid);
     /*if(!empty($apnid){
     		try{
     		$apns->newMessage($apnid);
     		$apns->addMessageAlert($message['msg']);
     		$apns->addMessageSound('Siren.mp3');
     		$apns->addMessageCustom('q', $question_id);
     		$apns->addMessageCustom('t', $message['type']);