This file contains 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
pragma solidity ^0.4.17; | |
contract Lottery { | |
address public manager; | |
address[] public players; | |
uint minEntry = .01 ether; | |
uint managerFee = .01 ether; | |
constructor() public { | |
manager = msg.sender; |
This file contains 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
def download_url | |
if s3_file? | |
path = URI.parse(url).path[1..-1] | |
fog_storage.directories.new(key: s3_bucket).files.new(key: path).url(15.minutes.from_now) | |
else | |
url | |
end | |
end |
This file contains 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
<?php | |
// Inclui o arquivo que faz a conexão ao MySQL | |
include("conexao.php"); | |
// Montamos a consulta SQL para deletar notícias que não sejam desse ano | |
$query = "DELETE FROM `noticias` WHERE (`cadastro` < '2009-01-01 00:00:00') OR (`cadastro` > '2009-12-31 23:23:59')"; | |
// Executa a query | |
$deletar = mysql_query($query); |
This file contains 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
<?php | |
// Inclui o arquivo que faz a conexão ao MySQL | |
include("conexao.php"); | |
// Montamos a consulta SQL para deletar a(s) notícia(s) com ID maior ou igual a três | |
$query = "DELETE FROM `noticias` WHERE (`id` >= 3)"; | |
// Executa a query | |
$deletar = mysql_query($query); |
This file contains 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
// Montamos a consulta SQL | |
$query = "INSERT INTO `noticias` VALUES (NULL, '".$titulo."', '".$texto."', '".$cadastro."')"; |
This file contains 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
<?php | |
// Inclui o arquivo que faz a conexão ao MySQL | |
include("conexao.php"); | |
// Definição das variáveis para montar a query | |
$titulo = 'Vandalismo mata 10 mil árvores por ano no Rio'; | |
$texto = 'Não fosse privilegiada pela natureza, com a vasta extensão da Mata Atlântica, a paisagem do Rio seria desértica. | |
'; | |
$cadastro = date('Y-m-d H:i:s'); // Formato de data padrão do MySQL | |
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains 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
CREATE TABLE IF NOT EXISTS `noticias` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`titulo` varchar(255) NOT NULL, | |
`texto` longtext NOT NULL, | |
`cadastro` datetime NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `titulo` (`titulo`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; |
This file contains 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
<?php | |
print_r($_COOKIE); | |
?> |
This file contains 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
<?php | |
// Deleta o cookie definido anteriormente | |
setcookie('usuario'); | |
?> |
This file contains 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
<?php | |
// Pega o valor do Cookie 'usuario' definido anteriormente: | |
$valor = $_COOKIE['usuario']; // Fulano | |
// Pega o valor do Cookie 'nome' definido anteriormente: | |
$valor = $_COOKIE['nome']; // Ciclano | |
?> |
NewerOlder