本文整理汇总了PHP中sockets::RandomPort方法的典型用法代码示例。如果您正苦于以下问题:PHP sockets::RandomPort方法的具体用法?PHP sockets::RandomPort怎么用?PHP sockets::RandomPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sockets
的用法示例。
在下文中一共展示了sockets::RandomPort方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
<?php
if (posix_getuid() != 0) {
die("Cannot be used in web server mode\n\n");
}
include_once dirname(__FILE__) . '/ressources/class.templates.inc';
$sock = new sockets();
echo "<port>" . $sock->RandomPort() . "</port>\n";
die;
示例2: stunnel
function stunnel(){
$page=CurrentPageName();
$sock=new sockets();
$stunnel=new stunnel4();
$relay_host=$stunnel->main_array["postfix_relayhost"]["connect"];
$localport=$stunnel->main_array["postfix_relayhost"]["accept"];
if(!is_numeric($localport)){
$sock=new sockets();
$localport=$sock->RandomPort();
}
$sTunnel4enabled=$sock->GET_INFO('sTunnel4enabled');
$enable=Paragraphe_switch_img('{enable_stunnel}',"{enable_stunnel_text}",'enable_stunnel',$sTunnel4enabled);
$intro="
<div id='ssltunnelid'>
<table style='width:100%' align=center>
<tr>
<td valign='top'>
<img src='img/postfix-relayhost-ssl-bg.png' style='padding:4px;border:1px dotted #CCCCCC;margin:3px'>
</td>
<td valign='top' width='99%'>
<div id='servinfos_stunnel'></div>
</td>
</tr>
<tr><td colspan=2><p class=explain>{smtps_relayhost_text}</div></td></tr>
</table>
<br>
<table style='width:100%' class=form>
<tr>
<td class=legend style='font-size:14px'>{enable_stunnel}</td>
<td>". Field_checkbox("enable_stunnel",1,$sTunnel4enabled)."</td>
<td>". help_icon("{enable_stunnel_text}")."</td>
</tr>
<tr>
<td align='right' nowrap style='font-size:14px'><strong>{stunnelport}: </strong></td>
<td><input type='text' id='localport' value='$localport' style='font-size:14px;width:30%'></td>
<td> </td>
</tr>
<tr>
<td colspan=3 align='right'><hr>". button('{apply}',"StunnelApply()")."</td>
</tr>
</table>
</div>
<script>
function x_StunnelApply(obj) {
var tempvalue=obj.responseText;
if(tempvalue.length>0){alert(tempvalue);}
RefreshTab('main_config_postfix_relayssl');
}
function StunnelApply(){
var XHR = new XHRConnection();
if(document.getElementById('enable_stunnel').checked){
XHR.appendData('enable_stunnel',1);
}else{
XHR.appendData('enable_stunnel',0);
}
XHR.appendData('localport',document.getElementById('localport').value);
document.getElementById('ssltunnelid').innerHTML=\"<center style='width:400px'><img src='img/wait_verybig.gif'></center>\";
XHR.sendAndLoad('$page', 'GET',x_StunnelApply);
}
LoadAjax('servinfos_stunnel','$page?stunnel-status=yes&hostname={$_GET["hostname"]}');
</script>
";
$html="$intro";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
示例3: sub_page
function sub_page()
{
$main = new main_cf();
$stunnel = new stunnel4();
$relay_host = $stunnel->main_array["postfix_relayhost"]["connect"];
$localport = $stunnel->main_array["postfix_relayhost"]["accept"];
$apply = applysettingsGeneral('apply', 'relayssl_start()', 'apply_text', true);
$main = new main_cf();
$sock = new sockets();
$sTunnel4enabled = $sock->GET_INFO('sTunnel4enabled');
preg_match('#(.+?):([0-9]+)#', $relay_host, $h);
//$relayhost=$main->main_array["relayhost"];
$sasl = new smtp_sasl_password_maps();
preg_match('#(.+?):(.+)#', $sasl->smtp_sasl_password_hash[$h[1]], $ath);
if ($localport == null) {
$sock = new sockets();
$localport = $sock->RandomPort();
}
if ($h[2] == null) {
$h[2] = 465;
}
$form = "\n<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong>{yserver}: </strong></td>\n\t\t\t\t\t<td><input type='text' id='server' value='{$h[1]}' style='font-size:14px'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong>{yport}: </strong></td>\n\t\t\t\t\t<td><input type='text' id='port' value='{$h[2]}' style='font-size:14px;width:30%'></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t</table>\n\n";
$artica = new artica_general();
$enable = Paragraphe_switch_img('{enable_stunnel}', "{enable_stunnel_text}", 'enable_stunnel', $sTunnel4enabled);
$form1 = "\n<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong>{stunnelport}: </strong></td>\n\t\t\t\t\t<td><input type='text' id='localport' value='{$localport}' style='font-size:14px;width:30%'></td>\n\t\t\t\t</tr>\t\t\t\n\t\t\t</table>\n\n";
$form2 = "\n<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong><u>" . texttooltip("{smtp_sender_dependent_authentication}", "{smtp_sender_dependent_authentication_tooltip}", "smtp_sender_dependent_authentication()") . "</u>: </strong></td>\n\t\t\t\t\t<td>" . Field_yesno_checkbox('smtp_sender_dependent_authentication', $main->main_array["smtp_sender_dependent_authentication"]) . "</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<div id='peruser'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='left' nowrap style='font-size:16px' colspan=2><strong>{single_auth}:</strong>\n\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong>{username}: </strong></td>\n\t\t\t\t\t<td><input type='text' id='username' value='{$ath[1]}' style='font-size:14px'></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='right' nowrap style='font-size:14px'><strong>{password}: </strong></td>\n\t\t\t\t\t<td><input type='text' id='password' value='{$ath[2]}' style='font-size:14px;'></td>\n\t\t\t\t</tr>\t\t\t\t\n\t\t\t</table>\n\t\t</div>\n\n";
$form = "<br>" . RoundedLightWhite($form);
$form1 = "<br>" . RoundedLightWhite($form1);
$form2 = "<br>" . RoundedLightWhite($form2);
return "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t<tr " . CellRollOver("stunnelSwitchdiv('stunnel_relayhost')") . ">\n\t\t\t\t<td valign='top' width=1%><img src='img/chiffre1_32.png'></td>\n\t\t\t\t<td valign='top' width=99%><span style='font-size:13px;font-weight:bold'>{relayhost}</span>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2>\n\t\t\t\t\t\t<div id='stunnel_relayhost'>\t\t\t\t\n\t\t\t\t\t\t<p class=caption>{relayhost_text}</p>\n\t\t\t\t\t\t{$form}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td colspan=2><hr></tr>\n\t\t\t\t<tr " . CellRollOver("stunnelSwitchdiv('stunnel_relayport')") . ">\n\t\t\t\t<td valign='top' width=1%><img src='img/chiffre2_32.png'></td>\n\t\t\t\t<td valign='top' width=99%><span style='font-size:13px;font-weight:bold'>{stunnelport}</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=2>\n\t\t\t\t\t\t<div id='stunnel_relayport' style='width:0px;height:0px;visibility:hidden'>\n\t\t\t\t\t\t<p class=caption>{stunnelport_text}</p>\n\t\t\t\t\t\t{$form1}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\t\n\t\t\t\t<tr><td colspan=2><hr></tr>\n\t\t\t\t<tr " . CellRollOver("stunnelSwitchdiv('stunnel_auth')") . ">\n\t\t\t\t<td valign='top' width=1%><img src='img/chiffre3_32.png'></td>\n\t\t\t\t<td valign='top' width=99%><span style='font-size:13px;font-weight:bold'>{authentication}</span></td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=2>\n\t\t\t\t\t\t<div id='stunnel_auth' style='width:0px;height:0px;visibility:hidden'>\n\t\t\t\t\t\t<p class=caption>{authentication_text}</p>\n\t\t\t\t\t\t{$form2}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\t\t\n\t\t\t\t</table>\n\t\t</td>\n\t\t<td valign='top'>{$enable}<br>{$apply}<br></td>\n\t\t\n\t</tr>\n\t</table>\n\t\n\t\n\t";
}