Ir para conteúdo
alefpr

Exibir senha gerada pelo PHP através do JavaScript

Recommended Posts

Sou iniciante em PHP, estou criando um sistema para gerenciamento de fila de banco. https://i.imgur.com/RCDPQ5E.png

Funciona assim: 1º o cliente retira a senha, a cada click uma nova senha é gerada.(até aí tudo bem)

                              2º quando o caixa clicar em Chamar, para chamar a próxima pessoa da fila a senha seria exibida na tela (Esse é o problema, não faço a mínima ideia de como exibir a senha via javascript). https://i.imgur.com/oznFsOu.png

Obs: Todas as senhas geradas são guardadas em um txt. https://i.imgur.com/0THr1Lk.png

O que foi feito até agora:
HTML/JavaScript

<html>
<body>
<title>Fila</title>

<h2>Gerenciamento de fila de banco</h2>
<form method = "get" action = "newbie.php">

    <!--PARTE DO CLIENTE -->

    RETIRE SUA SENHA AQUI : <input type="submit" value="Retirar senha"/><br/>


    <!--PARTE DO ATENDENTE-->

    <br/><label>ESCOLHA O CAIXA: </label>
    <select>
        <option>CAIXA DE ATENDIMENTO/PAGAMENTO</option>
    </select><br/>
    <br/>CLIQUE AQUI PARA CHAMAR: <input type="button" value="Chamar" onclick="msg()">
</form>
	<script>
		function msg() {
		alert("Exibir a senha gerada aqui");
		
	}
	</script>
</body>
</html>

PHP

<?php
  // Esse código é do 'tetsuo', um membro do fórum
  // define letras maiúsculas de A até Z
  $letras = range('A', 'Z');

  // define números inteiros de 1 até 9
  $numeros = range(1, 9);

  // embaralha as letras
  shuffle($letras);

  // embaralha os números
  shuffle($numeros);

  // cria uma senha com 3 letras - um número
  $senha = implode('', array_slice($letras, 3, 3)) . '-' . end($numeros);


  //define um nome para o arquivo
  $file = 'senhas.txt';

  // se não puder criar/abrir o arquivo
  if (!$handleFile = fopen($file, "a+")) {
    // mostra mensagem na tela
    die("<p>Erro ao abrir/criar o arquivo: (<b>$file</b>)</p>");
  }
  // grava senha com uma quebra de linha no final
  fwrite($handleFile, $senha . "\r\n");

  // fecha o arquivo
  fclose($handleFile);

  // mostra o conteúdo do arquivo na tela:
  echo '<pre>';
  print_r(file_get_contents($file));
  echo '</pre>';
?>

<a href="newbie.html">Gerar nova senha.</a>

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Exemplo PHP

<?php
$enviar_para_javascript = 'blablabla....';
echo ("<script>recebe_do_php('{$enviar_para_javascript}')</script>");

 

Exemplo Javascript

function recebe_do_php(parametro) {
  console.log('Eu recebi do php essa coisa: ' + parametro);
}

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

Entrar Agora

  • Conteúdo Similar

    • Por Rogerio Pancini
      Boa noite pessoal.
       
      Esse é sonho de consumo, nunca consegui parar para estudar como fazer... mas, chegou a hora.
      Uso o PhpMailer para enviar e-mail pelo site.
      Eu customizei o zero um template de e-mail, pois o retorno dos formulários de contato estava utilizando texto.
      Na unha está funcionando muito bem, mas gostaria de otimizar o processo, pois para todos os formulário, tenho que configurar o script de e-mail.
      A solução mais viável é fazer uma function.
       
      Eu fiz, e parece que vai dar certo.
       
      A dúvida que fique é que preciso começar com o parâmetro do PhpMailer ($mail->Body       = ') e depois concatenar em algumas partes do construtor do e-mail.
      Vou colocar o que eu fiz até agora, mas o bo está no return.
      Será que minha ideia é possível de ser executada?
       
      Obrigado!!
       
      PS: O "1, 1, 1, 1" abaixo é só teste, desconsiderem.
      <?php function corpo_email($empresa_sel, $cor_topo_sel, $cor_rodape_sel, $cor_topo_sel, $site_sel, $logo_sel, $titulo_sel, $nome, $email, $telefone, $mensagem, $data, $hora, $empresa_sel, $cor_rodape_sel, $site_sel, $site_link, $config) { $mail->Body = ' <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <head> <!-- NAME: FOLLOW UP --> <!--[if gte mso 15]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG/> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>'.$empresa_sel.'</title> <style type="text/css"> p{ margin:10px 0; padding:0; } table{ border-collapse:collapse; } h1,h2,h3,h4,h5,h6{ display:block; margin:0; padding:0; } img,a img{ border:0; height:auto; outline:none; text-decoration:none; } body,#bodyTable,#bodyCell{ height:100%; margin:0; padding:0; width:100%; } #outlook a{ padding:0; } img{ -ms-interpolation-mode:bicubic; } table{ mso-table-lspace:0pt; mso-table-rspace:0pt; } .ReadMsgBody{ width:100%; } .ExternalClass{ width:100%; } p,a,li,td,blockquote{ mso-line-height-rule:exactly; } a[href^=tel],a[href^=sms]{ color:inherit; cursor:default; text-decoration:none; } p,a,li,td,body,table,blockquote{ -ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; } .ExternalClass,.ExternalClass p,.ExternalClass td,.ExternalClass div,.ExternalClass span,.ExternalClass font{ line-height:100%; } a[x-apple-data-detectors]{ color:inherit !important; text-decoration:none !important; font-size:inherit !important; font-family:inherit !important; font-weight:inherit !important; line-height:inherit !important; } .templateContainer{ max-width:600px !important; } a.mcnButton{ display:block; } .mcnImage{ vertical-align:bottom; } .mcnTextContent{ word-break:break-word; } .mcnTextContent img{ height:auto !important; } .mcnDividerBlock{ table-layout:fixed !important; } /* @tab Page @section Heading 1 @style heading 1 */ h1{ /*@editable*/color:#222222; /*@editable*/font-family:Helvetica; /*@editable*/font-size:40px; /*@editable*/font-style:normal; /*@editable*/font-weight:bold; /*@editable*/line-height:150%; /*@editable*/letter-spacing:normal; /*@editable*/text-align:center; } /* @tab Page @section Heading 2 @style heading 2 */ h2{ /*@editable*/color:#222222; /*@editable*/font-family:Helvetica; /*@editable*/font-size:34px; /*@editable*/font-style:normal; /*@editable*/font-weight:bold; /*@editable*/line-height:88%; /*@editable*/letter-spacing:normal; /*@editable*/text-align:left; } /* @tab Page @section Heading 3 @style heading 3 */ h3{ /*@editable*/color:#000000; /*@editable*/font-family:Helvetica; /*@editable*/font-size:22px; /*@editable*/font-style:normal; /*@editable*/font-weight:bold; /*@editable*/line-height:150%; /*@editable*/letter-spacing:normal; /*@editable*/text-align:center; } /* @tab Page @section Heading 4 @style heading 4 */ h4{ /*@editable*/color:#999999; /*@editable*/font-family:Georgia; /*@editable*/font-size:20px; /*@editable*/font-style:italic; /*@editable*/font-weight:normal; /*@editable*/line-height:125%; /*@editable*/letter-spacing:normal; /*@editable*/text-align:left; } /* @tab Header @section Header Container Style */ #templateHeader{ /*@editable*/ /* header */ /*@editable*/background: #'.$cor_topo_sel.'; /* For browsers that do not support gradients */ /*@editable*//*background: linear-gradient(to bottom right, #1a2980, #26d0cd); /* Standard syntax (must be last) */ /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:9px; /*@editable*/padding-bottom:9px; } /* @tab Header @section Header Interior Style */ .headerContainer{ /*@editable*/background-color:transparent; /*@editable*/background-image:none; /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:0; /*@editable*/padding-bottom:0; } /* @tab Header @section Header Text */ .headerContainer .mcnTextContent,.headerContainer .mcnTextContent p{ /*@editable*/color:#000000; /*@editable*/font-family:Helvetica; /*@editable*/font-size:16px; /*@editable*/line-height:150%; /*@editable*/text-align:left; } /* @tab Header @section Header Link */ .headerContainer .mcnTextContent a,.headerContainer .mcnTextContent p a{ /*@editable*/color:#00ADD8; /*@editable*/font-weight:normal; /*@editable*/text-decoration:underline; } /* @tab Body @section Body Container Style */ #templateBody{ /*@editable*/background-color:#FFFFFF; /*@editable*/background-image:none; /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:21px; /*@editable*/padding-bottom:21px; } /* @tab Body @section Body Interior Style */ .bodyContainer{ /*@editable*/background-color:transparent; /*@editable*/background-image:none; /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:0; /*@editable*/padding-bottom:0; } /* @tab Body @section Body Text */ .bodyContainer .mcnTextContent,.bodyContainer .mcnTextContent p{ /*@editable*/color:#000000; /*@editable*/font-family:Helvetica; /*@editable*/font-size:16px; /*@editable*/line-height:150%; /*@editable*/text-align:left; } /* @tab Body @section Body Link */ .bodyContainer .mcnTextContent a,.bodyContainer .mcnTextContent p a{ /*@editable*/color:#00ADD8; /*@editable*/font-weight:normal; /*@editable*/text-decoration:underline; } /* @tab Footer @section Footer Style */ #templateFooter{ /*@editable*/ /* Rodapé */ background: #'.$cor_rodape_sel.'; /* For browsers that do not support gradients */ /* background: linear-gradient(to bottom right, #1a2980, #26d0cd); /* Standard syntax (must be last) */ /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:0px; /*@editable*/padding-bottom:0px; } /* @tab Footer @section Footer Interior Style */ .footerContainer{ /*@editable*/background-color:transparent; /*@editable*/background-image:none; /*@editable*/background-repeat:no-repeat; /*@editable*/background-position:center; /*@editable*/background-size:cover; /*@editable*/border-top:0; /*@editable*/border-bottom:0; /*@editable*/padding-top:0; /*@editable*/padding-bottom:0; } /* @tab Footer @section Footer Text */ .footerContainer .mcnTextContent,.footerContainer .mcnTextContent p{ /*@editable*/color:#FFFFFF; /*@editable*/font-family:Helvetica; /*@editable*/font-size:12px; /*@editable*/line-height:150%; /*@editable*/text-align:center; } /* @tab Footer @section Footer Link */ .footerContainer .mcnTextContent a,.footerContainer .mcnTextContent p a{ /*@editable*/color:#FFFFFF; /*@editable*/font-weight:normal; /*@editable*/text-decoration:underline; } @media only screen and (min-width:768px){ .templateContainer{ width:600px !important; } } @media only screen and (max-width: 480px){ body,table,td,p,a,li,blockquote{ -webkit-text-size-adjust:none !important; } } @media only screen and (max-width: 480px){ body{ width:100% !important; min-width:100% !important; } } @media only screen and (max-width: 480px){ .mcnImage{ width:100% !important; } } @media only screen and (max-width: 480px){ .mcnCartContainer,.mcnCaptionTopContent,.mcnRecContentContainer,.mcnCaptionBottomContent,.mcnTextContentContainer,.mcnBoxedTextContentContainer,.mcnImageGroupContentContainer,.mcnCaptionLeftTextContentContainer,.mcnCaptionRightTextContentContainer,.mcnCaptionLeftImageContentContainer,.mcnCaptionRightImageContentContainer,.mcnImageCardLeftTextContentContainer,.mcnImageCardRightTextContentContainer{ max-width:100% !important; width:100% !important; } } @media only screen and (max-width: 480px){ .mcnBoxedTextContentContainer{ min-width:100% !important; } } @media only screen and (max-width: 480px){ .mcnImageGroupContent{ padding:9px !important; } } @media only screen and (max-width: 480px){ .mcnCaptionLeftContentOuter .mcnTextContent,.mcnCaptionRightContentOuter .mcnTextContent{ padding-top:9px !important; } } @media only screen and (max-width: 480px){ .mcnImageCardTopImageContent,.mcnCaptionBlockInner .mcnCaptionTopContent:last-child .mcnTextContent{ padding-top:18px !important; } } @media only screen and (max-width: 480px){ .mcnImageCardBottomImageContent{ padding-bottom:9px !important; } } @media only screen and (max-width: 480px){ .mcnImageGroupBlockInner{ padding-top:0 !important; padding-bottom:0 !important; } } @media only screen and (max-width: 480px){ .mcnImageGroupBlockOuter{ padding-top:9px !important; padding-bottom:9px !important; } } @media only screen and (max-width: 480px){ .mcnTextContent,.mcnBoxedTextContentColumn{ padding-right:18px !important; padding-left:18px !important; } } @media only screen and (max-width: 480px){ .mcnImageCardLeftImageContent,.mcnImageCardRightImageContent{ padding-right:18px !important; padding-bottom:0 !important; padding-left:18px !important; } } @media only screen and (max-width: 480px){ .mcpreview-image-uploader{ display:none !important; width:100% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Heading 1 @tip Make the first-level headings larger in size for better readability on small screens. */ h1{ /*@editable*/font-size:30px !important; /*@editable*/line-height:125% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Heading 2 @tip Make the second-level headings larger in size for better readability on small screens. */ h2{ /*@editable*/font-size:26px !important; /*@editable*/line-height:125% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Heading 3 @tip Make the third-level headings larger in size for better readability on small screens. */ h3{ /*@editable*/font-size:20px !important; /*@editable*/line-height:150% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Heading 4 @tip Make the fourth-level headings larger in size for better readability on small screens. */ h4{ /*@editable*/font-size:18px !important; /*@editable*/line-height:150% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Boxed Text @tip Make the boxed text larger in size for better readability on small screens. We recommend a font size of at least 16px. */ .mcnBoxedTextContentContainer .mcnTextContent,.mcnBoxedTextContentContainer .mcnTextContent p{ /*@editable*/font-size:14px !important; /*@editable*/line-height:150% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Header Text @tip Make the header text larger in size for better readability on small screens. */ .headerContainer .mcnTextContent,.headerContainer .mcnTextContent p{ /*@editable*/font-size:16px !important; /*@editable*/line-height:150% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Body Text @tip Make the body text larger in size for better readability on small screens. We recommend a font size of at least 16px. */ .bodyContainer .mcnTextContent,.bodyContainer .mcnTextContent p{ /*@editable*/font-size:16px !important; /*@editable*/line-height:150% !important; } } @media only screen and (max-width: 480px){ /* @tab Mobile Styles @section Footer Text @tip Make the footer content text larger in size for better readability on small screens. */ .footerContainer .mcnTextContent,.footerContainer .mcnTextContent p{ /*@editable*/font-size:14px !important; /*@editable*/line-height:150% !important; } } </style> </head> <body> <center> <table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable"> <tr> <td align="center" valign="top" id="bodyCell"> <!-- BEGIN TEMPLATE // --> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td style="background: #'.$cor_topo_sel.';" align="center" valign="top" id="templateHeader" data-template-container> <!--[if gte mso 9]> <table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;"> <tr> <td align="center" valign="top" width="600" style="width:600px;"> <![endif]--> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer"> <tr> <td valign="top" class="headerContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;"> <tbody class="mcnTextBlockOuter"> <tr> <td valign="top" class="mcnTextBlockInner" style="padding-top:9px;"> <!--[if mso]> <table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;"> <tr> <![endif]--> <!--[if mso]> <td valign="top" width="300" style="width:300px;"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:300px;" width="100%" class="mcnTextContentContainer"> <tbody><tr> <td valign="top" class="mcnTextContent" style="padding: 0px 18px 9px; line-height: 100%;"> <h4 class="null"><img data-file-id="20865" height="39" src="'.$site_sel.'/images/email/'.$logo_sel.'" style="border: 0px; height: 39px; margin: 3% 0 0 0;" width="196"></h4> </td> </tr> </tbody></table> <!--[if mso]> </td> <![endif]--> <!--[if mso]> <td valign="top" width="300" style="width:300px;"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:300px;" width="100%" class="mcnTextContentContainer"> <tbody><tr> <td valign="top" class="mcnTextContent" style="padding: 16px 18px 9px; line-height: 100%;"> <h2 class="mc-toc-title" style="text-align: left;"><span style="font-size:25px"><span style="color:#ffffff; text-transform: uppercase;"><strong>'.$titulo_sel.'</strong></span></span></h2> </td> </tr> </tbody></table> <!--[if mso]> </td> <![endif]--> <!--[if mso]> </tr> </table> <![endif]--> </td> </tr> </tbody> </table></td> </tr> </table> <!--[if gte mso 9]> </td> </tr> </table> <![endif]--> </td> </tr> <tr> <td align="center" valign="top" id="templateBody" data-template-container> <!--[if gte mso 9]> <table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;"> <tr> <td align="center" valign="top" width="600" style="width:600px;"> <![endif]--> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer"> <tr> <td valign="top" class="bodyContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;"> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100%; padding: 18px 18px 0px;"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;"> <tbody><tr> <td> <span></span> </td> </tr> </tbody></table> <!-- <td class="mcnDividerBlockInner" style="padding: 18px;"> <hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" /> --> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;"> <tbody class="mcnTextBlockOuter"> <tr> <td valign="top" class="mcnTextBlockInner" style="padding-top:9px;"> <!--[if mso]> <table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;"> <tr> <![endif]--> <!--[if mso]> <td valign="top" width="600" style="width:600px;"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px; text-align: center; color: #FFFFFF;"> <p> <span style="font-size:18px"> <i>Enviado por</i>:<br /><br /> Nome: '.$nome.'<br /> E-mail: '.$email.'<br /> Telefone: '.$telefone.'<br /> <u>Mensagem</u>: '.$mensagem.'<br /><br /> Enviado em: '.$data.', às '.$hora.' </span> <br /><br /> &nbsp; </p> </td> </tr> </tbody></table> <!--[if mso]> </td> <![endif]--> <!--[if mso]> </tr> </table> <![endif]--> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100%; padding: 9px 18px 0px;"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;"> <tbody><tr> <td> <span></span> </td> </tr> </tbody></table> <!-- <td class="mcnDividerBlockInner" style="padding: 18px;"> <hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" /> --> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width: 100%; padding: 18px 18px 0px;"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;"> <tbody><tr> <td> <span></span> </td> </tr> </tbody></table> <!-- <td class="mcnDividerBlockInner" style="padding: 18px;"> <hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" /> --> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextBlock" style="min-width:100%;"> <!--[if gte mso 9]> <table align="center" border="0" cellspacing="0" cellpadding="0" width="100%"> <![endif]--> <tbody class="mcnBoxedTextBlockOuter"> <tr> <td valign="top" class="mcnBoxedTextBlockInner"> <!--[if gte mso 9]> <td align="center" valign="top" "> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnBoxedTextContentContainer"> <tbody> <tr> <td style="padding-top:9px; padding-left:18px; padding-bottom:9px; padding-right:18px;"> <table border="0" cellpadding="18" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% !important;background-color: #F7F7F7;"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: #000000;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;"> <h3 style="text-align: left;">'.$empresa_sel.'</h3> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <!--[if gte mso 9]> </td> <![endif]--> <!--[if gte mso 9]> </tr> </table> <![endif]--> </td> </tr> </tbody> </table></td> </tr> </table> <!--[if gte mso 9]> </td> </tr> </table> <![endif]--> </td> </tr> <tr> <td style="background: #'.$cor_rodape_sel.';" align="center" valign="top" id="templateFooter" data-template-container> <!--[if gte mso 9]> <table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;"> <tr> <td align="center" valign="top" width="600" style="width:600px;"> <![endif]--> <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer"> <tr> <td valign="top" class="footerContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowBlock" style="min-width:100%;"> <tbody class="mcnFollowBlockOuter"> <tr> <td align="center" valign="top" style="padding:9px" class="mcnFollowBlockInner"> <!--[if gte mso 9]> <td align="center" valign="top" "> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnBoxedTextContentContainer"> <tbody> <tr> <td style="padding-top:9px; padding-left:18px; padding-bottom:9px; padding-right:18px;"> <table border="0" cellpadding="18" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% !important;"> <tbody> <tr> <td valign="top" class="mcnTextContent" style="color: #FFFFFF;font-family: Helvetica;font-size: 20px;line-height: 200%;text-align: center;"> <a href="'.$site_sel.'" style="text-decoration: none;"><h3 style="color: #FFFFFF; ">'.$site_link.'</h3></a> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <!--[if gte mso 9]> </td> <![endif]--> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentContainer" style="min-width:100%;"> <tbody><tr> <td align="center" style="padding-left:9px;padding-right:9px;"> <table border="0" cellpadding="0" cellspacing="0" class="mcnFollowContent"> <tbody><tr> <td align="center" valign="top" style="padding-top:9px; padding-right:9px; padding-left:9px;"> <table align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td align="center" valign="top"> <!--[if mso]> <table align="center" border="0" cellspacing="0" cellpadding="0"> <tr> <![endif]--> '; if(!empty($rede_social_1_sel)){ $mail->Body .= ' <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_1_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/facebook.png" alt="Facebook" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } if(!empty($rede_social_2_sel)){ $mail->Body .= ' <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_2_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/instagram.png" alt="Instagram" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } if(!empty($rede_social_3_sel)){ $mail->Body .= ' <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_3_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/linkedin.png" alt="Linkedin" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } if(!empty($rede_social_4_sel)){ $mail->Body .= ' <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_4_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/twitter.png" alt="Twitter" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } if(!empty($rede_social_5_sel)){ ' $mail->Body .= <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_5_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/google-plus.png" alt="Google Plus" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } if(!empty($rede_social_6_sel)){ $mail->Body .= ' <!--[if mso]> <td align="center" valign="top"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;"> <tbody> <tr> <td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;"> <a href="'.$rede_social_6_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/youtube.png" alt="Youtube" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a> </td> </tr> </tbody> </table> <!--[if mso]> </td> <![endif]--> '; } $mail->Body .= ' </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;"> <tbody class="mcnDividerBlockOuter"> <tr> <td class="mcnDividerBlockInner" style="min-width:100%; padding:18px;"> <table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%;border-top: 2px solid #FFFFFF;"> <tbody><tr> <td> <span></span> </td> </tr> </tbody></table> <!-- <td class="mcnDividerBlockInner" style="padding: 18px;"> <hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" /> --> </td> </tr> </tbody> </table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;"> <tbody class="mcnTextBlockOuter"> <tr> <td valign="top" class="mcnTextBlockInner" style="padding-top:9px;"> <!--[if mso]> <table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;"> <tr> <![endif]--> <!--[if mso]> <td valign="top" width="600" style="width:600px;"> <![endif]--> <table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer"> <tbody><tr> <td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px; text-align: center; color: #FFFFFF;"> <em> '; if(!empty($cep_sel)){ if(!empty($complemento_sel)){ $mail->Body .= ' '.$endereco_sel . " | " . $numero_sel . " | " . $complemento_sel . " | " . $bairro_sel . " | " . $cidade_sel . " | " . $estado_sel.' '; }else{ $mail->Body .= ' '.$endereco_sel . " | " . $numero_sel . " | " . $bairro_sel . " | " . $cidade_sel . " | " . $estado_sel.' '; } } $mail->Body .= ' <br /> '; $sql_tel_emp = mysqli_query($config, "SELECT telefone FROM tb_email_home_telefone WHERE id_item = '1'") or die(mysqli_error($config)); if(@mysqli_num_rows($sql_tel_emp) <= '0'){ echo ""; }else{ $y_info = 1; $allRows_info = mysqli_num_rows($sql_tel_emp); while($r_sql_tel_emp = mysqli_fetch_array($sql_tel_emp)){ if($allRows_info == 1){ $mail->Body .= ' '.$telefone_email_home_sel = $r_sql_tel_emp[0].' '; }else{ if ($allRows_info == $y_info) { $x_info = 1; } else { $x_info = 2; } $y_info++; if ($y_info == 2) { $mail->Body .= ' '.$telefone_email_home_sel = $r_sql_tel_emp[0] . " | ".' '; }else{ $mail->Body .= ' '.$telefone_email_home_sel = $r_sql_tel_emp[0].' '; } } } } $mail->Body .= ' </em> </td> </tr> </tbody></table> <!--[if mso]> </td> <![endif]--> <!--[if mso]> </tr> </table> <![endif]--> </td> </tr> </tbody> </table></td> </tr> </table> <!--[if gte mso 9]> </td> </tr> </table> <![endif]--> </td> </tr> </table> <!-- // END TEMPLATE --> </td> </tr> </table> </center> </body> </html> '; //return $resultado; } echo corpo_email(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); ?>  
    • Por LauraGomes
      oi!
      Preciso fazer este calendário JavaScript pegar informações provenientes do banco de dados e destacar a data em que um evento acontecerá. sei que isso pode ser feito com ajuda do PHP, mas não tenho idéia de como fazer isso. Alguém pode me ajudar a fazer?
      <div class="calendar-wrapper"> <button id="btnPrev" type="button"> Anterior </button> <button id="btnNext" type="button"> Próximo </button> <div id="divCal"></div> </div> <script type="text/javascript"> var Cal = function(divId) { //guuardando o div id this.divId = divId; // Dias da semana, começando em Domingo this.DaysOfWeek = [ 'Dom', 'Seg', 'Ter', 'Qua', 'Qui', '---', 'Sab' ]; // Meses, começando em Janeiro this.Months = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro' ]; // Seleciona o mês e ano atual var d = new Date(); this.currMonth = d.getMonth(); this.currYear = d.getFullYear(); this.currDay = d.getDate(); }; // Vai para o próximo mês Cal.prototype.nextMonth = function() { if ( this.currMonth == 11 ) { this.currMonth = 0; this.currYear = this.currYear + 1; } else { this.currMonth = this.currMonth + 1; } this.showcurr(); }; // Vai para o mês anterior Cal.prototype.previousMonth = function() { if ( this.currMonth == 0 ) { this.currMonth = 11; this.currYear = this.currYear - 1; } else { this.currMonth = this.currMonth - 1; } this.showcurr(); }; // Mostra o mês atual Cal.prototype.showcurr = function() { this.showMonth(this.currYear, this.currMonth); }; // Mostra o mês (ano, mês) Cal.prototype.showMonth = function(y, m) { var d = new Date() // Primeiro dia da semana no mês selecionado , firstDayOfMonth = new Date(y, m, 1).getDay() // Ultimo dia do mês selecionado , lastDateOfMonth = new Date(y, m+1, 0).getDate() // Ultimo dia do mês anterior , lastDayOfLastMonth = m == 0 ? new Date(y-1, 11, 0).getDate() : new Date(y, m, 0).getDate(); var html = '<table>'; // Mostra o mês e o ano selecionados html += '<thead><tr>'; html += '<td colspan="7">' + this.Months[m] + ' ' + y + '</td>'; html += '</tr></thead>'; // "Header" dos dias da semana html += '<tr class="days">'; for(var i=0; i < this.DaysOfWeek.length;i++) { html += '<td>' + this.DaysOfWeek[i] + '</td>'; } html += '</tr>'; //Mostra os dias var i=1; do { var dow = new Date(y, m, i).getDay(); // Se for Domingo, começa nova linha if ( dow == 0 ) { html += '<tr>'; } // Se não for domingo o primeiro dia do mês // Vai aparecer os ultimos dias do mês anterior else if ( i == 1 ) { html += '<tr>'; var k = lastDayOfLastMonth - firstDayOfMonth+1; for(var j=0; j < firstDayOfMonth; j++) { html += '<td class="not-current">' + k + '</td>'; k++; } } // Mostra o dia atual no loop var chk = new Date(); var chkY = chk.getFullYear(); var chkM = chk.getMonth(); if (chkY == this.currYear && chkM == this.currMonth && i == this.currDay) { html += '<td class="today">' + i + '</td>'; } else { html += '<td class="normal">' + i + '</td>'; } // Se for sábado, a linha acaba //dow = days of week if ( dow == 6 ) { html += '</tr>'; } // Se não for sábado o ultimo dia do mês selecionado // vai aparecer os próximos dias a partir do próximo mês else if ( i == lastDateOfMonth ) { var k=1; for(dow; dow < 6; dow++) { html += '<td class="not-current">' + k + '</td>'; k++; } } i++; }while(i <= lastDateOfMonth); // fecha a tabela html += '</table>'; // Escreve em html para a div document.getElementById(this.divId).innerHTML = html; }; // Quando a pagina carregar window.onload = function() { // começa o calendario var c = new Cal("divCal"); c.showcurr(); // Ativa o click dos botões próximo e anterior getId('btnNext').onclick = function() { c.nextMonth(); }; getId('btnPrev').onclick = function() { c.previousMonth(); }; } // Get element by id function getId(id) { return document.getElementById(id); } </script>  
    • Por Bruno Leiva
      Então gente, sou meio novo em php e estou tentando fazer um sistema que apareça as empresas que foram mais curtidas, para isso preciso fazer a contagem da tabela "favorita_empresa" e ver quantas curtidas cada empresa tem, e depois de td dar um select nessas empresas, porém nao tenho a menor ideia de como posso fazer isso, alguem pode me ajudar?
    • Por newtatataia
      Fatal error: Uncaught Error: Call to undefined function validaLogin() in C:\xampp\htdocs\tcaCrud2b\view\coordenacao\eventos.php:4 Stack trace: #0 C:\xampp\htdocs\tcaCrud2b\tpl-coordenacao.php(50): include() #1 {main} thrown in C:\xampp\htdocs\tcaCrud2b\view\coordenacao\eventos.php on line 4
       
      Eu logo normalmente, mas, quando chego na parte dever os eventos cadastrados, ocorre esse erro fatal. Alguém poderia me ajudar?
       
      (Caso alguém queira fazer download do projeto para ter uma melhor visão, estarei deixando o link juntamente com o arquivo de banco de dados:
       
      https://drive.google.com/drive/folders/1NYw7ss7G9YJl9bXDEHfsH61vvbtEHmSC )
       
       
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.