Ir para conteúdo
Fórum Script Brasil

eduehi

Membros
  • Total de itens

    6
  • Registro em

  • Última visita

Tudo que eduehi postou

  1. Validar não é uma função, e sim uma classe. Não funcionou galera.
  2. eduehi

    Paginação com PHP e MySql

    Vou testar. Valeu amigo.
  3. Bom dia Pessoal, estou fazendo uma tela de login, mas não consigo apresentar um "alert" em caso de falha. Segue meu código. <?php class Acesso{ public function run(){ $html = ''; Session::setValue('erro',''); switch (App::getAction()) { case 'logout': $this->logout(); break; case 'validar': $this->validar(); break; default: $html = $this->login(); break; } return $html; } public function login(){ $html_login= new Html(); $html=$html_login->load( 'view/login.html'); return $html; } public function validar(){ $dados = Connection::select( "SELECT login,senha,departamento_id FROM usuario WHERE login='".$_POST['usuario']."'" ); Connection::close(); foreach( $dados as $reg): if($_POST['senha']==$reg['senha']): Session::setValue('logado',true); Session::setValue('departamento',$reg['departamento_id']); else: //Session::setValue('erro'); echo "<script>alert('Dados inválidos!);</script>"; //header('location: index.php'); endif; endforeach; header( 'Location: '.URL ) ; } public function logout(){ Session::setValue('logado',false); header( 'Location: '.URL ) ; } }
  4. Galera eu to criando um portal de noticias, onde vou fazer o upload por um formulário, e o mesmo tem que jogar a imagem pra uma pasta, e salvar o caminho no banco de dados. <?php class Home { public function run() { $html_home = new Html(); $html = $html_home->load('view/home.html'); $tcomunicados = ''; $taniver = ''; $tdados = Connection::select("select * from comunicados limit 3"); foreach ($tdados as $reg) { $tcomunicados .= '<TR> <TD ROWSPAN=9 HEIGHT="auto" STYLE="border-top: 1px solid #f1f1f1;" class="text-center"><img src="' . $reg['imagem'] . '" width="150"></img></TD> <TD COLSPAN=5 VALIGN=MIDDLE STYLE="border-top: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;">' . $reg['titulo'] . '</TD> </TR> <TR> <TD COLSPAN=2><small><cite>' . $reg['por'] . '</cite></small></TD> <TD><BR></TD> <TD COLSPAN=2><em><small class="subheader">' . $reg['data'] . '</small></em></TD> </TR> <TR> <TD COLSPAN=5 ROWSPAN=6>' . $reg['comunicado'] . '</TD> </TR><TR></TR><TR></TR><TR></TR><TR></TR><TR></TR><TR> <TD></TD> <TD></TD><TD><br></TD> <TD></TD> <TD></TD> </TR>'; } $tdados2 = Connection::select("SELECT * FROM aniversarios"); foreach ($tdados2 as $reg) { $taniver .= '<TR> <td BGCOLOR="#FFD700" STYLE="border-bottom: 1px solid #f1f1f1" HEIGHT="15" ALIGN="LEFT"><span><font size=2 color="#006400" ><b>' . $reg['data'] . '</span> - <span><font size=2 color="#006400">' . $reg['nome'] . '</span>, <span><font size=2 color="#006400">' . $reg['funcao'] . '</span> - <span><font size=2 color="#006400">' . $reg['filial'] . '</span></td> </TR><TR> </TR>'; } $html = str_replace('#TCOMUNICADOS#', $tcomunicados, $html); $html = str_replace('#TANIVER#', $taniver, $html); return $html; } }
  5. eduehi

    Paginação com PHP e MySql

    Não me ajudou muito rs, não estou usando nenhum framework. Dá uma força ai galera :(
  6. Bom dia Pessoal, sou novo no fórum e iniciante em PHP, e preciso criar uma paginação de conteúdo, gostaria de exibir 3 resultados na página. Segue me código: <?php class Home { public function run() { $html_home = new Html(); $html = $html_home->load('view/home.html'); $tcomunicados = ''; $tdados = Connection::select("select * from comunicados"); foreach ($tdados as $reg) { $tcomunicados .= '<TR> <TD ROWSPAN=9 HEIGHT="auto" STYLE="border-top: 1px solid #f1f1f1;" class="text-center"><img src="' . $reg['imagem'] . '" width="150"></img></TD> <TD COLSPAN=5 VALIGN=MIDDLE STYLE="border-top: 1px solid #f1f1f1; border-bottom: 1px solid #f1f1f1;">' . $reg['titulo'] . '</TD> </TR><TR> <TD COLSPAN=2><small><cite>' . $reg['por'] . '</cite></small></TD> <TD><BR></TD> <TD COLSPAN=2><em><small class="subheader">' . $reg['data'] . '</small></em></TD> </TR><TR> <TD COLSPAN=5 ROWSPAN=6>' . $reg['comunicado'] . '</TD> </TR><TR></TR><TR></TR><TR></TR><TR></TR><TR></TR><TR> <TD></TD> <TD></TD><TD><br></TD> <TD></TD> <TD></TD> </TR>'; } $html = str_replace('#TCOMUNICADOS#', $tcomunicados, $html); Se alguém puder me ajudar agradeço.
×
×
  • Criar Novo...