Raised This Month: $ Target: $400
 0% 

Call Admin with XMPP(Jabber)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
grimd34th
SourceMod Donor
Join Date: Jun 2011
Old 09-29-2011 , 14:11   Re: Call Admin with XMPP(Jabber)
Reply With Quote #25

also, a better index.php that doesnt throw errors about seckey
PHP Code:
<?php

$cfg
['xmpp_server']        = ''//The XMPP server to connect to
$cfg['xmpp_port']        = 5222//The XMPP port to use
$cfg['xmpp_user']        = ''//The User of the XMPP server to connect with (do not include @domain.com)
$cfg['xmpp_pass']        = ''//The Password to the User of the XMPP server to connect with
$cfg['xmpp_resource']    = 'xmpphp'//The Resource base which (leave default if unsure, its only extra info)
$cfg['xmpp_domain']        = ''//The Domain to which the User belongs (do not include @)
$cfg['seckey']             = ''//Security Key set in caxmpp_seckey convar
$cfg['recipents']        = ''//Comma Seperated list of recipients to message
if(isset($_POST['seckey'])) { $seckey $_POST['seckey']; } else { $seckey ''; }
if(
$seckey != $cfg['seckey'])
    die(
"Unauthorized Access");

include 
'XMPPHP/XMPP.php';

#Use XMPPHP_Log::LEVEL_VERBOSE to get more logging for error reports
#If this doesn't work, are you running 64-bit PHP with < 5.2.6?
$conn = new XMPPHP_XMPP($cfg['xmpp_server'], $cfg['xmpp_port'], $cfg['xmpp_user'], $cfg['xmpp_pass'], $cfg['xmpp_resource'], $cfg['xmpp_domain'], $printlog=false$loglevel=XMPPHP_Log::LEVEL_INFO);

$message strip_tags(base64_decode($_POST['message']));
$recipents explode(','$cfg['recipents']);
try
{
    
$conn->connect();
    
$conn->processUntil('session_start');
    
$conn->presence();
    foreach(
$recipents as $recipent)
    {
        
$conn->message($recipent$message);
    }
    
$conn->disconnect();
}
catch(
XMPPHP_Exception $e
{
    die(
$e->getMessage());
}
?>
grimd34th is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode