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 | |
// Verficando se foi acionado o envio do formulário. | |
if(isset($_POST['submit'])) | |
{ | |
$login_digitado = $_POST['login']; | |
$senha = $_POST['senha']; | |
$nome = $_POST['nome']; | |
$email = $_POST['email']; | |
$telefone = $_POST['telefone']; |
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
/** | |
* Convert the entire $object->all array result set into an array of | |
* associative arrays. | |
* @see to_array | |
* @param DataMapper $object The DataMapper Object to convert | |
* @param array $fields Array of fields to include. If empty, includes all database columns. | |
* @param string $key_field Key Field array | |
* @return array An array of associative arrays. | |
*/ | |
function all_to_array($object, $fields = '', $key_field = '') |
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
/** | |
* Add or change flashdata, only available | |
* until the next request | |
* | |
* @access public | |
* @param mixed | |
* @param string | |
* @return void | |
*/ | |
function set_flashdata($newdata = array(), $newval = '') |
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
public function login() | |
{ | |
// Caso o usuário já esteja logado, redireciona ele. | |
if($this->_needlogin(FALSE)) | |
{ | |
redirect('account'); | |
} | |
// Exibe se existe mensagem pendente (notificação) | |
if($message = $this->session->flashdata('logout')) |
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 | |
$now = DateTime::createFromFormat('d/m/Y', '21/06/2014'); | |
$tomorrow = DateTime::createFromFormat('d/m/Y', '22/06/2014'); | |
var_dump($now == $tomorrow); | |
var_dump($now < $tomorrow); | |
var_dump($now > $tomorrow); |
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 | |
//INICIALIZA A SESSÃO | |
session_start(); | |
$_SESSION["disciplinas"] = array(1 => 'curso 1', 2 => 'curso 2'); | |
$_POST["disciplinas"] = array(3 => 'curso'); | |
// Verifica se há chamadas de POST | |
if(!empty($_POST)) | |
{ |
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 | |
$arrayIdiomas = array('portugues' => 'idioma.portugues.php', 'english' => 'idioma.ingles.php', 'espanol' => 'idioma.espanhol.php', 'alemao' => 'idioma.alemao.php'); // definindo todos os idiomas disponiveis | |
// Definindo o idioma padrão | |
if(!isset($_SESSION['idIdioma'])){ | |
$_SESSION['idIdioma'] = 'portugues'; | |
} | |
if(isset($_REQUEST['idioma'])){ |
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 Template { | |
private $words; | |
public function SetKeywords($Setkeyword, $Setvalue){ | |
if(gettype($this->words) != 'array'){ | |
$this->words = array(); | |
} | |
$array = array($Setkeyword => $Setvalue); | |
$this->words = array_merge($array,$this->words); |
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 | |
namespace App\Modules\News\Models; | |
use Carbon\Carbon, Model\Category, Model\Tags, Model\Categorys, Debugbar; | |
class News extends \Eloquent { | |
public $with = [ 'tags', 'category' ]; // related relationship |
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 | |
$client = new SoapClient('http://www.url.com.br/ws.asmx?WSDL'); // URL de chamada. | |
$function = 'cep'; // qual função você quer trabalhar? No manual do webservice escolhido será disponibilizado a lista de todas. | |
// Aqui você define os argumentos que deseja enviar para a chamada. Por exemplo caso eu estivesse utilizando um WS do correiros, e desejasse retornar CEP. | |
$arguments= array('cep' => array( | |
'uf' => 'sp', | |
'cidade' => 'borba' | |
)); |
OlderNewer