Arquivado
Este tópico foi arquivado e está fechado para novas respostas.
Validar e-mail com preg_match()
Por
Dr. Programador, em PHP
Recommended Posts
-
Conteúdo Similar
-
Por Omar~
Então, cá estou eu tentando fazer umas expressões regulares para validação de links para mídias sociais e me esbarrei em alguns problemas a averiguação da string:
A ideia é ter uma expressão para cada mídia social presente no atual momento, só aceitando uma url válida para aquela mídia.
Estou com um problema em passar condicionais que quando a string entrar num determinado formato ela deve seguir exatamente o modelo válido para aquela situação.
Separei cada condicional em uma linha para melhor entendimento:
<?php $urlA = "https://www.facebook.com/profile.php"; // ** ERA PARA SER INVÁLIDO $urlB = "https://www.facebook.com/profile.php?id="; // ERA PARA SER INVÁLIDO $urlC = "https://www.facebook.com/"; // ** ERA PARA SER INVÁLIDO $urlD = "https://www.facebook.com/Fulano"; // Válido, está OK $urlE = "https://www.facebook.com/profile.php?id=999999999999999"; // Válido, está OK $urlF = "https://www.facebook.com"; // ** ERA PARA SER INVÁLIDO $urlG = "https://www.faceboo"; // ** ERA PARA SER INVÁLIDO if (preg_match( '/^' . '(https[\:][\/][\/]www[\.]facebook[\.]com)' // Valida o endereço oficial da mídia . '?([\/])' // Caso contenha ou não uma "/" no final da url . '?([a-zA-Z À-ú 0-9]+)' // Valida se o link do perfil segue um modelo amigável (expl: /fulano) . '|(?:profile[\.]php[\?]id[\=]([0-9]{15}))' // Nessa condicional não estou acertando . '?(.*)' // Essa também não . '$/', $urlA)) { echo 'válido'; } else { echo 'inválido'; } Como podem notar são as duas últimas condicionais que estou com problemas, que são necessárias a correta averiguação das entradas na string, mas seu as adicionar assim como está no exemplo acima tudo desanda fazendo com que não der certo, uma vez removidas as urls que estão inválidas não são aceitas fazendo com que der certo, mas no entanto outras que são válidas passam a não ser aceitas.
Onde estou errando? Ao meu ver escrevi a expressão corretamente, mas na prática está errada.
Obs.: Por enquanto só escrevi essa para facebook farei para as demais depois que resolver esse empasse.
-
Por ppanetony
Olá...
Tem como numa expressão regular eu limitar a quantidade de vezes que aparece determinado caracter, estando ou nao na sequencia?!
Exemplo: no texto 0123456789 só poderá ter no máximo 3 caracteres /. em qualquer parte do texto. (012/345/6/789 ou 01/23/456/789 ou 0123/45/67/89, etc...)
obrigado.
-
Por Wesley Inacio
Olá, estou com um problema em meu novo projeto.
Baixei uma class para baixar um vídeo do YouTube, esta classe, gera 5 links para download em 5 qualidades diferentes (5 tags em mp4), porém, esta parte do preg_match, só trás os 5 primeiros links nas qualidades 22, 18, 59, 43 e 17, eu queria que ele trouxesse também a qualidade 140 (e entre outras) que são de áudio.
Este é o preg_match que está retornando até a 5º qualidade:
if(preg_match('@url_encoded_fmt_stream_map["\']:\s*["\']([^"\'\s]*)@', $html, $matches)){ ($html = Todo o html do vídeo na página do YouTube com o script que gera em todas qualidades)
($matches = Array abaixo, já retornando apenas com 5 tags de qualidade diferentes, eu queria mais tags)
Ele retorna:
array ( 0 => 'url_encoded_fmt_stream_map":"sp=signature\\u0026quality=hd720\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26requiressl%3Dyes%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26ipbits%3D0%26fvip%3D1%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ip%3D201.75.228.145%26mt%3D1525617522%26lmt%3D1524616680905595%26fexp%3D23724337%26sparams%3Ddur%252Cei%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ%26itag%3D22\\u0026itag=22\\u0026s=FCFC7FC76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD71A86411149424EF2EACD8D8\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D0.000%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fwebm%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524619514746879%26itag%3D43%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D22386160%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=43\\u0026s=BFBF9BF9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E77647A0F4354CEFBDCDCCD9C9C\\u0026type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524616369334936%26itag%3D18%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D18471872%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=18\\u0026s=8C8C78C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD734343\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.42001E%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613263245690%26itag%3D36%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D5695363%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=36\\u0026s=6F6F06F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA21C59A5C2894FFC8364B6B6\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613259315388%26itag%3D17%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D2025409%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=17\\u0026s=B2B2CB2C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E65F7F87B08866182488B1616\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22', 1 => 'sp=signature\\u0026quality=hd720\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26requiressl%3Dyes%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26ipbits%3D0%26fvip%3D1%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ip%3D201.75.228.145%26mt%3D1525617522%26lmt%3D1524616680905595%26fexp%3D23724337%26sparams%3Ddur%252Cei%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ%26itag%3D22\\u0026itag=22\\u0026s=FCFC7FC76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD71A86411149424EF2EACD8D8\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.64001F%2C+mp4a.40.2%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D0.000%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fwebm%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524619514746879%26itag%3D43%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D22386160%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=43\\u0026s=BFBF9BF9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E77647A0F4354CEFBDCDCCD9C9C\\u0026type=video%2Fwebm%3B+codecs%3D%22vp8.0%2C+vorbis%22,sp=signature\\u0026quality=medium\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.773%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26ratebypass%3Dyes%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252Fmp4%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524616369334936%26itag%3D18%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D18471872%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Cratebypass%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=18\\u0026s=8C8C78C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD734343\\u0026type=video%2Fmp4%3B+codecs%3D%22avc1.42001E%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613263245690%26itag%3D36%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D5695363%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=36\\u0026s=6F6F06F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA21C59A5C2894FFC8364B6B6\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22,sp=signature\\u0026quality=small\\u0026url=https%3A%2F%2Fr2---sn-oxunxg8pjvn-j29e7.googlevideo.com%2Fvideoplayback%3Fdur%3D206.796%26initcwndbps%3D396250%26pl%3D21%26source%3Dyoutube%26requiressl%3Dyes%26gir%3Dyes%26fvip%3D1%26expire%3D1525639262%26mime%3Dvideo%252F3gpp%26key%3Dyt6%26ipbits%3D0%26lmt%3D1524613259315388%26itag%3D17%26mt%3D1525617522%26mv%3Dm%26ms%3Dau%252Crdu%26mm%3D31%252C29%26mn%3Dsn-oxunxg8pjvn-j29e7%252Csn-bg0e7n7d%26c%3DWEB%26id%3Do-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U%26clen%3D2025409%26ip%3D201.75.228.145%26fexp%3D23724337%26sparams%3Dclen%252Cdur%252Cei%252Cgir%252Cid%252Cinitcwndbps%252Cip%252Cipbits%252Citag%252Clmt%252Cmime%252Cmm%252Cmn%252Cms%252Cmv%252Cpl%252Crequiressl%252Csource%252Cexpire%26ei%3D_hPvWtXeIImjxASa3JuICQ\\u0026itag=17\\u0026s=B2B2CB2C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E65F7F87B08866182488B1616\\u0026type=video%2F3gpp%3B+codecs%3D%22mp4v.20.3%2C+mp4a.40.2%22', ) E no final, tenho esses 5 links de 5 qualidades diferentes:
array ( 22 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.773&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&mv=m&ms=au%2Crdu&mm=31%2C29&requiressl=yes&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&ipbits=0&fvip=1&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&expire=1525639262&mime=video%2Fmp4&key=yt6&ip=201.75.228.145&mt=1525617522&lmt=1524616680905595&fexp=23724337&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&itag=22&signature=1C76378EDA89ED9ACACE3C44AF56F85461F4CCFE.3EDE46C81594E50AAD7FA86411149424EF2EACD8', 'format' => 'MP4 720p (HD)', ), 43 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=0.000&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2Fwebm&key=yt6&ipbits=0&lmt=1524619514746879&itag=43&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=22386160&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=4F9E5986A32FEC587D4202CAF7F9ACC1A35C649A.768A318A1C25AF5E776B7A0F4354CEFBDCDCCD9C', 'format' => 'WebM 360p', ), 18 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.773&initcwndbps=396250&pl=21&source=youtube&ratebypass=yes&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2Fmp4&key=yt6&ipbits=0&lmt=1524616369334936&itag=18&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=18471872&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=8C7C868E05694F249085D3D5614829716523CF06.5EEA20400B72CE2F36C82A7A10AEA3E8B9CD7343', 'format' => 'MP4 360p', ), 36 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.796&initcwndbps=396250&pl=21&source=youtube&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2F3gpp&key=yt6&ipbits=0&lmt=1524613263245690&itag=36&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=5695363&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=2F03E6ADDBD5A43643A1A903FBC0B3F71C279BDA.B5345278483D15920CA61C59A5C2894FFC8364B6', 'format' => 'Unknown', ), 17 => array ( 'url' => 'https://r2---sn-oxunxg8pjvn-j29e7.googlevideo.com/videoplayback?dur=206.796&initcwndbps=396250&pl=21&source=youtube&requiressl=yes&gir=yes&fvip=1&expire=1525639262&mime=video%2F3gpp&key=yt6&ipbits=0&lmt=1524613259315388&itag=17&mt=1525617522&mv=m&ms=au%2Crdu&mm=31%2C29&mn=sn-oxunxg8pjvn-j29e7%2Csn-bg0e7n7d&c=WEB&id=o-AO2gD_omAfnTRgBt8oov-k8NGdOFUEnIZrYdocruXg2U&clen=2025409&ip=201.75.228.145&fexp=23724337&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&ei=_hPvWtXeIImjxASa3JuICQ&signature=52C034C4C477DADF1FF7874DA53B4E05BADA326E.DC4FC56FFF52867A3E6BF7F87B08866182488B16', 'format' => '3GP 144p', ), ) Alguém poderia me ajudar? Obrigado.
-
Por Ze Fernando
Boa noite amigos
Escrevo desde Portugal para solicitar ajuda para um problema.
Eu aproveitei um template já feito, para fazer um site, mas depois de fazer as respetivas alterações ao formulário e testá-lo no browser aconteceu o seguinte:
Após enviar o formulário surgiu a mensagem de "ENVIADO", mas também apareceu outra mensagem no mesmo quadro que dizia o seguinte: Warning: preg_match(): Empty regular expression in /home/fojox102/public_html/contact.php on line 113
2. Em uma parte do código PHP estava !eregi ..... e a mensagem dava erro dizendo que "eregi" estava desatualizado e encontrei na NET alguém dizendo que se alterasse para preg_match o problem ficava resolvido, mas não ficou, no entanto eu mantive "preg_match".
Eu envio o código da página "contato.php". Também podem fazer o teste acedendo a http://fojo.x10host.com/contact.php.
Será que algum de vocês me pode ajudar a solucionar o problema?
Os meus agradecimentos
José Moreira
<!DOCTYPE HTML> <html> <head> <title>Fojo's Runners</title> <meta name="description" content="website description" /> <meta name="keywords" content="website keywords, website keywords" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="css/style.css" /> <!-- modernizr enables HTML5 elements and feature detects --> <script type="text/javascript" src="js/modernizr-1.5.min.js"></script> </head> <body> <div id="bg"> <img src="images/background.jpg" alt="home"> </div> <div id="main"> <header> <div id="logo"> <div id="logo_text"> <!-- class="logo_colour", allows you to change the colour of the text --> <h1><a href="index.html">FOJO'S <span class="logo_colour"> RUNNERS</span></a></h1> <h2>Amigos do Treino e doidos por Trail's.</h2> </div> </div> <nav> <div id="menu_container"> <ul class="sf-menu" id="nav"> <li><a href="index.html">Home</a></li> <li><a href="about.html">Quem somos</a></li> <li><a href="corridas.html">Corridas</a></li> <li><a href="#">Nutrição</a> <ul> <li><a href="amatinal.html">Antes treino matinal</a></li> <li><a href="dmatinal.html">Após treino matinal</a></li> <li><a href="atarde.html">Antes treino da tarde</a></li> <li><a href="dtarde.html">Após treino da tarde</a></li> <li><a href="outros.html">Outros dias</a></li> </ul> </li> <li><a href="roupa.html">Vestuário</a></li> <li><a href="#">Treinar</a> <ul> <li><a href="casa.html">Em casa</a></li> <li><a href="chuva.html">Com chuva</a></li> <li><a href="bomtempo.html">Bom tempo</a></li> <li><a href="frio.html">Frio ou geada</a></li> <li><a href="verao.html">Treinar no Verão</a></li> </ul> </li> <li><a href="contact.php">Contacto</a></li> </ul> </div> </nav> </header> <div id="site_content"> <div id="sidebar_container"> <div class="sidebar"> <h3>Latest News</h3> <h4>New Website Launched</h4> <h5>December 1st, 2013</h5> <p>2013 sees the redesign of our website. <a href="#">Read more</a></p> </div> <div class="sidebar"> <h3>Useful Links</h3> <ul> <li><a href="#">First Link</a></li> <li><a href="#">Another Link</a></li> <li><a href="#">And Another</a></li> <li><a href="#">Last One</a></li> </ul> </div> <div class="sidebar"> <h3>More Useful Links</h3> <ul> <li><a href="#">First Link</a></li> <li><a href="#">Another Link</a></li> <li><a href="#">And Another</a></li> <li><a href="#">Last One</a></li> </ul> </div> </div> <div class="content"> <h1>Formulário de contacto</h1> <p>Fala connosco utilizando este formulário.</p> <p>Aproveita para tirares dúvidas, apresentares as tuas ideias, enviares informação que consideres de interesse para os amantes do Trail Running ou simplesmente para propores uma corrida ou treino por aí.</p> <?php // Set-up these 3 parameters // 1. Enter the email address you would like the enquiry sent to // 2. Enter the subject of the email you will receive, when someone contacts you // 3. Enter the text that you would like the user to see once they submit the contact form $to = 'fojo.runners@gmail.com'; $subject = 'Mensagem de Fojo Runners'; $contact_submitted = 'A tua mensagem foi enviada com sucesso.'; // Do not amend anything below here, unless you know PHP function email_is_valid($email) { return preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',$email); } if (!email_is_valid($to)) { echo '<p style="color: red;">Deves configurar um endereço de e-mail válido para que possas enviar a mensagem.</p>'; } if (isset($_POST['contact_submitted'])) { $return = "\r"; $youremail = trim(htmlspecialchars($_POST['your_email'])); $yourname = stripslashes(strip_tags($_POST['your_name'])); $yourmessage = stripslashes(strip_tags($_POST['your_message'])); $contact_name = "Name: ".$yourname; $message_text = "Message: ".$yourmessage; $user_answer = trim(htmlspecialchars($_POST['user_answer'])); $answer = trim(htmlspecialchars($_POST['answer'])); $message = $contact_name . $return . $message_text; $headers = "From: ".$youremail; if (email_is_valid($youremail) && !preg_match("\r",$youremail) && !preg_match("\n",$youremail) && $yourname != "" && $yourmessage != "" && substr(md5($user_answer),5,10) === $answer) { mail($to,$subject,$message,$headers); $yourname = ''; $youremail = ''; $yourmessage = ''; echo '<p style="color: blue;">'.$contact_submitted.'</p>'; } else echo '<p style="color: red;">Por favor, digita o teu nome, um endereço de e-mail válido, a mensagem e a resposta a uma simples pergunta de matemática antes de enviares a mensagem..</p>'; } $number_1 = rand(1, 9); $number_2 = rand(1, 9); $answer = substr(md5($number_1+$number_2),5,10); ?> <form id="contact" action="contact.php" method="post"> <div class="form_settings"> <p><span>Name</span><input class="contact" type="text" name="your_name" value="<?php echo $yourname; ?>" /></p> <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="<?php echo $youremail; ?>" /></p> <p><span>Message</span><textarea class="contact textarea" rows="5" cols="50" name="your_message"><?php echo $yourmessage; ?></textarea></p> <p style="line-height: 1.7em;">To help prevent spam, please enter the answer to this question:</p> <p><span><?php echo $number_1; ?> + <?php echo $number_2; ?> = ?</span><input type="text" name="user_answer" /><input type="hidden" name="answer" value="<?php echo $answer; ?>" /></p> <p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="Enviar" /></p> </div> </form> </div> </div> <div id="scroll"> <a title="Scroll to the top" class="top" href="#"><img src="images/top.png" alt="top" /></a> </div> <footer> <p><a href="index.html">Home</a> | <a href="about.html">Quem somos</a> | <a href="corridas.html">Corridas</a> | <a href="vestuario.html">Vestuário</a> | <a href="contact.php">Contacto</a></p> <p>Copyright © fojo's runners 2018 | <a href="http://www.css3templates.co.uk">design from css3templates.co.uk</a></p> </footer> </div> <!-- javascript at the bottom for fast page loading --> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.easing-sooper.js"></script> <script type="text/javascript" src="js/jquery.sooperfish.js"></script> <script type="text/javascript"> $(document).ready(function() { $('ul.sf-menu').sooperfish(); $('.top').click(function() {$('html, body').animate({scrollTop:0}, 'fast'); return false;}); }); </script> </body> </html>
-
Por joaoooo
Olá.
Eu tenho o seguinte código:
{# css-modules="/catalogue/section" #} <section class="breadcrumb"> <ul class="breadcrumb-containner"> {% for item in breadcumb %} <li class="item"> <a href="{{ item['link'] }}">{{ item['name'] }} </a> </li> <li class="item separator"> > </li> {% endfor %} <li class="item"> <a href="{{ section.link }}">{{section.name}} </a> </li> </ul> </section>
E queria usar PHP para "buscar" o valor de "css-modules"
-