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
ERROR_MSG_REQUIERE = "beharrezkoa da" ; mensaje de error para campos de formulario requeridos | |
ERROR_MSG_MAIL_FORMAT = "Emaila ez da egokia" ; mensaje de error si el formato de mail no es caracte@caracter.com | |
ERROR_MSG_TIME_FORMAT = "formatua honakoa izan behar da OO:MM" ; mensaje de error si el formato de hora no es HH:MM | |
ERROR_MSG_MYME_TYPE = "Irudiaren formatua ez da egokia. .jpg, .png, .gif, .bmp edo .tiff izan behar da" ; mensaje de error si el tipo myme no esta permitido | |
ERROR_MSG_IMG_MAXSIZE = "Irudiaren tamaina handiegia da." ; mensaje de error si el archivo subido excede la directiva upload_max_filesize del php.ini | |
ERROR_MSG_IMG = "Irudia igotzean arazo bat izan da" ; mensaje de error si ha habido algun error de tipo 2,3,6,7,8 de $_FILES en PHP | |
$errores = array(); | |
$campoMail = 'email'; |
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
#!/usr/bin/php | |
<?php | |
delete_file("/home/piko/curso-php/uploads/astinddu/"); | |
function delete_file($ruta){ | |
if (is_dir($ruta)) { | |
if ($dir = opendir($ruta)) { | |
while (($file = readdir($dir)) !== false) { | |
if(is_dir($ruta . $file) !== true && $file!="." && $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
# Install graphics magick v1.3.20 from source (run as root) | |
# Install dependencies | |
apt-get build-dep graphicsmagick -y | |
# Download source | |
wget http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.20.tar.bz2 | |
tar -xvjf GraphicsMagick-1.3.20.tar.bz2 | |
cd GraphicsMagick-1.3.20 |
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 | |
$testua = "Hau izango zan testua"; | |
for ($i=0; $i < strlen($testua); $i++) { | |
print("\n karakterea: ");var_dump($testua[$i]); | |
print(" - htmlspecialchars: ");var_dump(htmlspecialchars($testua[$i])); | |
print(" - htmlentities: ");var_dump(htmlentities($testua[$i])); | |
print(" - htmlspecialchars_decode: ");var_dump(htmlspecialchars_decode($testua[$i])); | |
print(" - utf8_decode: ");var_dump(utf8_decode($testua[$i])); |
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="eu"> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta charset="utf-8"> | |
<title>Titulua</title> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<meta name="keywords" content=""/> | |
<meta name="viewport" content="width=device-width, initial-scale=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 | |
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; | |
$url_with_port = "http://".$_SERVER['HTTP_HOST'].":".$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI']; | |
?> |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |