← Tutoriais

[PHP] Sig. com informações

Lida 10570 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

Criei um código para mostrar as informações como ip, isp, browser... numa imagem, vou mostrar o código...

Criem uma pasta sig.gif e depois criem um arquivo index.php com este código.

Código: [Seleccione]

<?php
error_reporting
&#40;0&#41;;
header&#40;"content-type&#58; application/x-httpd-php"&#41;;
header&#40;"Content-Type&#58; image/png"&#41;;
$image "baner.png"
$im imagecreatefrompng&#40;$image&#41;;
$branco imagecolorallocate&#40;$im, 0xFF, 0xFF, 0xFF&#41;;
$ip $_SERVER["REMOTE_ADDR"&#93;;
if &#40;&#40;ereg&#40;"Nav", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Gold", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"X11", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Mozilla", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Netscape", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; AND &#40;!ereg&#40;"MSIE", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; AND &#40;!ereg&#40;"Konqueror", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; AND &#40;!ereg&#40;"Yahoo", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; AND &#40;!ereg&#40;"Firefox", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41;&#41; $browser = "Netscape";
elseif&#40;ereg&#40;"Mozilla", $_SERVER["HTTP_USER_AGENT"&#93;&#41; && ereg&#40;"Firefox", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "Mozilla FireFox";
elseif&#40;ereg&#40;"Firefox", $_SERVER["HTTP_USER_AGENT"&#93;&#41; && !ereg&#40;"Mozilla", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "FireFox";
elseif&#40;ereg&#40;"MSIE", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "MSIE";
elseif&#40;ereg&#40;"Lynx", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "Lynx";
elseif&#40;ereg&#40;"Opera", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "Opera";
elseif&#40;ereg&#40;"WebTV", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "WebTV";
elseif&#40;ereg&#40;"Konqueror", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $browser = "Konqueror";
elseif&#40;&#40;eregi&#40;"bot", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Google", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Slurp", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"Scooter", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;eregi&#40;"Spider", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;eregi&#40;"Infoseek", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41;&#41; $browser = "Bot";
else $browser "Desconhecido";
if&
#40;ereg&#40;"Win", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "Windows";
elseif&#40;&#40;ereg&#40;"Mac", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; || &#40;ereg&#40;"PPC", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41;&#41; $os = "Mac";
elseif&#40;ereg&#40;"Linux", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "Linux";
elseif&#40;ereg&#40;"FreeBSD", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "FreeBSD";
elseif&#40;ereg&#40;"SunOS", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "SunOS";
elseif&#40;ereg&#40;"IRIX", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "IRIX";
elseif&#40;ereg&#40;"BeOS", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "BeOS";
elseif&#40;ereg&#40;"OS/2", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "OS/2";
elseif&#40;ereg&#40;"AIX", $_SERVER["HTTP_USER_AGENT"&#93;&#41;&#41; $os = "AIX";
else $os "Desconhecido";
$isp gethostbyaddr&#40;$_SERVER['REMOTE_ADDR'&#93;&#41;;
preg_match&#40;"/[[a-z0-9\-_&#93;+&#93;?\.?[a-z&#93;+$/i", $isp, $ispd&#41;;
if&#40;!empty&#40;$ispd&#41;&#41; $isp1 = $ispd[0&#93;;
else $isp1 "Desconhecido";
ImageString&#40;$im, 2, 18, 3, "Seu IP&#58; $ip", $branco&#41;;
ImageString&#40;$im, 2, 18, 20, "Seu ISP&#58; $isp1", $branco&#41;;
ImageString&#40;$im, 2, 18, 36, "Seu Browser&#58; $browser", $branco&#41;;
ImageString&#40;$im, 2, 18, 53, "Seu SO&#58; $os", $branco&#41;;
imagepng&#40;$im,'',100&#41;;
ImageDestroy &#40;$im&#41;;
?>



Depois têm que ter uma sig com o nome "baner.png" na pasta sig.gif, e depois vai ficar algo como isto.



 :wink:
Offline

Algemas 
Membro
Mensagens 1793 Gostos 0
Feedback +1

Troféus totais: 32
Trófeus: (Ver todos)
Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4 Level 3

=D&gt;  =D&gt;  =D&gt;

Temos craque. Muito cool.  :wink:
Offline

MiguelTavares 
Membro
Mensagens 3871 Gostos 0
Troféus totais: 33
Trófeus: (Ver todos)
Avatar Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Poll Starter Level 5 Level 4

Muito bem ;)
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

Alterei o código e agora o código até mostra a versão do OS...



Antes se alguém tivesse a utilizar Windows XP ou 98... Só mostrava Windows agora mostra Windows XP ou Windows 98...

Mas ainda não troquei o código aqui...
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Citação de: "kingless"
Alterei o código e agora o código até mostra a versão do OS...



Antes se alguém tivesse a utilizar Windows XP ou 98... Só mostrava Windows agora mostra Windows XP ou Windows 98...

Mas ainda não troquei o código aqui...


Mostra MacOS e distros linux?
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

Mostra Mac OS X, Macintosh, Linux, IRIX, Palm OS, OS/2, Playstation Portable, Windows....,  Windows Mobile 2003, Windows Vista, FreeBSD entre outros...

  :wink:
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Certo! a mim está-me a dár linux!
:)
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: "cenourinha"
Certo! a mim está-me a dár linux!
:)


Outro problema  :-k
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

Cenourinha acho que já resolvi o problema  :)  Ainda mostra Linux ?
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Citação de: "kingless"
Citação de: "cenourinha"
Certo! a mim está-me a dár linux!
:)


Outro problema  :-k


Nops!
Tou mesmo em linux...

lol
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: "kingless"
Cenourinha acho que já resolvi o problema  :)  Ainda mostra Linux ?


Ainda mostra linux ?
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Mostra, eu só vou sair do linux daqui a um coto!

lolol
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

se tas no linux então não tem problema lool  :?  :lol:
Offline

cenourinha 
Elite
Mensagens 4094 Gostos 21
Troféus totais: 34
Trófeus: (Ver todos)
Mobile User Apple User Level 6 Super Combination Combination Topic Starter 10 Poll Votes Poll Voter Level 5 Level 4

Eu nao disse o contrário...
 :D
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

Eu é que não tinha percebido bem  :?  Mas mesmo assim valeu a pena modificar estava a dar um erro.  :wink: