Ir para conteúdo
Fórum Script Brasil

LapisziN

Membros
  • Total de itens

    8
  • Registro em

  • Última visita

Sobre LapisziN

  • Data de Nascimento 15/04/1985

Perfil

  • Gender
    Male
  • Location
    Na frente do PC

LapisziN's Achievements

0

Reputação

  1. Boa tarde pessoal! Eu tenho um código que arrumei na internet, dei uma mexida nele conforme a minha necessidade, porém eu não sei como colocar borda nestes textos que posso inserir .. O código puxa uma imagem que eu posso escrever 4 linhas de texto nela, posso escolher uma fonte, o tamanho dela e sua cor, porém não sei como fazer uma borda neste texto.. Gostaria muito de pedir a ajuda de vocês! Segue o código: <?php // Set the enviroment variable for GD, useful for preventing GD related errors read Item 4 below. putenv('GDFONTPATH=' . realpath('.')); //Credits: //Original code by Terri Ann "Writing text to Images with PHP found here: http://blog.ninedays.org/2007/11/29/writing-text-to-images-with-php/ //Version 1- Improvement by Codex-m at PHP developer.org to: //1.) Write more than one text from the user to be parsed to the PHP by two GET statements //2.) Allows merging of additional image with the ID picture template which is the persons' ID picture //3.) Assign new variables for the new text and images to be added. //4.) Added important line: // putenv('GDFONTPATH=' . realpath('.')); // This will prevent "Warning: Could not find/open font problem resulting to Error: The server could not create this image." // Check if the variables are not empty or else return an error. // if((empty($_GET['linha01'])) &&(empty($_GET['linha02']))) fatal_error('Error: No text specified.'); //Parse inputs using two GET statements and assigned to a PHP variable. //Use HTML_Entity_decode to convert all HTML entities to its applicable characters. //Use PHP trim command to remove spaces at the beginning and the end of the inputs. $linha01 = trim(html_entity_decode($_GET['linha01'])); $linha02 = trim(html_entity_decode($_GET['linha02'])); $linha03 = trim(html_entity_decode($_GET['linha03'])); $linha04 = trim(html_entity_decode($_GET['linha04'])); //Validate if name is a string and Id number is numeric. // if((!is_string($linha01))&&(!(is_numeric($linha02)))&&(!(is_numeric($linha03)))) fatal_error('Error: Text not properly formatted.'); //CUSTOMIZABLE: Declare and define the font file, font size, colors, iamge file name and template name $font_file = 'impact.ttf'; $font_size = 45; // font size in pts $font_color = '#FFFFFF'; $image_file = 'bart0001.png'; $stroke_color = imagecolorallocate($img, 255, 0, 0); //CUSTOMIZABLE: Define x-y coordinates for the Name Text to be write to idtemplate.png $x_finalpos1 = 550; $y_finalpos1 = 70; //CUSTOMIZABLE: Define x-y coordinates for the ID number text to be write to template.png //Note: Coordinates are dependent on the size of the image template. $x_finalpos2 = 550; $y_finalpos2 = 140; //CUSTOMIZABLE: Define x-y coordinates for the ID number text to be write to template.png //Note: Coordinates are dependent on the size of the image template. $x_finalpos3 = 550; $y_finalpos3 = 515; //CUSTOMIZABLE: Define x-y coordinates for the ID number text to be write to template.png //Note: Coordinates are dependent on the size of the image template. $x_finalpos4 = 550; $y_finalpos4 = 586; //Declare image file extensions in JPG format. $mime_type = 'image/png'; $extension = '.png'; //Check for server GD support if(!function_exists('ImageCreate')) fatal_error('Error: Server does not support PHP image generation'); //Check font file availability if(!is_readable($font_file)) { fatal_error('Error: The server is missing the specified font.'); } //Define font colors $font_rgb = hex_to_rgb($font_color); //Define the bounding box coordinates for name text using Truefonttype font file specified $box1 = @ImageTTFBBox($font_size,0,$font_file,$linha01); //Define the bounding box coordinates for ID number text using Truefonttype specified. $box2 = @ImageTTFBBox($font_size,0,$font_file,$linha02); //Define the bounding box coordinates for name text using Truefonttype font file specified $box3 = @ImageTTFBBox($font_size,0,$font_file,$linha03); //Define the bounding box coordinates for name text using Truefonttype font file specified $box4 = @ImageTTFBBox($font_size,0,$font_file,$linha04); //Define name width and height $name_width1 = abs($box1[2]-$box1[0]); $name_height1 = abs($box1[5]-$box1[3]); //Define ID number width and height $name_width2 = abs($box2[2]-$box2[0]); $name_height2 = abs($box2[5]-$box2[3]); //Define ID number width and height $name_width3 = abs($box3[2]-$box3[0]); $name_height3 = abs($box3[5]-$box3[3]); //Define ID number width and height $name_width4 = abs($box4[2]-$box4[0]); $name_height4 = abs($box4[5]-$box4[3]); //Create image from ID template PNG and assign to $image variable $image = imagecreatefrompng($image_file); //Create image from persons ID picture PNG and assign it to $personid variable $personid = imagecreatefrompng($image_file1); //CUSTOMIZABLE: Merge the ID picture of the person to the ID template in a specific coordinates. //You can read about imagecopymerge function manual here: http://php.net/manual/en/function.imagecopymerge.php imagecopymerge($image, $personid, $stroke_color, 717, 259, 0, 0, 253, 300, 100); //Check if the server cannot create the image and displays error. if(!$image || !$box1 || !$box2 || !$box3 || !$box4) { fatal_error('Error: The server could not create this image.'); } //Allocate color of the image and then measure the image width $font_color = ImageColorAllocate($image,$font_rgb['red'],$font_rgb['green'],$font_rgb['blue']); $image_width = imagesx($image); //Finalize the position of the name text on the generated image. $put_text_x1 = ($image_width /2) - ($name_width1/2); $put_text_y1 = $y_finalpos1; //Finalize the position of the name text on the generated image. $put_text_x2 = ($image_width /2) - ($name_width2/2); $put_text_y2 = $y_finalpos2; //Finalize the position of the name text on the generated image. $put_text_x3 = ($image_width /2) - ($name_width3/2); $put_text_y3 = $y_finalpos3; //Finalize the position of the name text on the generated image. $put_text_x4 = ($image_width /2) - ($name_width4/2); $put_text_y4 = $y_finalpos4; // Write the NAME text to the image imagettftext($image, $font_size, 0, $put_text_x1, $put_text_y1, $font_color, $font_file, $linha01); //Write the ID NUMBER text to the image imagettftext($image, $font_size, 0, $put_text_x2, $put_text_y2, $font_color, $font_file, $linha02); //Write the ID NUMBER text to the image imagettftext($image, $font_size, 0, $put_text_x3, $put_text_y3, $font_color, $font_file, $linha03); //Write the ID NUMBER text to the image imagettftext($image, $font_size, 0, $put_text_x4, $put_text_y4, $font_color, $font_file, $linha04); //Declare header content type in PNG header('Content-type: ' . $mime_type); //Output the generated PNG image with the text to the browser imagepng($image); //Destroy image to prevent memory leak and then exit. ImageDestroy($image); exit; /* The FATAL error function will attempt to create an image containing the error message given. if this works, the image is sent to the browser. if not, an error is logged, and passed back to the browser as a 500 code instead. */ function fatal_error($message) { // send an image if(function_exists('ImageCreate')) { $width = ImageFontWidth(5) * strlen($message) + 10; $height = ImageFontHeight(5) + 10; if($image = ImageCreate($width,$height)) { $background = ImageColorAllocate($image,255,255,255); $text_color = ImageColorAllocate($image,0,0,0); ImageString($image,5,5,5,$message,$text_color); header('Content-type: image/png'); imagePNG($image); ImageDestroy($image); exit; } } // send 500 code header("HTTP/1.0 500 Internal Server Error"); print($message); exit; } /* Decode an HTML hex-code into an array of R,G, and B values. accepts these formats: (case insensitive) #ffffff, ffffff, #fff, fff */ function hex_to_rgb($hex) { // remove '#' if(substr($hex,0,1) == '#') $hex = substr($hex,1); // expand short form ('fff') color to long form ('ffffff') if(strlen($hex) == 3) { $hex = substr($hex,0,1) . substr($hex,0,1) . substr($hex,1,1) . substr($hex,1,1) . substr($hex,2,1) . substr($hex,2,1); } if(strlen($hex) != 6) fatal_error('Error: Invalid color "'.$hex.'"'); // convert from hexidecimal number systems $rgb['red'] = hexdec(substr($hex,0,2)); $rgb['green'] = hexdec(substr($hex,2,2)); $rgb['blue'] = hexdec(substr($hex,4,2)); return $rgb; } ?> Desde já agradeço!!
  2. LapisziN

    Checkbox em Formulário

    Opa! Boa tarde! Segue o código: (html) <form name="formulario" method="post" action="enviar_dados_form_orc_v_s_.php"> <table width="880" align="center" border="0" cellpadding="0" cellspacing="0" id="sistemas-formatacao"> <tr> <td> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="As 10 Mais"> As 10+ <span id="explica_form">(Sistema para Rádios Online) </span> </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Links para Midias Sociais"> Links para Mídias Sociais / Sites de Relacionamentos </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Agenda de Eventos"> Agenda de Eventos </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Links uteis"> Links Úteis </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Banners Aleatórios"> Banners Aleatórios </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Locutor da Hora "> Locutor da Hora <span id="explica_form">(Sistema para Rádios Online)</span></div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Banners de Publicidade"> Banners de Publicidade / Propagandas </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Loja Virtual"> Loja Virtual</div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Banners Fixos"> Banners Fixos </div> <div class="tabela-sistemas"> <input type="checkbox" name="sistemas[]" value="Mural de Recados"> Mural de Recados</div> </td> </tr> </table> </form> (php) <? $hoje_tmp = getdate(); $hoje = ($hoje_tmp[hours].":".$hoje_tmp[minutes].":".$hoje_tmp[seconds]); $ip = $_SERVER['REMOTE_ADDR']; //pega o ip de quem enviou $sistemas = $_POST["sistemas"]; //trata a variável DIZ QUAIS SERÃO OS SISTEMAS USADOS NO SITE global $email; //transforma em variavel global a variável e-mail $enviou = mail("contato@servidor.com.br", // aqui voce coloca o seu e-mail "$assunto_mensagem", Sistemas utilizados no site: $sistemas Desde Já agradeço!
  3. Bom dia! Estou criando um formulário simples em PHP (peguei um pronto e adequei ao que eu preciso, pois não entendo de PHP), terminei o mesmo e fui fazer o teste. Ele chega normalmente ao meu e-mail, porém, somente os campos que possuem CHECKBOX não chegam todos.. chega somente 01 item marcado, enquanto eu marquei mais de 3 itens para fazer o teste.. Procurei na internet e vi que tem que colocar 2 colchetes "[]" após o nome do campo (name="teste[]") e mais uns códigos no começo.. mas nenhum dos sites que eu encontrei o código funcionou... alguém poderia me ajudar? :} Abraço para todos!
  4. Mas aquele que voce me deu é com banco de dados.. o formulário vai ser só enviado por e-mail mesmo... \=
  5. Show!!!! pegou direitinho.. agora tenho que jogar isso pra ajax... para não ter o botão e a pessoa ao passar para o proximo campo já aparecer ao lado automaticamente se o subdominio está disponível ou não =) alguém sabe como fazer com esse codigo abaixo? <?php function verificar_url($url) { //abrimos o ficheiro em leitura $id = @fopen($url,"r"); //fazemos as verificações if ($id) $aberto = true; else $aberto = false; //fechamos o ficheiro // fclose($id); bkp antigo e com erro unset($id); //retornamos o valor return $aberto; } ?> <html> <head> <title>Verificação de URL</title> </head> <body> <?php if (!isset($url)) { ?> <form action="linkl.php" method="post"> Indica a tua URL:<br> http://<input type="Text" size="25" maxlength="100" name="url" value="">.dsousa.com.br <br><br> <input type="Submit" value="Verificar!"> </form> <?php } else { $urll = $_POST['url']; $url = "http://".$urll.".dsousa.com.br"; $aberto = verificar_url($url); if ($aberto){ echo "O endereço está indisponível, por favor escolha outro!"; }else{ echo "O endereço está disponível!"; } } ?> </body> </html>
  6. O código é este: <?php function verificar_url($url) { //abrimos o ficheiro em leitura $id = @fopen($url,"r"); //fazemos as verificações if ($id) $aberto = true; else $aberto = false; //fechamos o ficheiro fclose($id); //retornamos o valor return $aberto; } ?> <html> <head> <title>Verificação de URL</title> </head> <body> <?php if (!isset($url)) { ?> <form action="linkl.php" method="post"> Indica a tua URL:<br> http://<input type="Text" size="25" maxlength="100" name="url" value="">.dsousa.com.br <br><br> <input type="Submit" value="Verificar!"> </form> <?php } else { $urll = $_POST['url']; $url = "http://".$urll.".dsousa.com.br"; $aberto = verificar_url($url); if ($aberto){ echo "O endereço já existe, por favor escolha outro!"; }else{ echo "Parabéns, o endereço está disponível!"; } } ?> </body> </html> e o erro é: Warning: fclose(): supplied argument is not a valid stream resource in /home/dsous632/public_html/teste/minisite/linkl.php on line 10 A URL não existe! No caso o "A URL não existe!" está certo.. mas o erro em cima não está.. A linha 10 é fclose($id); se quiser pode ver essa pagina online em [link]http://www.dsousa.com.br/teste/minisite/linkl.php[/link]
  7. Oi, obrigado pela resposta! Até me ajuda a fazer com ajax o qu eeu quero.. mas infelizmente o codigo que eu enviei tem um erro.. Quando eu digito um subdominio que já existe e aperto para ver, ele diz a resposta certa! " o endereço está indisponível!" .. Mas quando eu digito um subdominio que ainda não existe e aperto para ver, ele diz a resposta certa com um erro acima " o endereço está disponível!" e o diz que tem um erro na linha 10 do codigo que eu enviei acima na pergunta! Tem como me ajudar?
  8. Olá a todos! Sou iniciante em PHP mas estava precisando de um script que fizesse o seguinte... o usuário vai entrar no site MEUDOMINIO.COM.BR e vai fazer o cadastro. Ai na hora do cadastro terá os campos normais tipo: Nome: _____________ Cidade: ___________ Data de Nascimento: ______________ Subdominio desejado: http://________________________.MEUDOMINIO.COM.BR ([AJAX]) e nesse campo de escolher um subdominio, que eu precisaria que já desse a resposta em AJAX do lado de "MEUDOMINIO.COM.BR" para o usuário se o subdominio está disponível ou não para ele.. ai não estando ele já escolhe outro.. eu consegui esse script aqui na internet... mas acho que está com algum erro e não está com AJAX... Tem como alguém me ajudar? <?php function verificar_url($url) { //abrimos o ficheiro em leitura $id = @fopen($url,"r"); //fazemos as verificações if ($id) $aberto = true; else $aberto = false; //fechamos o ficheiro fclose($id); //retornamos o valor return $aberto; } ?> <html> <head> <title>Verificação de URL</title> </head> <body> <?php if (!isset($url)) { ?> <form action="linkl.php" method="post"> Indica a tua URL:<br> http://<input type="Text" size="25" maxlength="100" name="url" value="">.dsousa.com.br <br><br> <input type="Submit" value="Verificar!"> </form> <?php } else { $url = "http://".$url.".dsousa.com.br"; $abierto = verificar_url($url); if ($abierto) echo "A URL existe!"; else echo "A URL não existe ou é inacessível..."; } ?> </body> </html>
×
×
  • Criar Novo...