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 | |
// abrimos la sesión cURL | |
$ch = curl_init(); | |
// definimos la URL a la que hacemos la petición | |
curl_setopt($ch, CURLOPT_URL,"http://www.aeurus.cl/api.php"); | |
// indicamos el tipo de petición: POST | |
curl_setopt($ch, CURLOPT_POST, TRUE); | |
// definimos cada uno de los parámetros | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "valor1=value1&valor2=value2&valor3=value3"); |
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 autoVer($url) | |
{ | |
$path = pathinfo($url); | |
$ver = '?v='.filemtime($_SERVER['DOCUMENT_ROOT'].$url); | |
return $path['dirname'].'/'.$path['basename'].$ver; | |
} |
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 | |
$password = substr( md5(microtime()), 1, 8); |
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 | |
$dbhost = 'hostname'; | |
$dbname = 'dbname'; | |
$dbuser = 'dbuser'; | |
$dbpass = 'dbpassword'; | |
$dsn = 'mysql:dbname='.$dbname.';host='.$dbhost; | |
try { | |
$dbh = new PDO($dsn, $dbuser, $dbpass); | |
} catch (PDOException $e) { |
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 | |
setlocale(LC_ALL, 'es_ES'); | |
foreach ($listado as $key => $venta) { | |
$fecha = $venta->fecha; | |
$date = new Datetime("$fecha"); | |
$fecha = strftime("%d %B %Y", $date->getTimestamp()); | |
$listado[$key]->fecha = $fecha; | |
} |
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 | |
$fecha = new DateTime(); # Para obtener desde una fecha determinada sería de la siguente forma: $fecha = new DateTime('2019-12-11'); | |
// obtener primer día del mes | |
$primer = $fecha; | |
$primer->modify('first day of this month'); | |
$primer = $primer->format('Y-m-d'); | |
echo $primer; | |
// obtener último día del mes |
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
// Rut | |
oninput="this.value = this.value.replace(/[^0-9Kk.]/g, '').replace(/(\..*)\./g, '$1');" | |
// Numeros | |
onkeypress="return /[0-9]/i.test(event.key)" | |
// Letras | |
onkeypress="return /[aA-zZ ]/i.test(event.key)" | |
// maxLength | |
oninput="if(this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" |
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
<input type="text" onkeypress="return filterFloat(event,this);"> | |
<script> | |
function filterFloat(evt,input){ | |
// Backspace = 8, Enter = 13, ‘0′ = 48, ‘9′ = 57, ‘.’ = 46, ‘-’ = 43 | |
var key = window.Event ? evt.which : evt.keyCode; | |
var chark = String.fromCharCode(key); | |
var tempValue = input.value+chark; | |
if(key >= 48 && key <= 57){ | |
if(filter(tempValue)=== false){ |
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
<script> | |
$(document).ready(function(){ | |
$("#fechainicio").datepicker({ | |
todayBtn: 1, | |
autoclose: true, | |
}).on('changeDate', function (selected) { | |
var minDate = new Date(selected.date.valueOf()); | |
$('#fechatermino').datepicker('setStartDate', minDate); | |
}); |
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(){ | |
$(":input").prop("disabled", true); | |
}) |
OlderNewer