← Tutoriais

[PHP] Sig com IP

Lida 14012 vezes

Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Citação de: "=IceBurn="

Podes encontrar fontes TTF muito porreiras aqui
http://www.webpagepublicity.com/free-fonts.html

Eles tem imensas fontes e são grátis.


Existem sites com fontes muito melhores  :wink:
Offline

Bruno Mota 
Membro
Mensagens 1733 Gostos 3
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

para saber as cores em decimal e em hexadecimal uso um site mt porreiro
http://www.december.com/html/spec/colordec.html
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Eu quando persiso uso o google  :D
Offline

=IceBurn= 
Membro
Mensagens 897 Gostos 3
Feedback +3

Troféus totais: 32
Trófeus: (Ver todos)
Windows User Level 6 Linux User Mobile User Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5

Citação de: "mota77"
para saber as cores em decimal e em hexadecimal uso um site mt porreiro
http://www.december.com/html/spec/colordec.html


Esse não conhecia, tá fixe!

Para quem procura cores em valor HEX deixo aqui este:
http://hexcolors.simplysike.com/~hexcolors/colors_show.cfm?file=0001
Tá demais!! :lol:
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

LOOL
Isso tem cores a mais  :lol:
Offline

tbk22 
Membro
Mensagens 1268 Gostos 0
Troféus totais: 29
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2

Mas a minha duvida em relação as cores era a seguinte!

Tinha aqui um codigo do kingless para uma sig com informações e a uma parte assim:

Citar
ImageString($im, 2, 18, 18, "Seu IP: $ip", $branco);
ImageString($im, 2, 18, 35, "Seu ISP: $isp1", $branco);
ImageString($im, 2, 18, 51, "Seu Browser: $browser", $branco);
ImageString($im, 2, 18, 68, "Seu SO: $os", $branco);


o que estão a bold nao e a cor do texto??

O que eu queria saber era qual a tabela dessas cores ai!
Offline

=IceBurn= 
Membro
Mensagens 897 Gostos 3
Feedback +3

Troféus totais: 32
Trófeus: (Ver todos)
Windows User Level 6 Linux User Mobile User Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5

Esses "$branco" são as variáveis, até lhes podias chamar "$preto", o que importa são os valores RGB que lhes atribuis.

Um exemplo:
Código: [Seleccione]
$cor_1 = ImageColorAllocate ($im, 209, 238, 238);
Os valores RGB neste caso serão 209, 238, 238
São estes os valores que determinam a cor que depois vais por na ImageString.

Ex:
Código: [Seleccione]
ImageString($im, 2, 18, 18, "Seu IP: $ip", $cor_1);

E mais uma vez aqui vai a explicação da ImageString:
Código: [Seleccione]
ImageString($im, tamanho letra, centrar horizontal, centrar vertical, "Texto", $cor_1);
Offline

=IceBurn= 
Membro
Mensagens 897 Gostos 3
Feedback +3

Troféus totais: 32
Trófeus: (Ver todos)
Windows User Level 6 Linux User Mobile User Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5

A pedido, deixo aqui o código que utilizo para a saudação na minha "sig" (Ex.:Bom Dia, Boa Tarde, etc...)

Primeiro passo, acertar a hora consoante o servidor para a hora de Portugal, no meu caso, como tenho a sig num servidor Alemão, tive que acertar a hora para -1.

Portanto fazemos assim:

Código: [Seleccione]
$TimeZone="-1";

$New_Time = time() + ($TimeZone * 60 * 60);
 
$xtime = date("H",$New_Time);


Depois de acertada a hora vamos ao código base.

Neste momento eu utilizo apenas 3 saudações diferentes, mas criei o código de maneira a futuramente ser possível adicionar mais frases (penso muito no futuro LoL).
Depois cada um altera a coisa como lhe apatecer :)

Código: [Seleccione]
$msg="";
if($xtime>=6 && $xtime<8){$msg="Bom Dia !";}
if($xtime>=8 && $xtime<12){$msg="Bom Dia !";}
if($xtime>=12 && $xtime<13){$msg="Bom Dia !";}
if($xtime>=13 && $xtime<17){$msg="Boa Tarde !";}
if($xtime>=17 && $xtime<19){$msg="Boa Tarde !";}
if($xtime>=19 && $xtime<20){$msg="Boa Noite !";}
if($xtime>=20 && $xtime<22){$msg="Boa Noite !";}
if($xtime>=22 || $xtime<6){$msg="Boa Noite !";}


O código completo fica então assim:
Código: [Seleccione]
<?php
//IceBurn - 2006

$TimeZone="-1";
$New_Time time&#40;&#41; + &#40;$TimeZone * 60 * 60&#41;;
$xtime date&#40;"H",$New_Time&#41;;

$msg="";
if&
#40;$xtime>=6 && $xtime<8&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=8 && $xtime<12&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=12 && $xtime<13&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=13 && $xtime<17&#41;&#123;$msg="Boa Tarde !";&#125;
if&#40;$xtime>=17 && $xtime<19&#41;&#123;$msg="Boa Tarde !";&#125;
if&#40;$xtime>=19 && $xtime<20&#41;&#123;$msg="Boa Noite !";&#125;
if&#40;$xtime>=20 && $xtime<22&#41;&#123;$msg="Boa Noite !";&#125;
if&#40;$xtime>=22 || $xtime<6&#41;&#123;$msg="Boa Noite !";&#125;

echo $msg;
?>

E pronto, já podem cumprimentar o PPL! LoL
Offline

Bruno Mota 
Membro
Mensagens 1733 Gostos 3
Troféus totais: 28
Trófeus: (Ver todos)
Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4 Level 3 Level 2 Level 1

obrigado =IceBurn=
Offline

asturmas 
Administrador
Mensagens 19734 Gostos 50
Feedback +2

Troféus totais: 39
Trófeus: (Ver todos)
Mobile User Windows User Super Combination Combination Topic Starter 100 Poll Votes 50 Poll Votes 10 Poll Votes Poll Voter Poll Starter

Citação de: "=IceBurn="
A pedido, deixo aqui o código que utilizo para a saudação na minha "sig" (Ex.:Bom Dia, Boa Tarde, etc...)

Primeiro passo, acertar a hora consoante o servidor para a hora de Portugal, no meu caso, como tenho a sig num servidor Alemão, tive que acertar a hora para -1.

Portanto fazemos assim:

Código: [Seleccione]
$TimeZone="-1";

$New_Time = time() + ($TimeZone * 60 * 60);
 
$xtime = date("H",$New_Time);


Depois de acertada a hora vamos ao código base.

Neste momento eu utilizo apenas 3 saudações diferentes, mas criei o código de maneira a futuramente ser possível adicionar mais frases (penso muito no futuro LoL).
Depois cada um altera a coisa como lhe apatecer :)

Código: [Seleccione]
$msg="";
if($xtime>=6 && $xtime<8){$msg="Bom Dia !";}
if($xtime>=8 && $xtime<12){$msg="Bom Dia !";}
if($xtime>=12 && $xtime<13){$msg="Bom Dia !";}
if($xtime>=13 && $xtime<17){$msg="Boa Tarde !";}
if($xtime>=17 && $xtime<19){$msg="Boa Tarde !";}
if($xtime>=19 && $xtime<20){$msg="Boa Noite !";}
if($xtime>=20 && $xtime<22){$msg="Boa Noite !";}
if($xtime>=22 || $xtime<6){$msg="Boa Noite !";}


O código completo fica então assim:
Código: [Seleccione]
<?php
//IceBurn - 2006

$TimeZone="-1";
$New_Time time&#40;&#41; + &#40;$TimeZone * 60 * 60&#41;;
$xtime date&#40;"H",$New_Time&#41;;

$msg="";
if&
#40;$xtime>=6 && $xtime<8&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=8 && $xtime<12&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=12 && $xtime<13&#41;&#123;$msg="Bom Dia !";&#125;
if&#40;$xtime>=13 && $xtime<17&#41;&#123;$msg="Boa Tarde !";&#125;
if&#40;$xtime>=17 && $xtime<19&#41;&#123;$msg="Boa Tarde !";&#125;
if&#40;$xtime>=19 && $xtime<20&#41;&#123;$msg="Boa Noite !";&#125;
if&#40;$xtime>=20 && $xtime<22&#41;&#123;$msg="Boa Noite !";&#125;
if&#40;$xtime>=22 || $xtime<6&#41;&#123;$msg="Boa Noite !";&#125;

echo $msg;
?>

E pronto, já podem cumprimentar o PPL! LoL

Grande codigo  :wink:
Offline

kingless 
Membro
Mensagens 857 Gostos 0
Troféus totais: 27
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Que tal algo mais simples como:

Código: [Seleccione]


<?php

$tempo 
date&#40;"H"&#41;;

if&#40;$tempo >= 06 && $tempo < 12&#41; 
&#123; $msg =  "Bom Dia !"; &#125;
elseif&#40;$tempo >= 12 && $tempo < 18&#41;
&#123; $msg = "Boa Tarde !"; &#125;
elseif&#40;$tempo >= 18 || $tempo < 06&#41;
&#123; $msg = "Boa Noite !"; &#125;

echo "$msg";
?>



Com um pouco de criatividade e experencia faz-se algo simples e facil!! :wink:
Offline

SSPT 
Membro
Mensagens 408 Gostos 0
Troféus totais: 26
Trófeus: (Ver todos)
Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5 Level 4 Level 3 Level 2 Level 1

Se quiserem alinhar o texto ao centro ou à direita aqui fica o codigo:
Citar

$text_size= imagettfbbox ($font_size, 0, $font_location, $text);

//Alinhar ao centro
imagettftext($image, $font_size, 0, ($image_width / 2) - ($text_size / 2), $y, $color, $font_location, $text);

//Alinhar à direita
imagettftext($image, $font_size, 0, $image_width - $text_size, $y, $color, $font_location, $text);
Offline

=IceBurn= 
Membro
Mensagens 897 Gostos 3
Feedback +3

Troféus totais: 32
Trófeus: (Ver todos)
Windows User Level 6 Linux User Mobile User Super Combination Combination Topic Starter Poll Voter Poll Starter Level 5

Citação de: "kingless"
Que tal algo mais simples como:

Código: [Seleccione]


<?php

$tempo 
date&#40;"H"&#41;;

if&#40;$tempo >= 06 && $tempo < 12&#41; 
&#123; $msg =  "Bom Dia !"; &#125;
elseif&#40;$tempo >= 12 && $tempo < 18&#41;
&#123; $msg = "Boa Tarde !"; &#125;
elseif&#40;$tempo >= 18 || $tempo < 06&#41;
&#123; $msg = "Boa Noite !"; &#125;

echo "$msg";
?>



Com um pouco de criatividade e experencia faz-se algo simples e facil!! :wink:


Como eu referi:
"Neste momento eu utilizo apenas 3 saudações diferentes, mas criei o código de maneira a futuramente ser possível adicionar mais frases (...)"

Daí o código ser tão longo, mas não há dúvida que  neste caso fica mais correcto assim como fizeste.