<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Luongo Vincenzo - Blog</title>
	<atom:link href="http://history.luongovincenzo.it/websites/my_website/v6/blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://history.luongovincenzo.it/websites/my_website/v6/blog</link>
	<description>    CiÃ² che non conoscete vi potrebbe danneggiare - Kevin Mitnick</description>
	<lastBuildDate>Mon, 09 Dec 2013 11:04:30 +0000</lastBuildDate>
	<language>it-IT</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>[PHP/cURL] How to check file exists with PHP and cURL lib</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/#comments</comments>
		<pubDate>Mon, 09 Dec 2013 11:04:30 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=136</guid>
		<description><![CDATA[Salve a tutti, oggi vorrei condividere una semplice funziona per il controllo dell&#8217;esistenza di un file (foto, video, file in generale) con una semplice funzione php: function check_file_exists&#40;$file_url&#41; &#123; $ch = curl_init&#40;$file_url&#41;; curl_setopt&#40;$ch, CURLOPT_NOBODY, true&#41;; curl_exec&#40;$ch&#41;; $retcode = curl_getinfo&#40;$ch, CURLINFO_HTTP_CODE&#41;; curl_close&#40;$ch&#41;; &#160; if&#40;$retcode == '200'&#41; return TRUE; //exists else return FALSE;// not exists &#160; &#125; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi vorrei condividere una semplice funziona per il controllo dell&#8217;esistenza di un file (foto, video, file in generale)<br />
con una semplice funzione php:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> check_file_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_NOBODY<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$retcode</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_getinfo</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLINFO_HTTP_CODE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$retcode</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'200'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//exists</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">// not exists</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questa funzione cerca di ritornare l&#8217;HTTP CODE dal server remoto per restituirne il codice,<br />
nel nostro caso se il codice di ritorno Ã¨ 200 allora il file esiste, altrimenti no.</p>
<p>Esempio di utilizzo potrebbe essere:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$file_remoto</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.tuolink.com/multimedia.png'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>check_file_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_remoto</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'File esistente!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'File NON esistente!'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Questo Ã¨ tutto, spero servirÃ  a qualcuno <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpcurl-how-to-check-file-exists-with-php-and-curl-lib/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Javascript] Strip Tags in javascript</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-strip-tags-in-javascript/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-strip-tags-in-javascript/#comments</comments>
		<pubDate>Wed, 13 Nov 2013 09:26:23 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=130</guid>
		<description><![CDATA[Salve a tutti, oggi avevo la necessitÃ  di ripulire delle variabili da codice HTML e restituire un normale testo. Per fare ciÃ² ho optato ad una funzione molto semplice che vi illustro di seguito: function strip_tags&#40;html&#41; &#123; var tmp = document.createElement&#40;&#34;DIV&#34;&#41;; tmp.innerHTML = html; return tmp.textContent &#124;&#124; tmp.innerText; &#125; Per utilizzarla basta semplicemente richiamarla cosÃ¬: [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi avevo la necessitÃ  di ripulire delle variabili da codice HTML e restituire un normale testo.<br />
Per fare ciÃ² ho optato ad una funzione molto semplice che vi illustro di seguito:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">function</span> strip_tags<span style="color: #009900;">&#40;</span>html<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">var</span> tmp <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;DIV&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    tmp.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> html<span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> tmp.<span style="color: #660066;">textContent</span> <span style="color: #339933;">||</span> tmp.<span style="color: #660066;">innerText</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Per utilizzarla basta semplicemente richiamarla cosÃ¬:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">var</span> variabile_sporca <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;html&gt;&lt;body&gt;&lt;a href=&quot;#1&quot;&gt;Go 1&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">var</span> contenuto_pulito <span style="color: #339933;">=</span> strip_tags<span style="color: #009900;">&#40;</span>variabile_sporca<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Enjoy <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-strip-tags-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP/Socket] How to send  data via POST with the Socket</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 10:39:32 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=126</guid>
		<description><![CDATA[Holaz a todos, come per l&#8217;articolo precedente dell&#8217;invio di dati via POST con le cURL, ora vi spiego come inviarli via socket in PHP. Questo script potrebbe essere utile qualora vi venisse in mente di effettuare uno scambio dati su svariati web server. Ecco il codice (sempre rigorosamente commentato): &#60;?php //Nome della pagina alla quale [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Holaz a todos,</p>
<p>come per <a href="http://www.luongovincenzo.it/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/" title="[PHP/cURL] How to send data using POST method to any page with cURL" target="_blank">l&#8217;articolo precedente</a> dell&#8217;invio di dati via POST con le cURL, ora vi spiego come inviarli via <a href="http://php.net/manual/it/book.sockets.php" title="PHP: Sockets - Manual" target="_blank">socket</a> in PHP.<br />
Questo script potrebbe essere utile qualora vi venisse in mente di effettuare uno scambio dati su svariati web server.</p>
<p>Ecco il codice (sempre rigorosamente commentato):</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//Nome della pagina alla quale inviare i dati</span>
<span style="color: #000088;">$uri</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/test/response_socket.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Indirizzo web (http:// o IP) dove indirizzare la chiamata socket (in questo caso Ã¨ su un web server in locale)</span>
<span style="color: #000088;">$sito</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'192.168.1.1'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'username=luongovincenzo92&amp;password=7c4a8d09ca3762af61e59520943dc26494f8941b'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//valori post</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Controllo se la chiamate via socket va a buon fine sulla porta 80</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fsockopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sito</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">8080</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// se va bene creo l'oggetto $sock</span>
	<span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[ERRPR] Connessione non riuscita, si prega di controllare se le socket sono abilitate&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Genero il il pacchetto POST (HEADER HTTP) per inviarlo</span>
<span style="color: #990000;">fputs</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">&quot;POST <span style="color: #006699; font-weight: bold;">$uri</span> HTTP/1.1<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Host: <span style="color: #006699; font-weight: bold;">$sito</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Content-Type: application/x-www-form-urlencoded<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span> <span style="color: #666666; font-style: italic;">//Grandezza della chiamata</span>
  <span style="color: #0000ff;">&quot;Connection: close<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span>
  <span style="color: #000088;">$query</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//dati di invio</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Vabiabile di contenimento dell'output di risposta</span>
<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Ciclo e attendo la risposta del socket per estrapolare la risposta del file</span>
<span style="color: #666666; font-style: italic;">// fino a termine della chiamata</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #000088;">$out</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Chiudo la connessione</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sock</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Cerco di pulire l'output sporcato dalla richiesta ( prima dei doppi \r\n cÃ¨ la richiesta HTTP completa che a noi non serve)</span>
<span style="color: #000088;">$output_pulito</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Stampo la risposta</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$output_pulito</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Per la pagina di risposta c&#8217;Ã¨ sempre la solita:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Note: Ricordate che per eseguire correttamente questo script dovreste avere abilitate le socket sul vostro web server altrimenti non funzionerÃ  mai.</p>
<p>Note 2: Se invece dovete aprire una connessione ad un web server esterno, dovrete abilitate il parametro <strong>allow_url_fopen</strong> del vostro <strong>php.ini</strong></p>
<p>Ogni problema o dubbio commentate <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/phpsocket-how-to-send-data-via-post-with-the-socket/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP/cURL] How to send data using POST method to any page with cURL</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 10:11:58 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=121</guid>
		<description><![CDATA[Salve a tutti, da un recente progetto, mi sono tornate utili le librerie PHP di cURL per potermi dare la possibilitÃ  di inviare delle richieste con metodo POST ad un determinato Web Server. vediamo di seguito come utilizzarle: &#60;?php &#160; //Qui dichiariamo la pagina con url completo, alla quale inviare i dati $url = &#34;http://www.sito.com/pagina_richiede_dati.php&#34;; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>da un recente progetto, mi sono tornate utili le librerie <a href="http://php.net/" title="php.net" target="_blank">PHP</a> di <a href="http://curl.haxx.se/libcurl/php/" title="cURL - PHP" target="_blank">cURL</a> per potermi dare la possibilitÃ  di inviare delle richieste con metodo POST ad un determinato Web Server.<br />
vediamo di seguito come utilizzarle:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui dichiariamo la pagina con url completo, alla quale inviare i dati</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.sito.com/pagina_richiede_dati.php&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Qui ninvece, dichiariamo i dati da inviare come se fossero via GET (quindi separati da una &amp; )</span>
<span style="color: #000088;">$send_data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;username=luongovincenzo92&amp;password=7c4a8d09ca3762af61e59520943dc26494f8941b&amp;token=e10adc3949ba59abbe56e057f20f883e&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui iniziamo ad utilizzare la libreria inizializzandola</span>
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo l'utl sulla quale inviare i dati</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo la metodologia di invio dati (in questo caso POST)</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui specifichiamo quali dati inviare alla pagina</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$send_data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
&nbsp;
<span style="color: #666666; font-style: italic;">//Qui settiamo che vogliamo un valore di ritorno (in questo caso tutto ciÃ² che restituisce la pagina)</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Eseguo il comando e mi conservo la risposta della pagina</span>
<span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Chiudo la connessione</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// $res contiene la risposta della pagina a cui abbiamo inviato i dati via POST</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$response</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>La pagina alla quale abbiamo inviato i dati Ã¨ un qualcosa di simile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>E dalla pagina di invio dovremmo avere una risposta simile:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Array(
	&quot;username&quot; =&gt; &quot;luongovincenzo92&quot;,
	&quot;password&quot; =&gt; &quot;7c4a8d09ca3762af61e59520943dc26494f8941b&quot;,
	&quot;token&quot;    =&gt; &quot;e10adc3949ba59abbe56e057f20f883e&quot;
);</pre></td></tr></table></div>

<p>Ed ecco tutto.</p>
<p>Alla prossima ^_^</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php-how-to-send_data_using_post_method_to_any_page_with_curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PHP] How to create a ZIP file and download</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/#comments</comments>
		<pubDate>Mon, 04 Nov 2013 09:54:39 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=118</guid>
		<description><![CDATA[Salve a tutti, recentemente mi Ã¨ tornato utile creare un archivio zip di determinati file, per poi poterlo scaricare dal web al volo. Per fare ciÃ² mi sono servito della fantastica libreria PclZip con la quale effettuare questa operazione. bene ora vediamo il codice rigorosamente commentato &#60;?php &#160; //CONFIG: Definisco uan variabile costante per dichiarare [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>recentemente mi Ã¨ tornato utile creare un archivio zip di determinati file, per poi poterlo scaricare dal web al volo.<br />
Per fare ciÃ² mi sono servito della fantastica libreria <a href="http://www.phpconcept.net/pclzip/pclzip-downloads" title="PclZip" target="_blank">PclZip</a> con la quale effettuare questa operazione.<br />
bene ora vediamo il codice rigorosamente commentato</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//CONFIG: Definisco uan variabile costante per dichiarare</span>
<span style="color: #666666; font-style: italic;">// la cartella dove Ã¨ contenuta la libreria PclZip</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'__PATH_ZIP_LIB__'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'./pclzip-2-6/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//Change this</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Nome dell'archivio </span>
<span style="color: #000088;">$nome_archivio_zip</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Archivio_&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;dmY&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.zip&quot;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//CONTROL: se esiste giÃ , cerco di cancellarlo</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">file_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
	<span style="color: #339933;">@</span><span style="color: #990000;">unlink</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">//Includo la libreria e genero l'oggetto zip </span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>__PATH_ZIP_LIB__<span style="color: #339933;">.</span><span style="color: #0000ff;">'pclzip.lib.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #000088;">$pclzip_obj</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PclZip<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Una lista di nomi di files da comprimere </span>
<span style="color: #000088;">$lista_file_da_zippare</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;profile.php,users.php,mysql.class.php&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//potete scrivere anche il nome di un singolo file eliminando la virgola finale</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//Aggiungo i files all'archivio </span>
<span style="color: #000088;">$response_pclzip</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pclzip_obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lista_file_da_zippare</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Controllo eventuali errori che possibilmente </span>
<span style="color: #666666; font-style: italic;">//ha scaturito la compressione</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response_pclzip</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[ERROR] PclZip : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$pclzip_obj</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">errorInfo</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">//Opzionale: scarico l'archivio ZIP</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'download'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
&nbsp;
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: application/zip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: attachment; filename=<span style="color: #006699; font-weight: bold;">$nome_archivio_zip</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Description: Backup&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">filesize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #990000;">readfile</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nome_archivio_zip</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Ecco il sorgente giÃ  funzionante, potete modificarlo a vostro piacimento per le vostre esigenze.<br />
Se volete far scaricare direttamente il file bastera richiamare il file php con il seguente URL:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">nome_file.php?download=1</pre></td></tr></table></div>

<p>Fine, spero servirÃ  a qualcuno <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/php_how_to_create_a_zip_file_and_download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[HACKING/Wi-Fi] Cracking WPA &amp; WPA2 key with Reaver on Kali Linux (No Dictionary â€“ Wordlist)</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/hackingwi-fi-cracking-wpa-wpa2-key-with-reaver-on-kali-linux-no-dictionary-wordlist/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/hackingwi-fi-cracking-wpa-wpa2-key-with-reaver-on-kali-linux-no-dictionary-wordlist/#comments</comments>
		<pubDate>Thu, 17 Oct 2013 15:50:40 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=111</guid>
		<description><![CDATA[Hola, oggi vedremo qualche semplice comando per cercare di craccare una rete wireless con la distribuzione Kali Linux (ex BackTrack). Open terminal: airmon-ng airmon-ng stop [your interface My is wlan0] airodump-ng [your interface My is wlan0] Open new terminal: wash -i [your interface My is wlan0] -c [CHANNEL NUM] -C -s Open new terminal: reaver [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hola,</p>
<p>oggi vedremo qualche semplice comando per cercare di craccare una rete wireless con la<br />
distribuzione <a href="http://www.kali.org/" title="Kali Linux (ex BackTrack)" target="_blank"> Kali Linux (ex BackTrack)</a>.</p>
<p><em><strong>Open terminal:</strong></em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">airmon-ng
airmon-ng stop [your interface My is wlan0]
airodump-ng [your interface My is wlan0]</pre></td></tr></table></div>

<p><em><strong>Open new terminal:</strong></em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">wash -i [your interface My is wlan0] -c [CHANNEL NUM] -C -s</pre></td></tr></table></div>

<p><em><strong>Open new terminal:</strong></em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">reaver -i [your interface My is wlan0] -b [BSSID] --fail-wait=360</pre></td></tr></table></div>

<p>Ecco anche un video dimostrativo: <a href="http://www.youtube.com/watch?feature=player_embedded&#038;v=gNR_rgaH_oo" title="YouTube" target="_blank">YouTube</a></p>
<p>Via: <a href="http://systemoverflow.altervista.org/2013/08/20/cracking-wpa-wpa2-key-with-reaver-on-kali-linux-no-dictionary-wordlist/" title="[Link]" target="_blank">[Link]</a></p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/hackingwi-fi-cracking-wpa-wpa2-key-with-reaver-on-kali-linux-no-dictionary-wordlist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Phonegap/iOS] How to fix hide status bar with Phonegap 2.9.0</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/phonegapios-how-to-fix-hide-status-bar-with-phonegap-2-9-0/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/phonegapios-how-to-fix-hide-status-bar-with-phonegap-2-9-0/#comments</comments>
		<pubDate>Thu, 17 Oct 2013 14:56:48 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Phonegap/Cordova]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=108</guid>
		<description><![CDATA[Salve a tutti, dopo 4 ore (totali) di ricerca nel cercare di risolvere un problema fastidiosissimo alle app Phonegap inveriori alla 3.0, ho trovato il modo semplice per ovviare a questo problema. Il problema in sÃ¨ stava nel fatto che, la status bar dei device iPhone o iPad con sistema iOS 7.x.x, phonegap 2.9 rispetto [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>dopo 4 ore (totali) di ricerca nel cercare di risolvere un problema fastidiosissimo alle app Phonegap inveriori alla 3.0, ho trovato il modo semplice per ovviare a questo problema.</p>
<p>Il problema in sÃ¨ stava nel fatto che, la status bar dei device iPhone o iPad con sistema iOS 7.x.x, phonegap 2.9 rispetto alla 3.1, non gestiva correttamente il width massimo della webview phonegap cosÃ¬ da visualizzare &#8220;sotto&#8221; (letteralmente) la status bar del device la vostra app.</p>
<p>Per risolvere questo problema, ci viene incontro il nostro caro e amato plist del nostro progetto in xCode 5.</p>
<p>Entriamo nella sezione delle proprietÃ  del progetto e nella sezione <em>TARGETS</em>, trovate la dicitura <em><strong>Status Bar Style</strong></em>, sotto effettuate il check della voce</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Hide during application lounch</pre></td></tr></table></div>

<p>Apriamo il file nome_progetto-info.plist (o simile) che troverete nella sezione Resources.</p>
<p>Troviamo la voce:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Status bar is initially hidden</pre></td></tr></table></div>

<p>E settiamolo a YES.</p>
<p>Ora premente il pulsante per aggiungere una nuova voce e aggiungece come key:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">View controller-based status bar apparance</pre></td></tr></table></div>

<p>Oppure (per essere precisi)</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">UIViewControllerBasedStatusBarAppearance</pre></td></tr></table></div>

<p>Con type <strong>Boolean</strong> e il value settato su <strong>NO</strong></p>
<p>CosÃ¬ avrete FISSATO (anche se temporaneamente) il bug della web view di phonegap.</p>
<p>Ricordo che con l&#8217;aggiornamento a Phonegap 3.1 o ulteriori il BUG Ã¨ stato risolto e viene gestito correttamente.</p>
<p>Problemi o dubbi, commentate ^_^</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/phonegapios-how-to-fix-hide-status-bar-with-phonegap-2-9-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Javascript/PHP] How to delete the last character from a string</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/#comments</comments>
		<pubDate>Wed, 09 Oct 2013 09:18:59 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=87</guid>
		<description><![CDATA[Salve a tutti, oggi scriverÃ² questo breve articolo per spiegare come eliminare l&#8217;ultimo carattere da una stringa, sia in linguaggio javascript che in PHP. Per far ciÃ² ci basta conoscere 2 funzioni dei relativi linguaggi, ovvero: substr (sia in javascript che in PHP) e strlen (in PHP) e l&#8217;equivalente in javascript ovvero .length . Bene [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>oggi scriverÃ² questo breve articolo per spiegare come eliminare l&#8217;ultimo carattere da una stringa, sia in linguaggio javascript che in PHP.</p>
<p>Per far ciÃ² ci basta conoscere 2 funzioni dei relativi linguaggi, ovvero: substr (sia in javascript che in PHP) e strlen (in PHP) e l&#8217;equivalente in javascript ovvero .length .</p>
<p>Bene ora passiamo alle due funzioni:</p>
<p>Javascript:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">function</span> delete_last_character<span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">var</span> charts_num <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Questa variabil Ã¨ possibile manipolarla a seconda di quanti caratteri ULTIMI eliminare</span>
    <span style="color: #000066; font-weight: bold;">var</span> len <span style="color: #339933;">=</span> str.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
    str <span style="color: #339933;">=</span> str.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> len <span style="color: #339933;">-</span> charts_num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> str<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>PHP:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> delete_last_character<span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$charts_num</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Questa variabil Ã¨ possibile manipolarla a seconda di quanti caratteri ULTIMI eliminare</span>
    <span style="color: #b1b100;">return</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$charts_num</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Questo Ã¨ tutto, utilizzando queste funzioni vi ritornerÃ  la stringa senza l&#8217;ultimo carattere finale o, modificando la variabile charts_num, vi permetterÃ  di eliminare tot caratteri asseconda del set di questa variabile.</p>
<p>Detto questo, un saluto a tutti e alla prossima.</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascriptphp-how-to-delete-the-last-character-from-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[javascript] Convert a time from H:i:s to H:i AM/PM (American format)</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-un-time-da-his-a-hi-ampm-american-format/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-un-time-da-his-a-hi-ampm-american-format/#comments</comments>
		<pubDate>Wed, 25 Sep 2013 13:40:28 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=82</guid>
		<description><![CDATA[Salve a tutti, come il post precedente per la conversione delle date, ecco ora la conversione per l&#8217;orario da un formato europeo (H:i:s) ad uno americano (H:i AM o PM). Esempio: da 00:40:01 a 12:40 AM Per la conversione ho sviluppato una piccola funzione in javascript che permette di fare ciÃ²: function formatTime&#40;time&#41; &#123; &#160; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Salve a tutti,</p>
<p>come il post precedente per la conversione delle date, ecco ora la conversione per l&#8217;orario da un formato europeo (H:i:s) ad uno americano (H:i AM o PM).</p>
<p>Esempio: </p>
<p>da 00:40:01 a 12:40 AM</p>
<p>Per la conversione ho sviluppato una piccola funzione in javascript che permette di fare ciÃ²:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">function</span> formatTime<span style="color: #009900;">&#40;</span>time<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">var</span> type <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;AM&quot;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//PM</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">var</span> appo <span style="color: #339933;">=</span> time.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">var</span> hour <span style="color: #339933;">=</span> appo<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>    
    <span style="color: #000066; font-weight: bold;">var</span> minu <span style="color: #339933;">=</span> appo<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">var</span> seco <span style="color: #339933;">=</span> appo<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hour <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        hour <span style="color: #339933;">=</span> hour<span style="color: #339933;">-</span><span style="color: #CC0000;">12</span><span style="color: #339933;">;</span>
        type <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;PM&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hour <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        hour <span style="color: #339933;">=</span> <span style="color: #CC0000;">12</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>hour<span style="color: #339933;">+</span><span style="color: #3366CC;">':'</span><span style="color: #339933;">+</span>minu<span style="color: #339933;">+</span><span style="color: #3366CC;">' '</span><span style="color: #339933;">+</span>type<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Ecco una DEMO per il corretto funzionamento: <a href="http://jsfiddle.net/b5aqx/">http://jsfiddle.net/b5aqx/</a></p>
<p>Spero serva a qualcuno, alla prossima.</p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-un-time-da-his-a-hi-ampm-american-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Javascript] Convert a date from YYYY-MM-DD to Month DD, YYYY</title>
		<link>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-date-da-yyyy-mm-dd-a-month-dd-yyyy/</link>
		<comments>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-date-da-yyyy-mm-dd-a-month-dd-yyyy/#comments</comments>
		<pubDate>Wed, 25 Sep 2013 13:19:44 +0000</pubDate>
		<dc:creator><![CDATA[Vincenzo]]></dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.luongovincenzo.it/blog/?p=80</guid>
		<description><![CDATA[Hola a tutti, oggi avevo il bisogno di convertire una data di tipo YYYY-MM-DD (MySQL Format) in una data in stile americano Month DD, YYYY. Esempio: Da 2013-01-01 a Jan 01, 2013 Per fare ciÃ² in javascript ho sviluppato una piccola funzione per la conversione della data: function formatDate&#40;input&#41; &#123; var datePart = input.match&#40;/\d+/g&#41;, year [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Hola a tutti,</p>
<p>oggi avevo il bisogno di convertire una data di tipo YYYY-MM-DD (MySQL Format) in una data in stile americano Month DD, YYYY.</p>
<p>Esempio: </p>
<p>Da 2013-01-01 a Jan 01, 2013</p>
<p>Per fare ciÃ² in javascript ho sviluppato una piccola funzione per la conversione della data:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">function</span> formatDate<span style="color: #009900;">&#40;</span>input<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">var</span> datePart <span style="color: #339933;">=</span> input.<span style="color: #660066;">match</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\d+/g</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	year  <span style="color: #339933;">=</span> datePart<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> 
	month <span style="color: #339933;">=</span> datePart<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> 
	day <span style="color: #339933;">=</span> datePart<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>month <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		month <span style="color: #339933;">=</span> month.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000066; font-weight: bold;">var</span> month_arr <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> <span style="">Array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Jan&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Feb&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Mar&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Apr&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;May&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Jun&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">7</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Jul&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">8</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Aug&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">9</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Sep&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">10</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Oct&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">11</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Nov&quot;</span><span style="color: #339933;">;</span>
	month_arr<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">12</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Dec&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">var</span> month_final <span style="color: #339933;">=</span> month_arr<span style="color: #009900;">&#91;</span>parseInt<span style="color: #009900;">&#40;</span>month<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> 
&nbsp;
	<span style="color: #000066; font-weight: bold;">return</span> month_final<span style="color: #339933;">+</span><span style="color: #3366CC;">' '</span><span style="color: #339933;">+</span>day<span style="color: #339933;">+</span><span style="color: #3366CC;">', '</span><span style="color: #339933;">+</span>year<span style="color: #339933;">;</span>      
&nbsp;
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Ecco una demo per il corretto utilizzo: <a href="http://jsfiddle.net/7xVRe/" title="http://jsfiddle.net/7xVRe/">http://jsfiddle.net/7xVRe/</a></p>
<p>Spero sarÃ  utile a qualcuno, saluti <img src='http://history.luongovincenzo.it/websites/my_website/v6/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>https://history.luongovincenzo.it/websites/my_website/v6/blog/javascript-convertire-date-da-yyyy-mm-dd-a-month-dd-yyyy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
