コード例 #1
0
<?php 
require_once 'CacheSessao.php';
$cacheSessao = new CacheSessao();
// Todas páginas testarão se o userId não se deslogou.
// Caso tenha se deslogado, volta a tela de Login.
$USERID = $cacheSessao->get_valor('USERID');
$USERNAME = $cacheSessao->get_valor('USERNAME');
if (!isset($USERID) || $USERID == "") {
    echo '<html>';
    echo '<script>';
    echo 'alert("Deslogado!");';
    echo 'window.location = "Index.php"';
    echo '</script>';
    echo '</html>';
}
コード例 #2
0
 public function printContacts($userId, $orderBy, $orderType)
 {
     $cacheArquivo = new CacheArquivo();
     $existe = $cacheArquivo->em_cache($userId);
     if ($existe) {
         $result = json_decode($cacheArquivo->get_valor($userId), true);
     } else {
         $result = $this->GetAllContacts($userId, $orderBy, $orderType);
     }
     $num_results = count($result["contacts"]["contactId"]);
     echo '<html>';
     echo '<style>                                     ';
     echo 'table, td, th {                             ';
     echo '    border: 1px solid green;          ;';
     echo '    width: ' . $max * 18.0 . 'px;';
     echo '}                                               ';
     echo 'tr:first-child {                                           ';
     echo '    background-color: #046380;        ';
     echo '    color: #EFECCA;                           ;';
     echo '}                                               ';
     echo '</style>                                    ';
     echo '<body>';
     echo '<div id="BODY"> ';
     echo '<form>';
     echo '<table border = 1 align="left" style="width:100%;">';
     // tabela Contacts
     echo '<tr>';
     echo '<th>  <img src="Images/editContactInfo.png" height="32" width="32"> </th>';
     if (isset($_GET['orderId']) && $_GET['orderId'] == 'desc') {
         echo '<th> <a href="Main.php?orderId=asc">ID </a> </th>';
     } else {
         echo '<th> <a href="Main.php?orderId=desc">ID </a> </th>';
     }
     if (isset($_GET['orderNome']) && $_GET['orderNome'] == 'desc') {
         echo '<th> <a href="Main.php?orderNome=asc">Nome </a> </th>';
     } else {
         echo '<th> <a href="Main.php?orderNome=desc">Nome </a> </th>';
     }
     if (isset($_GET['orderEmail']) && $_GET['orderEmail'] == 'desc') {
         echo '<th> <a href="Main.php?orderEmail=asc">Email </a> </th>';
     } else {
         echo '<th> <a href="Main.php?orderEmail=desc">Email </a> </th>';
     }
     echo '<th> Rua </th>';
     echo '<th> Número </th>';
     echo '<th> Complemento </th>';
     echo '<th> Ponto de referência </th>';
     echo '<th> Tipo de telefone </th>';
     echo '<th> Código de País </th>';
     echo '<th> DDD </th>';
     echo '<th> Número de telefone </th>';
     echo '<th colspan="2">  <img src="Images/phone.png" height="32" width="32"> </th>';
     echo '<th colspan="2">  <img src="Images/adress.png" height="32" width="32"> </th>';
     echo '<th >  <img src="Images/contact.png" height="32" width="32"> </th>';
     echo '</tr>';
     for ($i = 0; $i < $num_results; $i++) {
         echo '<tr>';
         echo '<td align=center> <a href="EditContact.php?contactId=' . $result["contacts"]["contactId"][$i] . '&fullName=' . $result["contacts"]["fullName"][$i] . '&email=' . $result["contacts"]["email"][$i] . '&streetName=' . $result["contacts"]["streetName"][$i] . '&number=' . $result["contacts"]["number"][$i] . '&complement=' . $result["contacts"]["complement"][$i] . '&checkPoint=' . $result["contacts"]["checkPoint"][$i] . '&phoneType=' . $result["contacts"]["phoneType"][$i] . '&countryId=' . $result["contacts"]["countryId"][$i] . '&ddd=' . $result["contacts"]["ddd"][$i] . '&phoneNumber=' . $result["contacts"]["phoneNumber"][$i] . '&caSeq=' . $result["contacts"]["caSeq"][$i] . '&cpSeq=' . $result["contacts"]["cpSeq"][$i] . '" title="Editar Linha"> <img src="Images/right.png"></a> </td>';
         echo '<td align="center"> <FONT COLOR="black" > <strong> ' . $result["contacts"]["contactId"][$i] . ' </strong> </td>';
         echo '<td align=center> ' . $result["contacts"]["fullName"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["email"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["streetName"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["number"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["complement"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["checkPoint"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["phoneType"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["countryId"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["ddd"][$i] . ' </td>';
         echo '<td align=center> ' . $result["contacts"]["phoneNumber"][$i] . ' </td>';
         echo '<td align=center> <a href="NewContactPhone.php?contactId=' . $result["contacts"]["contactId"][$i] . '" title="Inserir telefone"> <img src="Images/add.png"> </img> </a> </td>';
         echo '<td align=center> <a href="ContactPhone_del.php?contactId=' . $result["contacts"]["contactId"][$i] . '&sequential=' . $result["contacts"]["cpSeq"][$i] . '" title="Deletar telefone"> <img src="Images/del.png"> </img></a> </td>';
         echo '<td align=center> <a href="NewContactAdress.php?contactId=' . $result["contacts"]["contactId"][$i] . '" title="Inserir endereço"> <img src="Images/add.png"> </img> </a> </td>';
         echo '<td align=center> <a href="ContactAdress_del.php?contactId=' . $result["contacts"]["contactId"][$i] . '&sequential=' . $result["contacts"]["caSeq"][$i] . '" title="Deletar endereço"> <img src="Images/del.png"> </img> </a> </td>';
         echo '<td align=center> <a href="Contact_del.php?contactId=' . $result["contacts"]["contactId"][$i] . '" title="Deletar contato"> <FONT COLOR="white"> <strong> <img src="Images/del.png"> </img></strong> </a> </td>';
         echo '</tr>';
     }
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '</body>';
     echo '</html>';
     $cacheSessao = new CacheSessao();
     $USERID = $cacheSessao->get_valor('USERID');
     $Log = new Log(4);
     // log de listagem, conforme a tabela Actions
     $Log->UserId($USERID);
     //
     $Log->InsertLog();
 }