echo $r['situacao'] ? 'green' : 'red'; echo ";'>"; echo $r['email'] . "\t"; //Link de exclusão echo "<a href='cadastro.php?cod=d&hash={$r['cod']}' title='Clique para excluir'>"; echo $r['cod']; echo "</a>" . "\t"; //Link para ser enviado por e-mail $link = "<a href='"; $link .= $_SERVER['PHP_SELF']; $link .= "?cod=e&hash={$r['cod']}' title='Clique para confirmar o e-mail'>"; $link .= $r['situacao'] . "\t"; $link .= "</a> \t"; echo $link; echo converteDataMySQLPHP($r['dtCadastro']) . "\t"; echo converteDataMySQLPHP($r['dtAtualizacao']); echo "</p>\n"; } } elseif ($_GET['cod'] == 'd' && isset($_GET['hash'])) { $sql = "delete from lista where cod = :hash"; $hash = filter_input(INPUT_GET, 'hash', FILTER_SANITIZE_STRING); //echo "<h1>$hash</h1>"; $p = $conn->prepare($sql); $q = $p->execute(array(':hash' => $hash)); header("Location: cadastro.php?cod=listar"); } elseif ($_GET['cod'] == 'e' && isset($_GET['hash'])) { $sql = "update lista set situacao=1, dtAtualizacao = now() where cod = :hash"; $hash = filter_input(INPUT_GET, 'hash', FILTER_SANITIZE_STRING); //echo "<h1>$hash</h1>"; $p = $conn->prepare($sql); $q = $p->execute(array(':hash' => $hash));
$dataPHP = $dataMySQL; if ($dataMySQL) { $dataPHP = date('d/m/Y G:i:s', strtotime($dataMySQL)); } return $dataPHP; } $id = $_GET['id']; $sql = "SELECT n.titulo,n.conteudo,n.dtCadastro,a.nome from "; $sql .= "noticia n inner join autor a using(idautor) where "; $sql .= "idnoticia = '{$id}'"; //echo $sql; die; $q = $conn->query($sql); $q->setFetchMode(PDO::FETCH_ASSOC); while ($r = $q->fetch()) { $titulo = $r['titulo']; $dtCadastro = converteDataMySQLPHP($r['dtCadastro']); $autor = $r['nome']; $conteudo = $r['conteudo']; } ?> <div class="modal-dialog"> <!-- Conteúdo da modal--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title"><?php echo utf8_encode($titulo); ?>
echo ";'>"; echo $r['email'] . "\t"; //Link de exclusão echo "<a href='cadastro.php?cod=d&hash={$r['codigo']}' "; echo "title='Clique para excluir'>"; echo $r['codigo']; echo "</a>" . "\t"; //link para ser enviado por email $link = "<a href='" . $_SERVER['PHP_SELF']; $link .= "?cod=e&hash={$r['codigo']}' "; $link .= "title='Clique para confirmar o e-mail'>"; $link .= $r['status'] . "\t"; $link .= "</a>"; echo $link; echo converteDataMySQLPHP($r['dtCadastro']) . "\t"; echo converteDataMySQLPHP($r['dtAtivacao']); echo "</p>\n"; } } elseif ($_GET['cod'] == 'd' && isset($_GET['hash'])) { $sql = "delete from lista where cod = :hash"; $hash = filter_input(INPUT_GET, 'hash', FILTER_SANITIZE_STRING); //echo "<h1>$hash</h1>"; $p = $conn->prepare($sql); $q = $p->execute(array(':hash' => $hash)); header("Location: cadastro.php?cod=listar"); } elseif ($_GET['cod'] == 'e' && isset($_GET['hash'])) { $sql = "update lista set status=1, dtAtivacao = now() where cod= :hash"; $hash = filter_input(INPUT_GET, 'hash', FILTER_SANITIZE_STRING); //echo "<h1>$hash</h1>"; $p = $conn->prepare($sql); $q = $p->execute(array(':hash' => $hash));