Пример #1
0
function videoover()
{
    $userid = $_POST['userid'];
    $decision = $_POST['decision'];
    $opponent = GetOpponentId($userid);
    $rs = mysql_query("select status from g1_players where playerid = '{$opponent}'");
    $row = mysql_fetch_array($rs);
    $opp_status = $row['status'];
    error_log("the start of the main videooiver" . $decision . ',' . $opponent . ',' . $opp_status);
    mysql_query("UPDATE g1_players SET status='{$decision}' where playerid = '{$userid}'");
    if ($decision == 'ENDSESSION' && $opp_status == 'ENDSESSION') {
        //if ( ($decision == 'ENDSESSION')  ){
        clearrecord($userid);
        // delete, clear everything
        // no more messages will be sent from any of them.
        exit;
    }
    switch ($decision) {
        case 'ANOTHERGAME':
            switch ($opp_status) {
                case 'ANOTHERGAME':
                    $gameid = GetGameId($userid);
                    ExtractGist($gameid);
                    error_log("the video agent is called via anothergame");
                    callvideoagent($userid, $opponent);
                    break;
                case 'PROFILEYES':
                    mysql_query("UPDATE g1_players SET status='PROFILEINVITE' where playerid = '{$userid}'");
                    break;
                default:
                    $gameid = GetGameId($userid);
                    error_log("Calling default form video over");
                    ExtractGist($gameid);
                    error_log("the video agent is called via default");
                    callvideoagent($userid, $opponent);
                    break;
            }
            break;
        case 'PROFILEYES':
            switch ($opp_status) {
                case 'ANOTHERGAME':
                    mysql_query("UPDATE g1_players SET status='PROFILEINVITE' where playerid = '{$opponent}'");
                    break;
                case 'PROFILEYES':
                    mysql_query("UPDATE g1_players SET status='SHOWPROFILE' where playerid = '{$userid}'");
                    mysql_query("UPDATE g1_players SET status='SHOWPROFILE' where playerid = '{$opponent}'");
                    break;
                default:
                    mysql_query("UPDATE g1_players SET status='PROFILEINVITE' where playerid = '{$opponent}'");
                    break;
            }
            break;
    }
}
function videoover()
{
    $userid = $_POST['userid'];
    $decision = $_POST['decision'];
    $opponent = GetOpponentId($userid);
    $rs = mysql_query("select status from g1_players where playerid = '{$opponent}'");
    $row = mysql_fetch_array($rs);
    $opp_status = $row['status'];
    mysql_query("UPDATE g1_players SET status='{$decision}' where playerid = '{$userid}'");
    if ($decision == 'ENDSESSION' && $opp_status == 'ENDSESSION') {
        clearrecord($userid);
        // delete, clear everything
        // no more messages will be sent from any of them.
        exit;
    }
    switch ($decision) {
        case 'ANOTHERGAME':
            switch ($opp_status) {
                case 'ANOTHERGAME':
                    $gameid = GetGameId($userid);
                    // store game information in G3 and update the fields in G1, G2
                    ExtractGist($gameid);
                    callvideoagent($userid, $opponent);
                    //call VA ( $userid, $opponent )
                    break;
                case 'PROFILEYES':
                    mysql_query("UPDATE g1_players SET status='PROFILEINVITE' where playerid = '{$userid}'");
                    break;
            }
            break;
        case 'PROFILEYES':
            switch ($opp_status) {
                case 'ANOTHERGAME':
                    mysql_query("UPDATE g1_players SET status='PROFILEINVITE' where playerid = '{$opponent}'");
                    break;
                case 'PROFILEYES':
                    mysql_query("UPDATE g1_players SET status='SHOWPROFILE' where playerid = '{$userid}'");
                    mysql_query("UPDATE g1_players SET status='SHOWPROFILE' where playerid = '{$opponent}'");
                    break;
            }
            break;
    }
    // function over.
}