PHP显示来自一个ID

时间:2017-01-10 12:52:07

标签: php html arrays

Overview Screenshot

目前,我对域名进行了概述。我使用联系人ID为197246的帐户登录,但它显示了所有帐户。在这里,我想过滤我的概述,即登录的用户看到自己的域名。

因此,当ID 197246登录时,显示联系人ID为197246的域。当ID 307890登录时,显示这些域。

到目前为止,这是我的代码。我想这里需要一个过滤器。



<?php

unset($command);
$command = array(
	"command" => "DomainsListActive"
);

$api = new Versio_api();
$versio = $api->api_send($command);

if($versio['success']==0) {
	echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
	if($versio['total_count']>0)
	{
require_once("includes/submenu.php");
?>
    <div class="col-sm-9 col-md-9" style="width:80%;">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Klantenpaneel</h3>
        </div>
        <div class="panel-body">
			<form method="post" action="">
				<table class="table table-striped">
					<thead>
					  <tr>
						<th>Domein</th>
						<th>TLD</th>
						<th>Verloop datum</th>
						<th>Automatisch verlengen</th>
						<th>contact ID</th>
					  </tr>
					</thead>
					<table class="table table-striped table-bordered">
					<tbody>
<?php 
	$teller = 1;
	while($versio['total_count']>=$teller) {
?>
					  <tr>
						<td><a href="records.php?domain=<?php echo        $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
						<?php echo $versio['domain_'.$teller]; ?></a></td>
						<td>.<?php echo $versio['tld_'.$teller]; ?></td> 
						<td><?php echo $versio['expiration_date_'.$teller]; ?></td>
						<td><?php echo $versio['auto_renew_'.$teller]; ?></td>
						<td><?php echo $versio['contactid_'.$teller]; ?></td>
					  </tr>
<?php 				  $teller++;
					}
?> 
					</tbody>
				</table>
			</form>
		</div>
	</div>
<?php
	} else {
		echo("Er zijn geen DNS records gevonden voor dit domein.");
	}
}
?>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

Versio的文档为您提供了通话中的完整选项列表。你可以做的一个选择是检查&#39; contactid_x&#39;等于登录用户。

有关其wiki right here

的更多信息

作为一个例子,这可以解决问题:

unset($command);
$command = array(
    "command" => "DomainsListActive"
);

$api = new Versio_api();
$versio = $api->api_send($command);

if($versio['success']==0) {
    echo("Fout opgetreden. Fout code: ".$versio['command_response_code'].". Fout text: ".$versio['command_response_message']."");
}
else {
    if($versio['total_count']>0)
    {
require_once("includes/submenu.php");
?>
    <div class="col-sm-9 col-md-9" style="width:80%;">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Klantenpaneel</h3>
        </div>
        <div class="panel-body">
            <form method="post" action="">
                <table class="table table-striped">
                    <thead>
                      <tr>
                        <th>Domein</th>
                        <th>TLD</th>
                        <th>Verloop datum</th>
                        <th>Automatisch verlengen</th>
                        <th>contact ID</th>
                      </tr>
                    </thead>
                    <table class="table table-striped table-bordered">
                    <tbody>
<?php 
    $teller = 1;
    while($versio['total_count']>=$teller) {
        if ($versio['contactid_'. $teller] != 197246 ) continue;
?>
                      <tr>
                        <td><a href="records.php?domain=<?php echo        $versio['domain_'.$teller]; ?>&tld=<?php echo $versio['tld_'.$teller]; ?>">
                        <?php echo $versio['domain_'.$teller]; ?></a></td>
                        <td>.<?php echo $versio['tld_'.$teller]; ?></td> 
                        <td><?php echo $versio['expiration_date_'.$teller]; ?></td>
                        <td><?php echo $versio['auto_renew_'.$teller]; ?></td>
                        <td><?php echo $versio['contactid_'.$teller]; ?></td>
                      </tr>
<?php                 $teller++;
                    }
?> 
                    </tbody>
                </table>
            </form>
        </div>
    </div>
<?php
    } else {
        echo("Er zijn geen DNS records gevonden voor dit domein.");
    }
}
?>

确保使用第41行用户的ID替换ID