本文整理汇总了PHP中sockets类的典型用法代码示例。如果您正苦于以下问题:PHP sockets类的具体用法?PHP sockets怎么用?PHP sockets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sockets类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: receive_synchro
function receive_synchro()
{
$cred = unserialize(base64_decode($_POST["credentials"]));
$ldap = new clladp();
$check = false;
if ($cred["user"] == $ldap->ldap_admin) {
if ($cred["pass"] == $ldap->ldap_password) {
$check = true;
}
}
if (!$check) {
die;
}
$users = unserialize(base64_decode($_POST["users"]));
if (!is_array($users)) {
return null;
}
$sync = new articaSMTPSync();
$array = $sync->GetUsers();
$servername = $_SERVER['REMOTE_ADDR'];
$port = $_POST["local_port"];
$itscred = unserialize(base64_decode($_POST["mycred"]));
$sync->Add($servername, $port, $itscred[0], $itscred[1]);
$sync->import($users, "{$servername}:{$port}");
$sock = new sockets();
$sock->getFrameWork("cmd.php?postfix-transport-maps=yes");
echo "<datas>" . base64_encode(serialize($array)) . "</datas>";
}
示例2: popup
function popup()
{
$page = CurrentPageName();
$tpl = new templates();
$sock = new sockets();
$SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
if ($SquidPerformance > 1) {
echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{artica_statistics_disabled}"));
return;
}
$q = new mysql_squid_builder();
$q->CheckTables();
$type = $tpl->_ENGINE_parse_body("{type}");
$browsers = $tpl->_ENGINE_parse_body("{browsers}");
$items = $tpl->_ENGINE_parse_body("{items}");
$add = $tpl->_ENGINE_parse_body("{add}");
$delete_group_ask = $tpl->javascript_parse_text("{inputbox delete group}");
$title = $tpl->javascript_parse_text("{browsers}");
$t = time();
$table_width = 630;
$table_height = 450;
$buttons = "buttons : [\n\t{name: '{$new_group}', bclass: 'add', onpress : AddGroup},\n\t\t],\t";
$buttons = null;
$html = $tpl->_ENGINE_parse_body("") . "\n\t<table class='table-{$t}' style='display: none' id='table-{$t}' style='width:99%'></table>\n<script>\n\$(document).ready(function(){\n\$('#table-{$t}').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$browsers}', name : 'pattern', width : 904, sortable : true, align: 'left'},\n\t\t{display: '{$add}', name : 'pattern', width : 81, sortable : false, align: 'center'},\n\t\t\n\t\t\n\t],\n\n\tsearchitems : [\n\t\t{display: '{$browsers}', name : 'pattern'},\n\t\t],\n\tsortname: 'pattern',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$title}</span>',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: {$table_height},\n\tsingleSelect: true\n\t\n\t}); \n});\n</script>\n\t";
echo $html;
}
示例3: popup_save
function popup_save()
{
$sync = new articaSMTPSync();
$sync->Add($_GET["servername"], $_GET["port"], $_GET["username"], $_GET["password"]);
$sock = new sockets();
$sock->getFrameWork("cmd.php?sync-remote-smtp-artica=yes");
}
示例4: page
function page()
{
$sock = new sockets();
$ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
$tpl = new templates();
$realsquidversion = $sock->getFrameWork("squid.php?full-version=yes");
$many = texttooltip("{manual_update}", "position:left:{manual_update_proxy_explain}", "Loadjs('squid.compilation.status.php')", null, 0, "font-size:30px;");
$html = "\n\t\t\t\n\t<div style='font-size:30px;margin-bottom:30px'>{available_versions} | {current}: {$realsquidversion} | {$many}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<th style='font-size:22px'>{version}</th>\t\t\n\t<th style='font-size:22px'>{filename}</th>\n\t<th style='font-size:22px'>{filesize}</th>\n\t<th style='font-size:22px'> </tf>\n\t</tr>\t\t\t\t\n\t";
while (list($key, $array) = each($ArticaTechNetSquidRepo)) {
$URL = $array["URL"];
$VERSION = $array["VERSION"];
$FILESIZE = $array["FILESIZE"];
$FILENAME = $array["FILENAME"];
$FILESIZE = FormatBytes($FILESIZE / 1024);
$button = button("{update2}", "Loadjs('squid.update.progress.php?key={$key}&filename={$FILENAME}');", 22);
if ($realsquidversion == $VERSION) {
$button = "{current}";
}
if ($color == null) {
$color = "#F2F0F1";
} else {
$color = null;
}
$html = $html . "\n\t\t<tr style='background-color:{$color};height:80px'>\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$VERSION}</td>\n\t\t\t<td style='font-size:22px;padding-left:10px'><a href=\"{$URL}\" target=_new style='text-decoration:underline'>{$FILENAME}</a></td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$FILESIZE}</td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'><center>{$button}</center></td>\t\n\t\t</tr>\n\t\t";
}
$html = $html . "</table>";
echo $tpl->_ENGINE_parse_body($html);
}
示例5: SAVE_QUAR
function SAVE_QUAR()
{
if (isset($_GET["SAVE_KAS"])) {
$kas = new kas_mysql("default");
if ($_GET["ACTION_SPAM_MODE"] == 1) {
$kas->SET_VALUE("ACTION_SPAM_MODE", 2);
} else {
$kas->SET_VALUE("ACTION_SPAM_MODE", -1);
}
if ($_GET["ACTION_FORMAL_MODE"] == 1) {
$kas->SET_VALUE("ACTION_FORMAL_MODE", 2);
} else {
$kas->SET_VALUE("ACTION_FORMAL_MODE", 0);
}
if ($_GET["ACTION_PROBABLE_MODE"] == 1) {
$kas->SET_VALUE("ACTION_PROBABLE_MODE", 2);
} else {
$kas->SET_VALUE("ACTION_SPAM_MODE", 0);
$kas->SET_VALUE("ACTION_SPAM_SUBJECT_PREFIX", "[SPAM]");
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?kas-reconfigure=yes");
}
if (isset($_GET["SAVE_AMAVIS"])) {
$amavis = new amavis();
$amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy"] = $_GET["EnableQuarantineSpammy"];
$amavis->main_array["BEHAVIORS"]["spam_quarantine_spammy2"] = $_GET["EnableQuarantineSpammy2"];
$amavis->Save();
}
}
示例6: build
function build(){
$sock=new sockets();
$MAIN=unserialize(base64_decode($sock->GET_INFO("CrossRoadsParams")));
@unlink("/etc/artica-postfix/croassroads.cmdline");
if(!is_array($MAIN["BACKENDS"])){
echo "Starting......: Crossroads Daemon no back end server\n";
return;
}
if($MAIN["PARAMS"]["backend-timout"]==null){$MAIN["PARAMS"]["backend-timout"]=30;}
if($MAIN["PARAMS"]["client-timout"]==null){$MAIN["PARAMS"]["client-timout"]=30;}
if($MAIN["PARAMS"]["checkup-interval"]==null){$MAIN["PARAMS"]["checkup-interval"]=10;}
if($MAIN["PARAMS"]["wakeup-interval"]==null){$MAIN["PARAMS"]["wakeup-interval"]=5;}
if($MAIN["PARAMS"]["listen_port"]==null){$MAIN["PARAMS"]["listen_port"]=25;}
if($MAIN["PARAMS"]["listen_ip"]==null){$MAIN["PARAMS"]["listen_ip"]=0;}
if($MAIN["PARAMS"]["client-timout-write"]==null){$MAIN["PARAMS"]["client-timout-write"]=5;}
if($MAIN["PARAMS"]["backend-timout-write"]==null){$MAIN["PARAMS"]["backend-timout-write"]=5;}
if($MAIN["PARAMS"]["dispatch-mode"]==null){$MAIN["PARAMS"]["dispatch-mode"]="least-connections";}
$cd[]="--server tcp:{$MAIN["PARAMS"]["listen_ip"]}:{$MAIN["PARAMS"]["listen_port"]}";
//$cd[]="--pidfile /var/run/crossroads.pid";
$cd[]="--backend-timeout {$MAIN["PARAMS"]["backend-timout"]}:{$MAIN["PARAMS"]["backend-timout-write"]}";
$cd[]="--client-timeout {$MAIN["PARAMS"]["client-timout"]}:{$MAIN["PARAMS"]["client-timout-write"]}";
$cd[]="--checkup-interval {$MAIN["PARAMS"]["checkup-interval"]}";
$cd[]="--dispatch-mode {$MAIN["PARAMS"]["dispatch-mode"]}";
while (list ($servername, $ligne) = each ($MAIN["BACKENDS"]) ){ $cd[]="--backend $servername";}
@file_put_contents("/etc/artica-postfix/croassroads.cmdline",@implode(" ",$cd));
}
示例7: remove
function remove()
{
$sock = new sockets();
$sock->getFrameWork("postfix.php?postsuper-remove-all=yes&hostname={$_POST["hostname"]}");
$tpl = new templates();
echo $tpl->javascript_parse_text("{task_has_been_scheduled_in_background_mode}");
}
示例8: tabs
function tabs()
{
$sock = new sockets();
$compilefile = "ressources/logs/squid.compilation.params";
if (!is_file($compilefile)) {
$sock->getFrameWork("squid.php?compil-params=yes");
}
$COMPILATION_PARAMS = unserialize(base64_decode(file_get_contents($compilefile)));
if (!isset($COMPILATION_PARAMS["enable-ident-lookups"])) {
echo "<div id='squid-identd-upd-error'></div>" . FATAL_ERROR_SHOW_128("{error_squid_ident_not_compiled}<center>\n\t\t\t\t" . button("{update2}", "Loadjs('squid.compilation.status.php');", 32) . "</center>");
return;
}
$page = CurrentPageName();
$users = new usersMenus();
$array["status"] = '{status}';
$array["networks"] = '{networks}';
$sock = new sockets();
$tpl = new templates();
while (list($num, $ligne) = each($array)) {
if ($num == "networks") {
$html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.identd.network.php\" style='font-size:20px'><span>{$ligne}</span></a></li>\n");
continue;
}
$html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes\" style='font-size:20px'><span>{$ligne}</span></a></li>\n");
//$html=$html . "<li><a href=\"javascript:LoadAjax('squid_main_config','$page?main=$num&hostname={$_GET["hostname"]}')\" $class>$ligne</a></li>\n";
}
echo build_artica_tabs($html, "debug_identd_config", 1024) . "<script>LeftDesign('users-white-256.png');</script>";
}
示例9: Save
function Save()
{
$sock = new sockets();
$sock->SET_INFO("OfflineImapBackupTool", $_POST["OfflineImapBackupTool"]);
$sock->SET_INFO("OfflineImapBackupDir", $_POST["OfflineImapBackupDir"]);
$sock->SET_INFO("OfflineImapWKDir", $_POST["OfflineImapWKDir"]);
}
示例10: ArticaMeta_release
function ArticaMeta_release($source_package)
{
$sock = new sockets();
$EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer"));
if ($EnableArticaMetaServer == 0) {
echo "Starting......: " . date("H:i:s") . " Checking Artica-meta repository - DISABLED -\n";
return;
}
echo "Starting......: " . date("H:i:s") . " Checking META repository - ENABLED -\n";
$ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage");
if ($ArticaMetaStorage == null) {
$ArticaMetaStorage = "/home/artica-meta";
}
@mkdir("{$ArticaMetaStorage}/nightlys", 0755, true);
@mkdir("{$ArticaMetaStorage}/releases", 0755, true);
$basename = basename($source_package);
if (!preg_match("#artica-[0-9\\.]+\\.tgz#", $basename)) {
echo "Starting......: " . date("H:i:s") . " Checking Artica-meta repository - FAILED ( not an artica package) -\n";
return;
}
if (is_file("{$ArticaMetaStorage}/releases/{$basename}")) {
@unlink("{$ArticaMetaStorage}/releases/{$basename}");
}
@copy($source_package, "{$ArticaMetaStorage}/releases/{$basename}");
meta_admin_mysql(2, "Added {$basename} into official repository", null, __FILE__, __LINE__);
$unix = new unix();
$php = $unix->LOCATE_PHP5_BIN();
echo "Starting......: " . date("H:i:s") . " Prepare New META package for clients...\n";
shell_exec("{$php} " . dirname(__FILE__) . "/exec.artica-meta-server.php --force");
echo "Starting......: " . date("H:i:s") . " Prepare New META package for clients done...\n";
}
示例11: page
function page(){
$sock=new sockets();
$tpl=new templates();
$IsInstalled=trim($sock->getFrameWork("system.php?phpmyadmin-installed=yes"));
if($IsInstalled<>"TRUE"){
$button=button("{reinstall_software}","Loadjs('system.mysql.phpmyadmin.install.php')",36);
echo FATAL_WARNING_SHOW_128("<span style='font-size:26px'>{ERROR_SERVICE_NOT_INSTALLED}</span><center style='margin:20px'>$button</center>");
}
$version=trim($sock->getFrameWork("system.php?phpmyadpmin-version=yes"));
$html="
<div style='width:100%;text-align:center'>
<center>
<center style='width:70%;margin:30px' class=form>
<div style='font-size:26px'>PHPMyAdmin v.$version</div>
<p> </p>
". button("PHPMyAdmin Front-end","document.location.href='/mysql';",40)."<p> </p></center></center></div>";
echo $tpl->_ENGINE_parse_body($html);
}
示例12: saveLang
function saveLang()
{
$sock = new sockets();
$_SESSION["detected_lang"] = $_POST["lang"];
$FileCookyKey = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"]);
$sock->SET_INFO($FileCookyKey, $_POST["Changelang"]);
}
示例13: Save
function Save()
{
$sock = new sockets();
$disksize = $_POST["disksize"];
$UpdateUtilityStorePath = $_POST["UpdateUtilityStorePath"];
$HardDriveSizeMB = unserialize(base64_decode($sock->getFrameWork("system.php?HardDriveDiskSizeMB=" . base64_encode($UpdateUtilityStorePath))));
if (!is_array($HardDriveSizeMB)) {
echo "Fatal Error Cannot retreive information for `{$UpdateUtilityStorePath}`";
return;
}
if ($disksize < 2500) {
echo "Fatal 2500MB minimal size";
return;
}
$AVAILABLEMB = $HardDriveSizeMB["AVAILABLE"];
if ($AVAILABLEMB < $disksize) {
$T = $disksize - $AVAILABLEMB;
echo "Fatal Error : Available: {$AVAILABLEMB}MB, need at least {$T}MB";
return;
}
$sql = "INSERT INTO loop_disks (`path`,`size`,`disk_name`,`maxfds`) VALUES ('{$UpdateUtilityStorePath}','{$disksize}','UpdateUtility','25000')";
$q = new mysql();
$q->QUERY_SQL($sql, "artica_backup");
if (!$q->ok) {
echo $q->mysql_error;
return;
}
$sock = new sockets();
$sock->SET_INFO("UpdateUtilityUseLoop", 1);
$sock->getFrameWork("lvm.php?loopcheck=yes");
$sock->getFrameWork("freeweb.php?reconfigure-updateutility=yes");
}
示例14: SaveCyrusPassword
function SaveCyrusPassword()
{
$ldap = new clladp();
$_POST["SaveCyrusPassword"] = url_decode_special_tool(trim($_POST["SaveCyrusPassword"]));
if ($_POST["SaveCyrusPassword"] == null) {
echo "Error: No password defined\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], '@') > 0) {
echo "@,: denied character\n";
return;
}
if (strpos($_POST["SaveCyrusPassword"], ':') > 0) {
echo "@,: denied character\n";
return;
}
$attrs["userPassword"][0] = $_POST["SaveCyrusPassword"];
$dn = "cn=cyrus,dc=organizations,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$dn = "cn=cyrus,{$ldap->suffix}";
if ($ldap->ExistsDN($dn)) {
if (!$ldap->Ldap_modify($dn, $attrs)) {
echo $ldap->ldap_last_error;
return;
}
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?cyrus-change-password=" . base64_encode($_POST["SaveCyrusPassword"]));
}
示例15: STREAM_LINE
function STREAM_LINE()
{
$sock = new sockets();
$EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
if (!is_numeric($EnableWebProxyStatsAppliance)) {
$EnableWebProxyStatsAppliance = 0;
}
if ($EnableWebProxyStatsAppliance == 0) {
writelogs("EnableWebProxyStatsAppliance={$EnableWebProxyStatsAppliance} from " . $_SERVER["REMOTE_ADDR"] . " (aborting)", __FUNCTION__, __FILE__, __LINE__);
die;
}
$q = new mysql();
$sql = base64_decode($_POST["STREAM_LINE"]);
$q->BuildTables();
$hostname = $_POST["HOSTNAME"];
$q->QUERY_SQL("DELETE FROM youtubecache WHERE proxyname='{$hostname}'", "artica_events");
$q->QUERY_SQL($sql, "artica_events");
if ($sql == null) {
return;
}
if (!$q->QUERY_SQL($sql, "artica_events")) {
writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " ({$_POST["HOSTNAME"]}) (failed)", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: `{$q->mysql_error}`", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__);
writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
writelogs("Mysql error: -------------------", __FUNCTION__, __FILE__, __LINE__);
echo "{$q->mysql_error}\n";
die;
}
writelogs("Received " . strlen($sql) . " bytes from " . $_SERVER["REMOTE_ADDR"] . " (success)", __FUNCTION__, __FILE__, __LINE__);
echo "<ANSWER>OK</ANSWER>\n";
}