Ir para conteúdo
Fórum Script Brasil

Renato Penna

Membros
  • Total de itens

    854
  • Registro em

  • Última visita

Tudo que Renato Penna postou

  1. Testa este código: <html> <head> <title></title> <?php if(isset($_SERVER["REQUEST_METHOD"]) && $_SERVER["REQUEST_METHOD"]=="POST") { $textarea = $_POST["textarea"]; $textarea = str_replace("\n","<br />",$textarea); echo "<P>".$textarea."</P>"; } ?> </head> <body> <form action="textarea.php" method="post"> <textarea name="textarea"></textarea><br /> <input type="submit"> </form> </body> </html>
  2. Renato Penna

    Salvar_edicao.php

    O que acontece quando você roda esse script ? O que aparece na tela ?
  3. Dá uma olhada: consulta de vôos
  4. Coloque session_start(); logo antes de include "conexao_login.php". sesson_start(); precisa ser a primeira linha de código php em uma página que chame sessões, mesmo que elas estejam sob uma determinada condição (dentro de um if/else)
  5. Faz isso e veja se retorna algum e-mail: echo"<P>".print_r($this->to)."</P>"; echo"<P>".print_r($this->cc)."</P>"; echo"<P>".print_r($this->bcc)."</P>";
  6. Posta seu código por favor. Provavelmente é um loop enorme ou uma query muito pesada.
  7. Achei a solução, obrigado! $pos = strpos($documento,'.'); $tam = strlen($documento); $qtd_caracteres_extensao = $tam-$pos; $extensao_arquivo = substr($documento,($pos+1),$qtd_caracteres_extensao); if($extensao_arquivo=="doc") { $conteudo = shell_exec("catdoc $arq"); } elseif($extensao_arquivo=="pdf") { $conteudo = shell_exec('pdftotext $arq -'); }
  8. Bom dia povo! Estou tentando ler arquivos .doc e .pdf no Linux, mas não consigo. Estou tentando usar o comando $conteudo = shell_exec("catdoc $arq"); mas retorna vazio (como se o arquivo não tivesse nada escrito). Quando eu uso a forma padrão ($fp = fopen($arq,"r"); $conteudo = fread($fp,filesize($arq));) ele retorna um monte de lixo: &(%[+bjbj.+Y[[[[[[$Z%%%Y%Y%%%J%E%%% %%:Teste para leitura de arquivo word com php*+hAhx+,1h. A!#$%f666666666vvvvvvvvv6666666666666666666666666666666666666666666666666666666hH6666666666666666666666666666666666666666666666666666666666666666662 @Pp2( @Pp @Pp @Pp @Pp @Pp @Pp8XVOJQJ_HmHnHsHtHJJNormaldCJ_HaJmHsHtHA Fonte parg. padroTiTTabela normal4l4a,k ,Sem listaPK![Content_Types].xmljEr(Iw},-j4wP-t#b{UTUhd})*1PW)T9l#$yi};@(Hu*Dz/$X3aZ,Dj3bi3?/[G!-Rk.s..a?PK!6_rels/.relsj}Q%v/C/}(hO= C?hv=%[xp{_P1HORBdJE4b$q_6LR7O,En7Lib/SePK!kytheme/theme/themeManager.xmlM @}w7c(EbCA7KY,e.,H,lxIsQ}# +!,$j=GW)E+&8PK!.atheme/theme/theme1.xmlYMoE#F{omvGuhF[xw;jf7q7J(/z4IA!35.=D4;IOH]YxME$&TVIS1V(Z Ym_&JplG@nN&z@Fj$K_PA!&g=!nmreDLC[OF{KFY7qoku)lVgd.[/_v[LXrd8xR{(b4[@2lz &QLb(fXYJ&x,(R7vKZ Ia:?xpxGIXzg=2PCsu=o.G4& h9QLI(q}938ztzHSE+$_b9rQkZViV2n*=8OSyZ:ppH_/P%#:viNEcfYdEBUVWTXEUJg/RAC8D*-Um6]Ptuyz*&Qh*6w+D?CprloSnpJoBc3chTYok#=pGn=wOikZoiBszLPjui&eEEMl8;64HpU)LO3e:(xf)HyrB(-4gfpZa2khN-aT3V4ov/]f$pp@icAs@THNZIZ[}iRYqy$JyH9,AZjyi)D]n%lXlE6ljWYDK/eby_L&WVcJT14fS!:UJA?y6Xg1K#[]y%[bTRlwvSL)4.XtzxCJ#Lw@,e_}aN}jHPT$dfl,YdTI]Zd+zoPnIhYC=!kkl1Qn6MB]-_f MR+Wh1,QH*:[A@V_.ap64+lt7stG5;Mb8s9xjI11qM2%M2K94uo%PK!theme/theme/_rels/themeManager.xml.relsMwoo&56?$Q,.aic21h:qm@RN;do7gK(M&$R(.1rJT8VAHu}$b{P8g/]QAs(#L[PK-![Content_Types].xmlPK-!6+_rels/.relsPK-!kytheme/theme/themeManager.xmlPK-!.atheme/theme/theme1.xmlPK-!theme/theme/_rels/themeManager.xml.relsPK]?xml version=1. encoding=UTF-8 standalone=yes?a:clrMap xmlns:a=http://schemas.openxmlformats.org/drawingml/26/main bg1=lt1 tx1=dk1 bg2=lt2 tx2=dk2 accent1=accent1 accent2=accent2 accent3=accent3 accent4=accent4 accent5=accent5 accent6=accent6 hlink=hlink folHlink=folHlink/+++8@(BS?*-*-*-xA+-@** **+@UnknownG* Times New Roman5Symbol3.* Arial7.{ @CalibriACambria Mathqzz%%!r**2HP$Px2!xxrenato.pennarenato.pennaOh+8DPdltrenato.pennaNormal.dotmrenato.penna2Microsoft Office Word@F#@xJ@xJ%.+,hpediouro*Ttulo !#$Root EntryFpJ)1TableWordDocumentSummaryInformation(DocumentSummaryInformation8CompObj}F+Documento do Microsoft Office Word 97-23MSWordDocWord.Document.89q Alguém sabe como ler arquivos .doc e .pdf no Linux com PHP corretamente ? Desde já agradeço, Renato.
  9. Quando você se loga, na página que verifica se usuário e senha estão corretos, você coloca que em caso de estar tudo certo você põe: $str_sql="SELECT id FROM usuarios WHERE login = '".$_POST["login"]."' AND password = '".$_POST["password"]."'"; $sql = mysql_query($str_sql) or die(mysql_error()); $id = mysql_result($sql,0,"id"); header("Location: Perfil.php?id=".$id);
  10. O ideal seria você ter uma tabela chamada equipamentos no banco e montar esse <select> dando um SELECT no banco. Depois você preenche as tags <option> colocando o value com o valor do id de cada equipamento que você pegaria do banco. E por último, você exibiria os dados do equipamento escolhido fazendo SELECT * FROM equipamentos WHERE id_equipamento = $_POST["cd_tipo"];
  11. $sql = mysql_query(SELECT datasalao FROM salao WHERE cpfsalao = '".$cpf."'"); $linhas = mysql_num_rows($sql); $datasalao = array(); for($i=0;$i<$linhas;$i++) { $datasalao[$i] = mysql_result($sql,$i,"datasalao"); $datasalao[$i] = substr($datasalao[$i],0,4).substr($datasalao[$i],5,2).substr($datasalao[$i],8,2); } $datasalao = sort($datasalao); echo $datasalao[2]."<br />"; echo $datasalao[1];
  12. $dprojeto = array(); $i=0; foreach($_POST["dprojeto"] as $vet) { $dprojeto[$i] = $vet; $i++; } $dprojeto = sort($dprojeto); $id =$_GET["id"]; $sql = "SELECT * FROM os_des WHERE id={$id}"; $retorno= mysql_query($sql);// ler o retorno do banco de dados $linha = mysql_fetch_array($retorno); // ler o retorno do banco $linha = sort($linha); for($i=0;$i<count($dprojeto);$i++) { if($dprojeto[$i]==$linha[$i]) { echo $dprojeto[$i].'='.$linha[$i]; } }
  13. No código, após o form ser enviado. Como o seu banco é o POSTGREE, seria... $v_cpf = pg_num_rows(pg_query("SELECT cpf from cpf where cpf = '$cpf'")); if ($v_cpf == 0){ pg_query("INSERT INTO..."); }else{ print("CPF j&aacute; cadastrado!"); }
  14. Ai você tem que dar um SELECT no banco e ver se já existe cadastrado o tal CPF quando ele enviar o formulário. Se existir dá um erro na tela e não cadastra. E se não existir, dá o INSERT no banco.
  15. Renato Penna

    Entre duas datas...

    $fatdate = strtotime("2012-04-15");//data da fatura if((substr($fatdate,5,2)==substr($mindate,5,2)) && (substr($fatdate,5,2)==substr($maxdate,5,2))) { print("A data da fatura está no intervalo correspondente!"); } else { print("A data da fatura não está no intervalo correspondente!"); }
  16. Renato Penna

    Call Stack

    antes de $autor1 = $busca['autor1']; coloque print_r($busca); exit; e veja quais valores vão retornar.
  17. Renato Penna

    !empyt() não funciona

    E continua não funcionando ?
  18. header("Location:cliente_show.php?codigo=".$cliente_id); cliente_show.php <?php $cliente_id = $_GET["codigo"]; $concli = pg_query("select codigo,nome from cliente where codigo = $client_id") or die ("Não achei nada!"); ...
  19. Pode me dizer quais valores você passou por parâmetro na função calculaFrete pra poder testar ?
  20. Renato Penna

    Sessao e variaveis

    Tenta isso: index.php <?php session_start(); $_SESSION["id"] = session_id(); header("Location:sessao.php"); ?>< sessao.php <?php //initialize the session if (!isset($_SESSION)) { session_start(); } echo $_SESSION["id"]; ?>
  21. Tenta isso: <?php $entra["dia"] = date("d"); $entra["mes"] = date("m"); $entra["ano"]= date("Y"); $dia = $entra["dia"]; $mes = $entra["mes"]; $ano = $entra["ano"]; $dias = 120; $entra["data_vencimento"] = mktime(+$dias, 0, 0, $mes, $dia, $ano); $datavencimento = date('d/m/Y',$entra["data_vencimento"]); echo $datavencimento; ?> OBS: $dias = 120 porque a data do vencimento são 5 dias após a data atual. 5 x 24 = 120. Poderia fazer assim também: <?php $entra["dia"] = date("d"); $entra["mes"] = date("m"); $entra["ano"]= date("Y"); $dia = $entra["dia"]+5; $mes = $entra["mes"]; $ano = $entra["ano"]; $entra["data_vencimento"] = mktime(0, 0, 0, $mes, $dia, $ano); $datavencimento = date('d/m/Y',$entra["data_vencimento"]); echo $datavencimento; ?>
  22. Qual o valor está sendo passado na variável $dias ?
  23. Não posso porque estou usando integração com o webservice do Magento também e se eu usar o nuSoap ele pára de funcionar. Eu coloquei essas duas linhas no webservice.php e deu a mesma coisa. Ficou rodando e depois parou e não apareceu nada na tela. O webservice.php ficou assim: <?php set_time_limit(0); error_reporting(E_ALL|E_STRICT); include("loja.php"); include("sog.php"); $loja = new Loja(); $sog = new Sog(); $dados_loja = $loja->pegarDados(); $sog->setUsername("josemando@singulardigital.com.br"); $sog->setPassword("josemando123"); $sog->setCustomerType("1"); $sog->setCustomerIdentifier("09900243773"); $sog->setCustomerExtraIdentifier("123456"); $sog->setCustomerName("Teste"); $sog->setEmail("teste@teste.com.br"); $sog->setCustomerBillingAddress("Rua teste número 368"); $sog->setCustomerShippingAddress("Rua teste número 368"); var_dump($sog->enviarDados($dados_loja)); ?>
  24. Boa tarde a todos. Eu estou tentando fazer um webservice com WSDL. Porém eu nunca fiz isso e não está funcionando. Alguém pode me ajudar ? Eu fiz estes arquivos: Loja.php <?php class Loja { private $proxy; private $sessionId; private $atributeSets; private $set; private $caracteristicas; function getProxy() { return $this->proxy; } function setProxy($value) { $this->proxy = $value; } function getSessionId() { return $this->sessionId; } function setSessionId($value) { $this->sessionId = $value; } function getAtributeSets() { return $this->atributeSets; } function setAtributeSets($value) { $this->atributeSets = $value; } function getSet() { return $this->set; } function setSet($value) { $this->set = $value; } function getCaracteristicas() { return $this->caracteristicas; } function setCaracteristicas($value) { $this->caracteristicas = $value; } function pegarDados() { $proxy = new SoapClient('http://manutencao.workcopy.lojasingular.com.br/api/soap/?wsdl'); //$this->setProxy(new SoapClient('http://manutencao.workcopy.lojasingular.com.br/api/soap/?wsdl')); $sessionId = $proxy->login('jefersonsilva', '123456'); //$this->setSessionId($this->getProxy()->login('jefersonsilva', '123456')); $atributeSets = $proxy->call($sessionId, 'product_attribute_set.list'); //$this->setAtributeSets($this->getProxy()->call($sessionId, 'product_attribute_set.list')); $set = current($atributeSets); //$this->setSet(current($this->getAtributeSets())); $caracteristicas = $proxy->call($sessionId, 'sales_order.list', array(array('state'=>array('eq'=>'processing')))); //$this->setCaracteristicas($this->getProxy()->call($sessionId, 'sales_order.list', array(array('state'=>array('eq'=>'processing'))))); for($i=0;$i<count($caracteristicas);$i++) { $dados_loja = $proxy->call($sessionId, 'sales_order.info',$caracteristicas[$i]["increment_id"]); } return $dados_loja; /* $vet_caracteristicas = $this->getCaracteristicas(); for($i=0;$i<count($this->getCaracteristicas());$i++) { $dados_loja = $this->getProxy()->call($sessionId, 'sales_order.info',$vet_caracteristicas[$i]["increment_id"]); } return $vet_caracteristicas; */ } } ?> Sog.php <?php class Sog { private $username; private $password; private $customerType; private $customerIdentifier; private $customerExtraIdentifier; private $customerName; private $customerEmail; private $customerBillingAddress; private $customerShippingAddress; private $sogob; function getUsername() { return $this->username; } function setUsername($value) { $this->username = $value; } function getPassword() { return $this->password; } function setPassword($value) { $this->password = $value; } function getCustomerType() { return $this->customertype; } function setCustomerType($value) { $this->customerType = $value; } function getCustomerIdentifier() { return $this->customeridentifier; } function setCustomerIdentifier($value) { $this->customerIdentifier = $value; } function getCustomerExtraIdentifier() { return $this->customerExtraIdentifier; } function setCustomerExtraIdentifier($value) { $this->customerExtraIdentifier = $value; } function getCustomerName() { return $this->customerName; } function setCustomerName($value) { $this->customerName = $value; } function getEmail() { return $this->customerEmail; } function setEmail($value) { $this->customerEmail = $value; } function getCustomerBillingAddress() { return $this->customerBillingAddress; } function setCustomerBillingAddress($value) { $this->customerBillingAddress = $value; } function getCustomerShippingAddress() { return $this->customerShippingAddress; } function setCustomerShippingAddress($value) { $this->customerShippingAddress = $value; } function enviarDados($dl) { $this->sogob = new SoapClient("http://lajedo.singulardigital.com.br:6060/sog/services/orderWS?wsdl"); $sessionId = $this->sogob->login($this->getUsername(), $this->getPassword()); $lines = NULL; foreach($dl as $item) { $lines[] = Array( "isbn" => $item["sku"], "quantity" => $item["qty_ordered"], "price" => $item["price"] ); } $params = Array( "username" => $this->getUsername(), "password" => $this->getPassword(), "customerType" => $this->getCustomerType(), "customerIdentifier" => $this->getCustomerIdentifier(), "customerExtraIdentifier" => $this->getCustomerExtraIdentifier(), "customerName" => $this->getCustomerName(), "customerEmail" => $this->getEmail(), "customerBillingAddress" => (Object) $this->getCustomerBillingAddress(), "customerShippingAddress" => (Object) $this->getCustomerBillingAddress(), "partnerOrderId" => $dl->sku, "shippingPrice" => $dl->shipping_amount, "lines" => $lines); /* $params = Array( "username" => $this->username, "password" => $this->password, "customerType" => $this->customerType, "customerIdentifier" => $this->customerIdentifier, "customerExtraIdentifier" => $this->customerExtraIdentifier, "customerName" => $this->customerName, "customerEmail" => $this->customerEmail, "customerBillingAddress" => (Object) $this->customerBillingAddress, "customerShippingAddress" => (Object) $this->customerBillingAddress, "partnerOrderId" => $dados->numeroDoPedido, "shippingPrice" => $dados->frete, "lines" => $lines ); */ $dados_envio = $this->sogob->catalogStoredOrder($params); return $dados_envio; } } ?> web_service.php <?php include("loja.php"); include("sog.php"); $loja = new Loja(); $sog = new Sog(); $dados_loja = $loja->pegarDados(); $sog->setUsername("aaaa"); $sog->setPassword("bbbb123456"); $sog->setCustomerType("1"); $sog->setCustomerIdentifier("09900243773"); $sog->setCustomerExtraIdentifier("123456"); $sog->setCustomerName("Teste"); $sog->setEmail("teste@teste.com.br"); $sog->setCustomerBillingAddress("Rua teste número 368"); $sog->setCustomerShippingAddress("Rua teste número 368"); var_dump($sog->enviarDados($dados_loja)); ?> Quando eu mando rodar o web_service.php, fica um tempão rodando e no fim não aparece nada na tela. Nem erro nem nada. O que está faltando ou errado ? Desde já agradeço.
  25. Tente assim: <? // Mensagens de Erro $msg[0] = "Conexão com o banco falhou!"; $msg[1] = "Não foi possível selecionar o banco de dados!"; // Fazendo a conexão com o servidor MySQL $conexao = mysql_connect("localhost","root","123") or die($msg[0]); mysql_select_db("larissa01",$conexao) or die($msg[1]); // Fazendo uma consulta SQL e retornando os resultados em uma tabela HTML $consulta = "SELECT nome FROM cidades ORDER BY nome"; $resultado = mysql_query($consulta,$conexao); $final=mysql_result($resultado,0,"nome"); Eu queria que a variavel $final, ficasse com o resultado da primeira linha do resultado da query, mais não consigo fazer isso. ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Highcharts Example</title> <!-- 1. Add these JavaScript inclusions in the head of your page --> &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> &lt;script type="text/javascript" src="../js/highcharts.js"></script> <!-- 1a) Optional: add a theme file --> <!-- &lt;script type="text/javascript" src="../js/themes/gray.js"></script> --> <!-- 1b) Optional: the exporting module --> &lt;script type="text/javascript" src="../js/modules/exporting.js"></script> <!-- 2. Add the JavaScript to initialize the chart on document ready --> <?php $teste= $final; ?> Aqui, quero que a variavel $teste receba o valor da variavel final. &lt;script type="text/javascript"> var chart; $(document).ready(function() { chart = new Highcharts.Chart({ chart: { renderTo: 'container', defaultSeriesType: 'line', marginRight: 130, marginBottom: 25 }, title: { text: 'Monthly Average Temperature', x: -20 //center }, subtitle: { text: 'Source: WorldClimate.com', x: -20 }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (°C)' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +'°C'; } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0 }, series: [{ name: <?php echo $teste; ?>, Aqui queria que name recebesse o valor da varial $teste, que conteria o valor da primeira linha da query. data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }, { name: 'New York', data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5] }, { name: 'Berlin', data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0] }, { name: 'London', data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8] }] }); }); </script> </head> <body> <!-- 3. Add the container --> <div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div> </body> </html>
×
×
  • Criar Novo...