domenica 31 agosto 2008

[Js] FullScreen

Descrizione
Consente di aprire una pagina web in modalità FullScreen.

Codice
<head>
<head>
<title>
FullScreen</title>
<script language="JavaScript">
function fullscreen()
{
document.write('<form><input type="button" value="Fullscreen!" onclick="window.open(\'fullscreen.html\',\'\',\'fullscreen,scrollbars=yes\');return(false)">');
}
</script>
</head>
<body>
<script
language="JavaScript">fullscreen()</script>
<body>
</html>

sabato 30 agosto 2008

[Js] GooGle Search

Descrizione
Permette di eseguire una semplice ricerca su GooGle.

Codice
<html>
<head>
<title>
GooGle Search</title>
<script language=JavaScript>
function googSearch() {
if (document.googsearch.search.value!="") {
window.open("http://www.google.com/search?hl=en&q=" + document.googsearch.search.value) ; } else {
alert("Inserire del testo da cercare!")
document.googsearch.search.focus();}}
</script>
</head>
<body>

<div align=center>
<form name="googsearch">
<b>GooGle Search</b><br><br>
<input
name=search type=text size=20>
<input type="button" value="Search" onclick="return googSearch();">
</form>
</div>
</body>
</html>

venerdì 29 agosto 2008

[Js] Simple Login

Descrizione
Semplice login...

Codice
<html>
<head>

<script language="JavaScript">
function Login(form) {
var user = form.user.value;
var passw = form.passw.value;
if (
user=="user" && passw=="pass") {
var htsite = "liv2.html";
window.location = htsite;}
else if (
user!="user" && passw=="pass") {
alert("Username errato!");
}
else if (
user=="user" && passw!="pass") {
alert("Password errata!");
}

else
{

alert("Non hai inserito dei dati validi!");
}
}

</script>
</head>

<body bgcolor="#000000">
<form name=login>
<p align="center"><font color="#00FF00">Username:</font>
<input type=text name=user size=20>
<br>
<br>

<font color="#00FF00">Password:</font>
<input type=password name=passw size=20>
</p>
<p
align="center">
<input type=button value="login" onClick="Login(this.form)" name="button">
</p>
</form>
</body>
</html>

giovedì 28 agosto 2008

[Js] Simple Password Protection

Descrizione
Mostra come attuare una semplice protezione tramite password dei contenuti presenti su di una pagina web.

Codice
<html>
<head>

<title>Password</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
function pass(){
var passwd=prompt("Password:","")
if (passwd=="aiv3")
{

document.write ('Password esatta!');
}
else{
document.write ('Password errata!');
}
}

</SCRIPT>
<BODY
onLoad="pass()">
</body>
</html>

mercoledì 27 agosto 2008

[Js] Data

Descrizione
Mostra, in una pagina web, la data corrente.

Codice
<html>
<head>

<title>Data</title>
</head>
<body>

Data di oggi:
<script>
gg="";
mm="";
data = new Date();
day = data.getDay();
if (day == 0) gg='Domenica';
if (day == 1) gg='Lunedì';
if (day == 2) gg='Martedì';
if (day == 3) gg='Mercoledì';
if (day == 4) gg='Giovedì';
if (day == 5) gg='Venerdì';
if (day == 6) gg='Sabato';
mese = data.getMonth();
if (mese == 0) mm='Gennaio';
if (mese == 1) mm='Febbraio';
if (mese == 2) mm='Marzo';
if (mese == 3) mm='Aprile';
if (mese == 4) mm='Maggio';
if (mese == 5) mm='Giugno';
if (mese == 6) mm='Luglio';
if (mese == 7) mm='Agosto';
if (mese == 8) mm='Settembre';
if (mese == 9) mm='Ottobre';
if (mese == 10) mm='Novembre';
if (mese == 11) mm='Dicembre';
gdm = data.getDate();
anno = data.getYear();
document.write (gg,', ', gdm, ' ',mm, ' ', anno+1900);
</script>
</body>
</html>

martedì 26 agosto 2008

[C++] PassGenerator

Descrizione
Genera una password con un numero di caratteri a scelta dell'utente.

Codice
#include <iostream>
using namespace std;
int main() {
int num;
cout << "Numero caratteri della password: ";
cin >> num;
char kar[36] = { '0','1','2','3','4','5', '6','7','8','9','a','b','c','d','e','f','g', 'h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
for (int a=0; a<num; a++){
if (a==0){
cout << "Password: " << kar[rand() % 36];
}else{
if (a==num-1)
{
cout << kar[rand() % 36] << "\n";
}
else
{
cout << kar[rand() % 36];
}
}
}
system ("pause");
}

lunedì 25 agosto 2008

[Php] Controllare lo spazio libero su di un disco locale

Descrizione
Controlla lo spazio libero su di un disco locale.

Codice
<?php
$hd = disk_free_space("C:");
echo "Spazio libero sul disco locale \"C:\": $hd byte";
?>

domenica 24 agosto 2008

[Php] Add-a-site-in-GooGle

Descrizione
Consente di addare un sito in GooGle senza dover recarsi su http://www.google.com/addurl/.

Codice
<?
$url = $_POST['url'];
$descr = $_POST['descr'];
if ($url!=''){
echo "<html><head></head><body><center><h1>Il tuo sito è stato aggiuto al database di Google!</h1><br><b>Url:</b> $url<br><b>Descrizione:</b> $descr<br><br><iframe src=\"http://google.com/addurl?q=$url&dq=$descr&submit=\" width=\"800\" height=\"600\"></iframe></center></body></html>";
}
else{
echo "<html>
<head>
<title>Add a site in GooGle</title>
</head>
<body>
<center>
<h1>
Add Sites In GooGle
</h1>
<center>
<form name=\"form1\" action=\"add.php\" method=\"Post\">
<b>
Url:
</b>
<input id=\"1\" type=\"text\" name=\"url\" Size=\"50\" Style=\"Color: #000000\">
<br>
<br>
<b>
Descrizione:
</b>
<br>
<textarea id=\"2\" type=\"text\" name=\"descr\" width=\"200px\" height=\"200px\" style=\"color: #000000\"></textarea>
<br>
<br>
<input type=\"submit\" name=\"invia\" value=\"Invia\">
<br>
<br>
</form>
</center>
</body>
</html>"
;
}
?>

sabato 23 agosto 2008

[Perl] YouTube-Video-Downloader

Descrizione
Dato un url di un video di YouTube, scarica detto video sul proprio pc.

Codice
use
LWP;
use Term::ReadKey;
use Term::ANSIColor;
use Win32::Console::ANSI;
&video;
sub video{
print color 'bold red';
print "[!]Inserisci l'url del video da scaricare da YouTube: ";
print color 'reset';
chomp($url=<>);
if($url=~m/(http:\/\/.*?youtube\.com)\/.*?v=(.+)/){
$you= $1;
$code=$2;}
else{
print color "bold red";
print "[!]Non hai immesso un valido indirizzo...\n[!]Riprovare? (y/n)\n";
print color "reset";
chomp($a=<>);
while(1==1){
if($a eq 'y'){
&video; }
elsif($a eq 'n'){
print color "bold red";
print "[!]Alla prossima!\n[!]Premi un tasto per uscire...\n";
print color "reset";
while(not defined ($key = ReadKey(-1))){ }
exit;}else{
print color "bold red";
print "[!]Non hai immesso una valida risposta!\n[!]Riprovare? (y/n)\n";
print color "reset";
chomp($a = <>);}}}
$lwp = LWP::UserAgent->new;
$get = $lwp->get("$you/v/$code")->request->uri;
$get =~ s/.*&t=(.+)/$1/;
open(F,">$code.flv");
binmode(F);
$t1=$t2=time;
print color "bold blue";
print "\n[*]Scaricamento in corso...\n";
print color "reset";
$req = $lwp->request(HTTP::Request->new(
GET => "$you/get_video?video_id=$code&t=$get"),
sub {
(
$part,$req) = @_;
$part2 = $part2 + length($part);
$time2 = time;
if($time2 > $time1){
if ($req->content_length) {
$leng = $req->content_length;
$ctr = 100*$part2/$leng;
print color "bold green";
printf STDERR "\r[*]%d%%",$ctr;
print color "reset";
$time1= $time2;}}
print F $part;});
close(F);
print color "bold green";
print "\r[!] 100% - File scaricato con successo!\n";
print color "reset";
print color "bold red";
print "[!]Vuoi scaricare un nuovo video? (y/n)\n";
print color "reset";
chomp($a=<>);
while(1==1){
if($a eq 'y'){
&video;}
elsif($a eq 'n'){
print color "bold red";
print "[!]Alla prossima!\n[!]Premi un tasto per uscire...\n";
print color "reset";
while(not defined ($key = ReadKey(-1))){}
exit;}else{
print color "bold red";
print "[!]Non hai immesso una valida risposta!\n[!]Vuoi scaricare un nuovo video? (y/n)\n";
print color "reset";
chomp($a = <>);}}}

venerdì 22 agosto 2008

[Python] ZipArchives

Descrizione
Mostra come interagire con archivi ZIP

Codice
import zipfile
z = zipfile.ZipFile("a.zip", "r")
for file in z.namelist( ):
 print "Lista files:\n", file 
 bytes = z.read(file)
 print ' - ', len(bytes), 'bytes'