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 | |
$pessoas = array("p1", "p2", "p3", "p4", "p5"); //array com as pessoas | |
$colunas = range(1, 209); //array com as colunas, usei o range só pra gerar um número, pode vir do banco, de uma outra planilha etc... | |
$pessoasTot = count($pessoas); //total de pessoas no array de pessoas | |
$pessoa = 3; //p4 - lembre-se que array começa com indice 0! - Esse valor iria vir do banco/cache/input manual, etc | |
for($i = 0; $i < count($colunas); $i++){ //for para cada coluna | |
if($pessoa >= $pessoasTot) | |
$pessoa = 0; | |
echo "Coluna: " . $colunas[$i] . " vai para a pessoa: " . $pessoas[$pessoa] . "<br />";//aqui dei um echo, você se vira pra gerar sua planilha =D | |
$pessoa++; |
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 | |
$dir = "./images/"; | |
if (!($handle = opendir($dir))) | |
die("Unable to open the directory $dir"); | |
$registros = array(); | |
while (false !== ($file = readdir($handle))) { | |
if ($file === "." or $file === "..") | |
continue; | |
array_push($registros, array("IMAGE" => $file)); | |
} |
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 changeImage(id, newImagePath, transitionClass){ | |
var myImage = document.getElementById(id); | |
var image = new Image(); | |
image.addEventListener("load", function() { | |
myImage.className = transitionClass; | |
}); | |
image.src = newImagePath; | |
image.id = id; | |
myImage.replaceWith(image); | |
} |
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 | |
class Batalha { | |
private $defesa = 15; | |
private $vida = 100; | |
public function Atacar($dano){ | |
if($this->defesa > 0) //se possuir defesa, consome o dano primeiro da defesa, depois da vida | |
{ | |
$remover = min($this->defesa, $dano);//pega o menor valor. |
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 | |
$conexao = mysqli_connect("servidor","usuario","senha", "banco"); | |
$query = mysqli_query($conexao, "SELECT colunaA, colunaB, colunaC FROM tabela WHERE condicao"); | |
//ou se você não quiser usar o WHERE | |
//$query = mysqli_query($conexao, "SELECT colunaA, colunaB, colunaC FROM tabela"); | |
$somatoria = 0; //inicia a variável com valor 0 | |
while($linha = mysqli_fetch_array($query)) | |
$somatoria += $linha["colunaB"]; //supondo que a coluna a ser somada é a coluna B! |
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
$.getJSON("https://viacep.com.br/ws/" + data + "/json/?callback=?", | |
function (data) { | |
if (("erro" in data)) { | |
//trata o erro | |
//errorHandler(data.erro); | |
return; | |
} | |
//usa os dados aqui | |
console.log(data); |
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 | |
$studio = "gallery-adm/repository/studio/"; | |
chdir($studio); | |
$arq_studio = glob("{*.png,*.jpg,*.jpeg,*.bmp,*.gif}", GLOB_BRACE); | |
foreach($arq_studio as $img_studio) { | |
?> | |
<article class="tattoo-section" <?php echo "data-img=".$studio.$img_studio.""; ?> <?php echo "data-tabletimg=".$studio.$img_studio.""; ?> <?php echo "data-phoneimg=".$studio.$img_studio.""; ?> > | |
<?php } ?> |
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 | |
$banners = "gallery-adm/repository/banners/"; | |
chdir($banners); | |
$arq_banners = glob("{*.png,*.jpg,*.jpeg,*.bmp,*.gif}", GLOB_BRACE); | |
foreach($arq_banners as $img_banners) | |
echo "<img src=".$banners.$img_banners." />"; | |
$studio = "gallery-adm/repository/studio/"; | |
chdir("../studio"); | |
$arq_studio = glob("{*.png,*.jpg,*.jpeg,*.bmp,*.gif}", GLOB_BRACE); | |
foreach($arq_studio as $img_studio) { |
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 | |
interface iFreesmscraze{ | |
const USUARIO = ""; | |
const SENHA = ""; | |
const HOST = "http://www.freesmscraze.com/"; | |
const ENDPOINT_LOGIN = "members/login.php"; | |
const ENDPOINT_ENVIAR = "sms/ussmsscript_members.php"; | |
const VIDACOOKIE = 14400; | |
const COOKIE = "cookies//freesmscraze.tmp"; |
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 | |
$login =$_POST["login"]; | |
$senha =$_POST["senha"]; | |
$sql = "SELECT 1 FROM login WHERE Admn = :admin AND Senha = :senha"; | |
$query = $pdo->prepare($sql); | |
$query->bindValue(":admin", $login); | |
$query->bindValue(":senha", $senha); | |
$result = $query->execute(); |