コード例 #1
0
ファイル: like_question.php プロジェクト: Gameonn/competition
 $oid = $user[0]['id'];
 $message = array();
 $message['msg'] = $uname . ' liked your question';
 $message['type'] = 1;
 //like
 $type = 'like';
 $sql = "Insert into likes(id,user_id,question_id,created_on) values(DEFAULT,:uid,:question_id,NOW())";
 $sth = $conn->prepare($sql);
 $sth->bindValue('uid', $uid);
 $sth->bindValue('question_id', $question_id);
 try {
     $sth->execute();
     $like_id = $conn->lastInsertId();
     $success = "1";
     $msg = "Question Liked";
     GeneralFunctions::addNotification($uid, $oid, $question_id, $type, $message['msg']);
     /*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']);
     		$apns->queueMessage();
     		$apns->processQueue();
     		}
     		catch(Exception $e){}
     		
     		}*/
 } catch (Exception $e) {
 }
コード例 #2
0
 $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']);
     		$apns->queueMessage();
     		$apns->processQueue();
     		}
     		catch(Exception $e){}