1

管理機能から特定のアカウントを非表示にする必要があります。

現在、管理者用に eash アカウントがリストされています。ただし、たとえば gmail.com で終わるすべてのメールは、他のメールと一緒にリストするように依頼するまで非表示にします。

これは私が持っている電子メールのコードです:

    if(empty($resLine['ord_conEmail'])){
        $resLine['ord_conEmail'] = "Account {$resLine['ord_account']}";
    }

コードの大きい方は次のとおりです。

  $buffer .= "
        <div id=\"catDetail\">
            <h1>Orders Listing$pnStr</h1>
            <div>
                <table class=\"roundTableFormat\">
                    <thead>
                        <tr>
                            <th>Order ID</th>
                            <th>Order Date</th>
                            <th>Cust. Email Address</th>
                            <th>Order Total</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody>";

forEach($res as $resLine){
    if($resLine['ord_date'] > mktime() - 86400){
        //24 hours
        $resLine['ord_date'] = date("D jS - g:iA", $resLine['ord_date']);
    }else if($resLine['ord_date'] > mktime() - 259200){
        //OLD:display Day of Week for last five days (60*60*24*5=432000 sec
        //New: 3 days = 259200
        $resLine['ord_date'] = date("D jS - g:iA", $resLine['ord_date']);
    }else{
        //display full date
        $resLine['ord_date'] = date("M j, Y", $resLine['ord_date']);
    }

    $resLine['ord_total'] = "$".number_format($resLine['ord_total'], 2);

    if(empty($resLine['ord_conEmail'])){
        $resLine['ord_conEmail'] = "Account {$resLine['ord_account']}";
    }

    $buffer .= "
            <tr>
                <td class=\"ds br\">{$resLine['ord_id']}</td>
                <td class=\"al ls br\">{$resLine['ord_date']}</td>
                <td class=\"al ls\">{$resLine['ord_conEmail']}</td>
                <td class=\"ar bl br\">{$resLine['ord_total']}</td>
                <td class=\"ds \">
                    <a href=\"?action=orders&ordview={$resLine['ord_id']}\">View</a>
                    <a href=\"?action=orders&ordprint={$resLine['ord_id']}\">Print</a>
                </td>
            </tr>";
}

特定のメールが表示されないようにするループを作成するにはどうすればよいですか?

4

1 に答える 1

0

省略したい電子メールドメインを格納するハッシュテーブル(連想配列)を追加できます。

$domains = array(
    'gmail.com' => true
);

ドメインが設定されているかどうかを確認する条件ステートメントを追加できます。印刷するHTMLをバッファリングする行の前に挿入されます。

$email = $resLine['ord_conEmail'];

// Assumes e-mail address is correctly formatted: user@domain
$result = explode('@', $email);
$domain = $result[1];

if (isset($domains[$domain]) && $domains[$domain]) {
    continue; // Skip row
}
于 2012-07-16T16:42:51.540 に答える