Created
September 6, 2012 17:46
-
-
Save rafops/3658920 to your computer and use it in GitHub Desktop.
PHP Freak Show Series - Ed 01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=================================== | |
//FAZ A CONEXÃO COM O BANCO========== | |
//=================================== | |
$MySQL = new MySQL($DBHost,$DBUser,$DBPass); | |
$MySQL->DBConnect($DBDataBase); | |
if ( ! isset($_GET['canal']) && empty($_GET['canal']) ){ | |
die('$_GET[canal] is empty'); | |
} |
Isso é muito comum encontrar, porque no genet não tem um cara para encapsular a forma de acessar os $_GET e $_POST, por isso se você ver algum cara tentando acessar um indice de um array sem antes ver se está setado, vai dar um erro do tipo "strict", por isso tem muita merda como esta.
Não sei exatamente o porque desta verificação, mas no PHP se você usar apenas o "isset", se o indice "canal" existir vai ser verdadeiro mesmo que for vazio, acho que por isso que tem o "empty".
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FAZ A CONEXÃO COM O BANCO... oh rly?
! isset($_GET['canal']) ... ok, is not set... but it's also empty?