Example #1
0
 // Params: action, sid, buddyid
 ////////////////////////////////////////////////////////////////////////////////////////////
 case "addtobuddylist":
     if (isSessionIDValid($config, $xsid)) {
         $session = base64_decode($xsid);
         list($uniq, $player_id) = preg_split("/\\|/", $session);
         if (is_numeric($_GET['buddyid'])) {
             //Instantiate theCR3DCQuery Class
             $oR3DCQuery = new CR3DCQuery($config);
             $bBuddyExists = $oR3DCQuery->DoesPlayerIDExists((int) $_GET['buddyid']);
             $oR3DCQuery->Close();
             unset($oR3DCQuery);
             if ($bBuddyExists) {
                 //Instantiate the CBuddyList Class
                 $oBuddyList = new CBuddyList($config);
                 $oBuddyList->AddBuddyToList($config, $player_id, (int) $_GET['buddyid']);
                 $oBuddyList->Close();
                 unset($oBuddyList);
                 echo "<RESPONSE>\n";
                 echo "<BUDDYLIST>true</BUDDYLIST>\n";
                 echo "<BUDDYID>" . (int) $_GET['buddyid'] . "</BUDDYID>\n";
                 echo "</RESPONSE>\n";
             } else {
                 echo "<RESPONSE>\n";
                 echo "<ERROR>ID_INVALID_BUDDYID</ERROR>\n";
                 echo "<BUDDYID>" . $_GET['buddyid'] . "</BUDDYID>\n";
                 echo "</RESPONSE>\n";
             }
         } else {
             echo "<RESPONSE>\n";
             echo "<ERROR>ID_INVALID_BUDDYID</ERROR>\n";
        }
        $oR3DCQuery->MangeGameTimeOuts();
    }
}
///////////////////////////////////////////////////////////////////////
$txtadd = trim($_POST['txtadd']);
$updated = false;
//Update the buddy list
if ($txtadd != "") {
    //remove all
    $oBuddyList->ClearBuddyList($config, $_SESSION['id']);
    //Add the new
    for ($i = 0; $i < count($_POST['lstBuddy']); $i++) {
        if (trim($_POST['lstBuddy'][$i]) != "") {
            //echo "||".$_POST['lstBuddy'][$i]."||";
            $oBuddyList->AddBuddyToList($config, $_SESSION['id'], trim($_POST['lstBuddy'][$i]));
        }
    }
    $updated = true;
}
?>

<html>
<head>
<title><?php 
echo GetStringFromStringTable("IDS_PAGETITLES_22", $config);
?>
</title>
<script language="JavaScript" src="includes/selectbox.js"></script>