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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Sua Página</title> | |
<link href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet"> | |
</head> | |
<body> |
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 | |
include("conexao.php"); | |
$msg = false; | |
if(isset($_FILES['arquivo'])){ | |
$extensao = strtolower(substr($_FILES['arquivo']['name'], -4)); //pega a extensao do arquivo | |
$novo_nome = md5(time()) . $extensao; //define o nome do arquivo |
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 | |
$host = "localhost"; | |
$usuario = "USUARIO"; | |
$senha = "SENHA"; | |
$bd = "BANCODEDADOS"; | |
$mysqli = new mysqli($host, $usuario, $senha, $bd); | |
if($mysqli->connect_errno) |
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 | |
include("conexao.php"); // caminho do seu arquivo de conexão ao banco de dados $consulta = "SELECT * FROM usuario"; $con = $mysqli->query($consulta) or die($mysqli->error); | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Tutorial</title> | |
</head> |
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
<div itemscope itemtype="http://schema.org/Product"> | |
<a itemprop="url" href="url-do-produto"> | |
<div itemprop="name"> | |
<strong>Nome do Produto</strong> | |
</div> | |
</a> | |
<div itemprop="description">Descricao do Produto</div> |
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 | |
function deletar($pasta){ | |
$iterator = new RecursiveDirectoryIterator($pasta,FilesystemIterator::SKIP_DOTS); | |
$rec_iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST); | |
foreach($rec_iterator as $file){ | |
$file->isFile() ? unlink($file->getPathname()) : rmdir($file->getPathname()); | |
} |
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
<meta charset="utf-8"> | |
<?php | |
function dominio_disponivel($dominio){ | |
if(checkdnsrr($dominio, 'ANY') && gethostbyname($dominio) != $dominio) | |
return false; | |
else | |
return true; | |
} |
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
function data($data){ | |
return date("d/m/Y", strtotime($data)); | |
} | |
// exemplo de utilização: | |
echo data('2017-05-04'); | |
// vai retornar 04/05/2017 |
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
function get_url(){ | |
return strtolower(preg_replace('/[^a-zA-Z]/','',$_SERVER['SERVER_PROTOCOL'])).'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']; | |
} |
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
UPDATE tabela | |
SET coluna_data = ADDDATE(coluna_data, INTERVAL 12 YEAR) | |
WHERE id = 15 | |
SELECT ADDDATE(coluna_data, INTERVAL 12 DAY) | |
FROM tabela |
OlderNewer