Caputo’s blog

Informatica, tecnologia, programmazione, fai da te, papercraft e papertoy

Realizzare thumbs online

ottobre 9th, 2009 by Giovanni Caputo

Picothumbs.com è una applicazione web che permetti di realizzare delle thumbs/miniature di pagine web.

Il sito richiede la registrazione gratuita e la possibilità di creare un massimo di 250 thumbnails.

Picothumbs_standard

Category: Siti Web, Tecnologia | No Comments »

Creare fototessera online

ottobre 9th, 2009 by Giovanni Caputo

PhotoCabine è una applicazione web, realizzata in Flash che ricrea virtualmente una cabina per fototessera.

Effettua le fototessere creando delle foto dalla propria web cam. Successivamente, potremo salvarle, stamparle o condividerle su facebook.

Category: Siti Web, Tecnologia | No Comments »

Utilizzare una stampante in remoto

ottobre 1st, 2009 by Giovanni Caputo

PrinterShare è un software che ci consente di condividere la nostra stampante con altri utenti registrati al servizio e, quindi, di ricevere o stampare documenti direttamente su quelle di altre persone. Il programma manda i file tramite internet alla stampante da cui lo vogliamo stampare (anche su quel computer deve essere installato il software).

How it works schema

Category: Tecnologia, programmi | No Comments »

Sicurezza PHP e MySQL: proteggersi dalla SQL Injections

giugno 1st, 2009 by Giovanni Caputo

Vediamo alcune funzioni utili che possono essere utilizzati per proteggersi dalla SQL Injections. Questo tipo di attacco/problema è causato da alcuni caratteri speciali come apostrofi o slash che, se inseriti in una query, possono compromottere la sicurezza del database.

Vediamo, quindi, alcune funzioni PHP molto utili che preanalizzano i dati prima di effettuare una query.

add_slashes

Funzione built-in che aggiunge uno slash prima di apici, doppi apici, backslash, etc…

Per esempio se usata per la stringa O’Reilly,  la funzione, resituisce O\’Reilly. Questo però non basta per rendere una query sicura.

magic_quotes_gpc

Magic Quotes non è una funzione ma una opzione di configurazione. Questa opzione permette di aggiungere automaticamente blackslask ad ogni variabile, $_GET, $_POST e $_COOKIE,  che contiene uno dei caratteri menzionati precedentemente.

mysql_escape_string

Protegge i caratteri speciali come slash singoli o doppi, backslash, \x00, \n, \r, and \x1a.

Questa funzione è stata progettata proprio per essere utilizzata per query da eeguire su MySQL.

Category: Programmazione, Siti Web, tutorial | No Comments »

Lettore feed in PHP

maggio 27th, 2009 by Giovanni Caputo

<?php

/*

$insideitem = false;

$tag = "";

$title = "";

$description = "";

$link = "";

echo"

";

$xml_parser = xml_parser_create();

xml_set_element_handler($xml_parser, "startElement", "endElement");

xml_set_character_data_handler($xml_parser, "characterData");

$fp = fopen("http://www.nomesito.com/rss.xml","r") or die("Error reading RSS data.");

while ($data = fread($fp, 4096))

xml_parse($xml_parser, $data, feof($fp))

or die(sprintf("XML error: %s at line %d",

xml_error_string(xml_get_error_code($xml_parser)),

xml_get_current_line_number($xml_parser)));

fclose($fp);

xml_parser_free($xml_parser);

echo"";

*/

 ?

function startElement($parser, $name, $attrs) {

global $insideitem, $tag, $title, $description, $link;

if ($insideitem) {

$tag = $name;

} elseif (strtolower($name) == "item") {

$insideitem = true;

}

}

function endElement($parser, $name) {

global $insideitem, $tag, $title, $description, $link;

if (strtolower($name) == "item") {

printf("

•	%s",

trim($link),trim($title),trim($title));

printf("%s",trim($description));

$title = "";

$description = "";

$link = "";

$insideitem = false;

}

}

function characterData($parser, $data) {

global $insideitem, $tag, $title, $description, $link;

if ($insideitem) {

switch (strtolower($tag)) {

case "title":

$title .= $data;

break;

//case "description":

//$description .= $data;

//break;

case "link":

$link .= $data;

break;

}

}

}

Read the rest of this entry »

Category: Programmazione, Siti Web | No Comments »

Applicazione web per il controllo e la gestione del lavoro

maggio 15th, 2009 by Giovanni Caputo

CreativePro Office è una web application, o meglio una suite di web applications per gestire attraverso lo stesso strumento lo sviluppo di un progetto, l’impiego del tempo, la fatturazione, gli incarichi e i contatti (clienti e collaboratori).

Category: Siti Web, Tecnologia | No Comments »

Sliding Doors con CSS

maggio 9th, 2009 by Giovanni Caputo

Di seguito il link al tutorial sullo sliding doors.

[Ordinary example of CSS-based tabs, using flat colors and squared-off corners.]

[Stylized tabs using rounded corners and subtle three-dimensional shading.]

Tutorial

Category: Programmazione, Siti Web | No Comments »

Debuggare e testare codice per il web con Firebugs

maggio 7th, 2009 by Giovanni Caputo

Segnalo a tutti gli sviluppatori web, un video dal canale di googletechtalks, nel quale viene spiegato come testare ed effettuare il debug di codice web, come javascript e CSS.

Category: Programmazione, Siti Web, tutorial | No Comments »

Validatore sintattico di carte di credito

maggio 7th, 2009 by Giovanni Caputo

Sastgroup fornisce codice PHP che permette di validare sintatticamente i numeri di carta di credito.

< ?

if( checkCreditCard (”40236007878787″, “Visa”, &$errornumber, &$errortext))
echo “OK”;
else echo”MO”;

function checkCreditCard ($cardnumber, $cardname, &$errornumber, &$errortext) {

$cards = array ( array (’name’ => ‘American Express’,
‘length’ => ‘15′,
‘prefixes’ => ‘34,37′,
‘checkdigit’ => true
),
array (’name’ => ‘Carte Blanche’,
‘length’ => ‘14′,
‘prefixes’ => ‘300,301,302,303,304,305,36,38′,
‘checkdigit’ => true
),
array (’name’ => ‘Diners Club’,
‘length’ => ‘14′,
‘prefixes’ => ‘300,301,302,303,304,305,36,38′,
‘checkdigit’ => true
),
array (’name’ => ‘Discover’,
‘length’ => ‘16′,
‘prefixes’ => ‘6011′,
‘checkdigit’ => true
),
array (’name’ => ‘Enroute’,
‘length’ => ‘15′,
‘prefixes’ => ‘2014,2149′,
‘checkdigit’ => true
),
array (’name’ => ‘JCB’,
‘length’ => ‘15,16′,
‘prefixes’ => ‘3,1800,2131′,
‘checkdigit’ => true
),
array (’name’ => ‘Maestro’,
‘length’ => ‘16,18′,
‘prefixes’ => ‘5020,6′,
‘checkdigit’ => true
),
array (’name’ => ‘MasterCard’,
‘length’ => ‘16′,
‘prefixes’ => ‘51,52,53,54,55′,
‘checkdigit’ => true
),
array (’name’ => ‘Solo’,
‘length’ => ‘16,18,19′,
‘prefixes’ => ‘6334,6767′,
‘checkdigit’ => true
),
array (’name’ => ‘Switch’,
‘length’ => ‘16,18,19′,
‘prefixes’ => ‘4903,4905,4911,4936,564182,633110,6333,6759′,
‘checkdigit’ => true
),
array (’name’ => ‘Visa’,
‘length’ => ‘13,16′,
‘prefixes’ => ‘4′,
‘checkdigit’ => true
),
array (’name’ => ‘Visa Electron’,
‘length’ => ‘16′,
‘prefixes’ => ‘417500,4917,4913′,
‘checkdigit’ => true
)
);

$ccErrorNo = 0;

$ccErrors [0] = “Unknown card type”;
$ccErrors [1] = “No card number provided”;
$ccErrors [2] = “Credit card number has invalid format”;
$ccErrors [3] = “Credit card number is invalid”;
$ccErrors [4] = “Credit card number is wrong length”;

// Establish card type
$cardType = -1;
for ($i=0; $i

// See if it is this card (ignoring the case of the string)
if (strtolower($cardname) == strtolower($cards[$i]['name'])) {
$cardType = $i;
break;
}
}

// If card type not found, report an error
if ($cardType == -1) {
$errornumber = 0;
$errortext = $ccErrors [$errornumber];
return false;
}

// Ensure that the user has provided a credit card number
if (strlen($cardnumber) == 0) {
$errornumber = 1;
$errortext = $ccErrors [$errornumber];
return false;
}

// Remove any spaces from the credit card number
$cardNo = str_replace (’ ‘, ”, $cardnumber);

// Check that the number is numeric and of the right sort of length.
if (!eregi(’^[0-9]{13,19}$’,$cardNo)) {
$errornumber = 2;
$errortext = $ccErrors [$errornumber];
return false;
}

// Now check the modulus 10 check digit – if required
if ($cards[$cardType]['checkdigit']) {
$checksum = 0; // running checksum total
$mychar = “”; // next char to process
$j = 1; // takes value of 1 or 2

// Process each digit one by one starting at the right
for ($i = strlen($cardNo) – 1; $i >= 0; $i–) {

// Extract the next digit and multiply by 1 or 2 on alternative digits.
$calc = $cardNo{$i} * $j;

// If the result is in two digits add 1 to the checksum total
if ($calc > 9) {
$checksum = $checksum + 1;
$calc = $calc – 10;
}

// Add the units element to the checksum total
$checksum = $checksum + $calc;

// Switch the value of j
if ($j ==1) {$j = 2;} else {$j = 1;};
}

// All done – if checksum is divisible by 10, it is a valid modulus 10.
// If not, report an error.
if ($checksum % 10 != 0) {
$errornumber = 3;
$errortext = $ccErrors [$errornumber];
return false;
}
}

// The following are the card-specific checks we undertake.

// Load an array with the valid prefixes for this card
$prefix = split(’,',$cards[$cardType]['prefixes']);

// Now see if any of them match what we have in the card number
$PrefixValid = false;
for ($i=0; $i
$exp = ‘^’ . $prefix[$i];
if (ereg($exp,$cardNo)) {
$PrefixValid = true;
break;
}
}

// If it isn’t a valid prefix there’s no point at looking at the length
if (!$PrefixValid) {
$errornumber = 3;
$errortext = $ccErrors [$errornumber];
return false;
}

// See if the length is valid for this card
$LengthValid = false;
$lengths = split(’,',$cards[$cardType]['length']);
for ($j=0; $j
if (strlen($cardNo) == $lengths[$j]) {
$LengthValid = true;
break;
}
}

// See if all is OK by seeing if the length was valid.
if (!$LengthValid) {
$errornumber = 4;
$errortext = $ccErrors [$errornumber];
return false;
};

// The credit card is in the required format.
return true;
}
?>

Read the rest of this entry »

Category: Programmazione, Siti Web, Tecnologia | No Comments »

PlugIn Wordpress per realizare gallerie di immagini

maggio 6th, 2009 by Giovanni Caputo

01. Nextgen Gallery Plugin

nextgen gallery

Nextgen Gallery Plugin

02. Cleaner WordPress Gallery Plugin

2-cleaner

Cleaner WordPress Gallery Plugin

03. Lightbox Gallery Plugin

lightbox Gallery Plugin

Lightbox Gallery Plugin

04. FlippingBook Gallery Plugin

4-flippingbook

FlippingBook Gallery Plugin

05. PhotoXhibit Plugin

5-photoxhibit

PhotoXhibit

06. AWSOM PixGallery Plugin

awsom

AWSOM PixGallery Plugin

07. Falbum Gallery Plugin

falbum

Falbum Gallery Plugin

08. Lazyest Gallery Plugin

8-lazyest-gallery

Galleria Lazyest Plugin

09. WP Photo Album Plugin

WP Photo Album Plugin

WP Plugin Photo Album

Inline Gallery Plugin

inline gallery

Read the rest of this entry »

Category: Programmazione, Siti Web | No Comments »