Небольшой (и не знаю насколько полезный) скриптег, для вычисления hash_del_key переменных для php4 и php5, описанных в статье Евгения Минаева "Роковые ошибки Php" (http://forum.antichat.ru/thread54355.html), в треде кто-то спрашивал как их вычислять, вот скрипт: PHP: <?php //вычисление hash_del_key для переменных php4 и php5 $h = 5381; $st='s';//здесь имя переменной для которой считать хеш for ($i=0;$i<strlen($st)+1;$i++) { $h += ($h << 5); $h ^= ord($st[$i]); } echo "hash_del_key_php4: $h<br>";//вывод хеша php4 $h = 5381; for ($i=0;$i<strlen($st)+1;$i++) { $h += ($h << 5); $h += ord($st[$i]); } echo "hash_del_key_php5: $h";//вывод хеша ?>
Создание скриншота сайта Работает под виндой на PHP 5 >= 5.2.2 Code: <?php $browser = new COM("InternetExplorer.Application"); $handle = $browser->HWND; $browser->Visible = true; $browser->Navigate("http://ya.ru"); while ($browser->Busy) { com_message_pump(4000); } $im = imagegrabwindow($handle, 0); $browser->Quit(); imagepng($im, "iesnap.png"); ?>
переводит текст в картинку.. Code: <? $text = "rufiles.ru"; $pic=ImageCreate(130,30); //(breite, hцhe) $col1=ImageColorAllocate($pic,0,0,0); $col2=ImageColorAllocate($pic,255,255,255); ImageFilledRectangle($pic, 0, 0, 500, 30, $col2); ImageString($pic, 3, 5, 8, $text, $col1); Header("Content-type: image/jpeg"); ImageJPEG($pic); ImageDestroy($pic); ?>
народ помогите нарыть скриптец...чтобы можно было инфу о клиенте подробную как в античате ( http://old.antichat.ru/util/whois/ ) так чтобы текстом на почту приходило в случае если я размещу его не на своем сайте.Помогите оч надо...
Action Script: Имитирует падающие шарики Code: function fall( ) { // Add acceleration due to gravity this.speedY += GRAVITY; // Reduce the speed due to friction this.speedY *= FRICTION; // Assume both forces work exclusively in the Y direction this._y += this.speedY; // Make the clip bounce up when it hits the "floor" (a line) if (this._y > 400) { this._y = 400; this.speedY = -this.speedY * ELASTICITY; } } function drag( ) { // When the user clicks on a clip, make it draggable // and stop animating it via onEnterFrame. this.startDrag( ); delete this.onEnterFrame; // We could save a function call by using the following: // this.onMouseMove = updateAfterEvent; // because the onMouseMove( ) handler calls only one function. // However, we use the following function definition in case // you want to add extra features, such as range checking // to prevent clips from being dragged off stage. this.onMouseMove = function( ) { updateAfterEvent( ); }; } function drop( ) { // Initialize the drop animation and // stop the clip being draggable. // The initial y velocity is zero. this.speed.y = 0; this.stopDrag( ); this.onEnterFrame = fall; } // MAIN CODE // Create 20 ball clips for (var i = 0; i < 20; i++) { var ball:MovieClip = this.createEmptyMovieClip("ball" + i, i); ball.lineStyle(6, 0x0, 100); ball.moveTo(0, -3); ball.lineTo(1, -3); ball._x = Math.random( ) * 550; ball._y = Math.random( ) * 200; ball.speedY = 0; ball.onEnterFrame = fall; ball.onPress = drag; ball.onRelease = ball.onReleaseOutside = drop; } //Initialize physical constants var GRAVITY:Number = 0.5; var FRICTION:Number = 0.995; var ELASTICITY:Number = 0.85; // Draw the ground line this.lineStyle(0, 0xDDDDDD, 100); this.moveTo(0, 400); this.lineTo(550, 400);
[perl] Md5 hash site cracker HTML: #!/usr/bin/perl use Digest::MD5 qw(md5_hex); use LWP::Simple qw($ua get); $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.4'); use strict; sub trim($){ my $string = shift; my $string =~ s/^\s+//; my $string =~ s/\s+$//; return $string; } my $proxy = ""; sub getcracked($){ my $hash = $_[0]; my $cracked; my %h_sites; my %h_regexes; $h_sites{"md5-db.com"} = "search.php?hash=$hash"; $h_sites{"alimamed.pp.ru"} = "md5/?md5e=&md5d=$hash"; $h_sites{"md5.rednoize.com"} = "?p&s=md5&q=$hash"; $h_sites{"gdataonline.com"} = "qkhash.php?mode=txt&hash=$hash"; $h_sites{"ice.breaker.free.fr"} = "md5.php?hash=$hash"; $h_sites{"md5.xpzone.de"} = "?string=$hash&mode=decrypt"; $h_regexes{"md5-db.com"} = "<ul><li>\"(.*?)\"<\/li><\/ul> <\/span>"; $h_regexes{"alimamed.pp.ru"} = "<b>(.*?)<\/b><br>"; $h_regexes{"md5.rednoize.com"} = "(.+)"; $h_regexes{"gdataonline.com"} = "<b>(.*?)<\/b><\/td><\/tr>"; $h_regexes{"ice.breaker.free.fr"} = "<b><br><br> - (.*?)<br><br><br>"; $h_regexes{"md5.xpzone.de"} = "Code: <b>(.*?)<\/b><br>"; foreach my $key(keys %h_sites){ #print "[+] CHECKING\tSITE: $key \n\t\tSCRIPT: $h_sites{$key}\n\t\tREGEX: $h_regexes{$key}\n"; print "[+] CHECKING\tSITE: $key\n"; if($cracked==1){ last; } else{ my $con = HTTP::Request->new(GET => $proxy . "http://$key/$h_sites{$key}"); $con->header(Accept => 'text/xml,application/xml,application/xhtml+xml,text/html'); my $content = $ua->request($con); if ($content->is_success) { if($content->content =~ m/$h_regexes{$key}/i){ if(md5_hex($1) eq $hash){ print "[+] Found match $hash - $1\n\n"; return $1; $cracked=1; } else{ return 0; } } } else { print $content->status_line . "\n"; } } } if($cracked==0){#No GET sites cracked our hash, move onto POST return &postcracked($hash); } } sub postcracked{ my $hash = $_[0]; my $cracked; my %h_sites; my %h_regexes; my %h_posts; $h_sites{"md5decrypter.com/"} = "hash=$hash&submit=Decrypt%21"; $h_sites{"md5encryption.com/?mod=decrypt"} = "hash2word=$hash"; $h_sites{"hashreverse.com/index.php?action=view"} = "hash=$hash&Submit2=Search+for+a+SHA1+or+MD5+hash"; $h_sites{"securitystats.com/tools/hashcrack.php"} = "inputhash=$hash&type=MD5&Submit=Submit"; $h_sites{"hashchecker.com/index.php"} = "search_field=$hash&Submit=search"; $h_sites{"md5crack.it-helpnet.de/index.php?op=search"} = "md5=$hash"; $h_sites{"mmkey.com/md5/home.asp?action=look"} = "md5text=$hash&look=+FIND+"; #Slow $h_regexes{"md5decrypter.com/"} = "<b class='red'>Normal Text: <\/b>(.*?)\n<br\/><br\/>"; $h_regexes{"md5encryption.com/?mod=decrypt"} = "<b>Decrypted Word:<\/b> (.*?)<br \/>"; $h_regexes{"hashreverse.com/index.php?action=view"} = "Following results were found:<br><ul><li>(.*?)<\/li><\/ul>"; $h_regexes{"securitystats.com/tools/hashcrack.php"} = "<BR>$hash = (.*?)<\/td>"; $h_regexes{"hashchecker.com/index.php"} = "<li>$hash is <b>(.*?)<\/b>"; $h_regexes{"md5crack.it-helpnet.de/index.php?op=search"} = "<td>$hash<\/td><td>(.*?)<\/td><\/tr><\/table>"; $h_regexes{"mmkey.com/md5/home.asp?action=look"} = "<input size=\"40\" name=\"rs2\" value=\"(.*?) #Slow \" color=\"red\">"; foreach my $key(keys %h_sites){ if($cracked==1){ last; } else{ #print "[+] CHECKING\tSITE: $key \n\t\tPOST: $h_sites{$key}\n\t\tREGEX: $h_regexes{$key}\n"; print "[+] CHECKING\tSITE: $key\n"; my $con = HTTP::Request->new(POST => $proxy . "http://" . $key); $con->content_type('application/x-www-form-urlencoded'); $con->content($h_sites{$key}); my $content = $ua->request($con); if ($content->is_success) { if($content->content =~ m/$h_regexes{$key}/i){ my $fhash = $1; if(md5_hex($fhash) eq $hash){ print "[+] Found match $hash - $fhash\n\n"; return $fhash; $cracked=1; } else{ print "\n$fhash\n\n"; } } } else{ print "[-] Error: " . $content->status_line . "\n"; } } } if($cracked==0){ return 0; } } sub usage{ print "USAGE: <user:hash list> <result list>\n"; print "EX: dump.txt finish.txt\n"; exit; } &usage unless @ARGV==2; my $hashlist = $ARGV[0]; my $resultlist = $ARGV[1]; open("zile", $hashlist) || die "Couldn't open file\n"; my @lines=<zile>; close("zile"); chomp(@lines); foreach my $line(@lines){ if($line =~ m/^(.*?):([a-f0-9]{32})$/i){ print "[+] Cracking $1 with $2\n"; print "Username: $1\nHash: $2\n\n"; my $cracky = &getcracked("$2"); if($cracky){ open(LOG,">>$resultlist"); print LOG "$1:$cracky\n"; close(LOG); } else{ print "[-] Didn't find match\n"; } } else{ print "$line doesn't match user:md5\n"; } } Code: USAGE: <user:hash list> <result list> EX: dump.txt finish.txt
Не нашёл темы "скрипты от скуки", решил запостить сюда. Вобщем написал карточную игру типо блекджека. Короче получилось русское народное очко. Вышло прикольно. Работает на сессиях =) PHP: <?php session_start(); function rand_card() { if(!$_SESSION['cards_a']) { $array = array(); } elseif(!$_SESSION['cards_b']) { $array = $_SESSION['cards_a']; } else { $array = array_merge($_SESSION['cards_a'], $_SESSION['cards_b']); } $rand_one = rand(2, 11); $rand_two = rand(1, 4); if(!in_array(array($rand_one, $rand_two), $array) && $rand_one != 5) { return array($rand_one, $rand_two); } else { return rand_card(); } } function session_kill($a = false) { $_SESSION['cards_a'] = ''; $_SESSION['cards_b'] = ''; if($a) { $_SESSION['good'] = ''; $_SESSION['bad'] = ''; } } if($_SERVER['QUERY_STRING'] == 'clear_score') { session_kill(true); } if(!$_SESSION['good']) { $_SESSION['good'] = 0; } if(!$_SESSION['bad']) { $_SESSION['bad'] = 0; } echo('<title>Двадцать одно</title>'); $array = rand_card(); if($_SERVER['QUERY_STRING'] != 'stop' || !$_SESSION['cards_a']) { $_SESSION['cards_a'][] = $array; } $all = array( 2 => 'Валет', 3 => 'Дама', 4 => 'Король', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10', 11 => 'Туз' ); echo('<table><tr>'); $sum_a = 0; foreach($_SESSION['cards_a'] as $card) { $sum_a += $card[0]; echo('<td><img src="img/'.$card[0].'/'.$card[1].'.bmp" /><br><div align="center"><b>'.$all[$card[0]].'</b></div></td>'); } echo('</tr></table><br>Ваши очки: <b>'.$sum_a.'</b><br>'); if($sum_a > 21) { echo('Вы проиграли (<b>Перебор</b>)<br><a href="'.$_SERVER['PHP_SELF'].'">Назад</a>'); $_SESSION['bad']++; session_kill(); } elseif($_SERVER['QUERY_STRING'] != 'stop') { echo('<a href="'.$_SERVER['PHP_SELF'].'">Ещё</a> | <a href="'.$_SERVER['PHP_SELF'].'?stop">Хватит</a>'); } else { $array = rand_card(); $_SESSION['cards_b'][] = $array; echo('<br><table><tr>'); $sum_b = 0; foreach($_SESSION['cards_b'] as $card) { $sum_b += $card[0]; echo('<td><img src="img/'.$card[0].'/'.$card[1].'.bmp" /><br><div align="center"><b>'.$all[$card[0]].'</b></div></td>'); } echo('</tr></table><br>Очки компьютера: <b>'.$sum_b.'</b><br>'); if($sum_b > $sum_a && $sum_b <= 21) { echo('Вы проиграли<br><a href="'.$_SERVER['PHP_SELF'].'">Назад</a>'); $_SESSION['bad']++; session_kill(); } elseif($sum_b > 21) { echo('Вы выиграли (<b>Перебор</b>)<br><a href="'.$_SERVER['PHP_SELF'].'">Назад</a>'); $_SESSION['good']++; session_kill(); } elseif(($sum_a == 21 && $sum_b == 21) || ($sum_a == 20 && $sum_b == 20)) { echo('Ничья<br><a href="'.$_SERVER['PHP_SELF'].'">Назад</a>'); session_kill(); } else { echo('<META HTTP-EQUIV="Refresh" CONTENT="2; URL='.$_SERVER['PHP_SELF'].'?stop">'); } } echo('<div style="position: absolute; top: 5%; right: 5%;"><table width="200"><td>Побед:</td><td><b>'.$_SESSION['good'].'</b></td></tr><tr><td>Проигрышей:</td><td><b>'.$_SESSION['bad'].'</b></td></tr></table><div align="center"><a href="'.$_SERVER['PHP_SELF'].'?clear_score">Очистить счёт</a></div></div>'); ?> Картинки брать отсюда. Вот пример скрипта. Так сказать - игра с компом.
Скрипт рандомно выводит разные картинки в подписи... PHP: <?php $directory = 'sig'; $dir = opendir($directory); while($file = readdir($dir)) { if ($file != "." && $file != "..") { $sig[] = $file; } } $sigs = count($sig) - 1; $random = rand(0, $sigs); $jpg = $png = $gif = (substr($sig[$random], -3)) ? '1' : ''; $jpeg = (substr($sig[$random], -4)) ? '1' : ''; if ($sigs < 0) { echo 'Empty directory '.$directory.'<br/>Please upload image files'; } if (substr($sig[$random], -3) == "jpg" || substr($sig[$random], -4) == "jpeg") { header('Content-type: image/jpeg'); $tmp = file_get_contents($directory."/".$sig[$random]); $img = base64_encode($tmp); echo base64_decode($img); } else if (substr($sig[$random], -3) == "png") { header('Content-type: image/png'); $tmp = file_get_contents($directory."/".$sig[$random]); $img = base64_encode($tmp); echo base64_decode($img); } else if (substr($sig[$random], -3) == "gif") { header('Content-type: image/gif'); $tmp = file_get_contents($directory."/".$sig[$random]); $img = base64_encode($tmp); echo base64_decode($img); } else { echo 'Only filetype gif, jpg, jpeg, png'; } ?>
Грабер из сайта kanicq.ru для проверки номера на инвиз. Работает через аномайзер webwarper.net Использует curl PHP: <?php $new = '123456789'; // номер $cr=curl_init("http://webwarper.net/ww/~av/kanicq.ru/invisible/?method=2"); curl_setopt($cr, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)"); curl_setopt($cr, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); curl_setopt($cr, CURLOPT_TIMEOUT, 20); curl_setopt($cr, CURLOPT_HEADER, 1); curl_setopt($cr, CURLOPT_POSTFIELDS, "human=1&uin=$new&youwereadded=on&uin4login=&password4login="); curl_setopt($cr, CURLOPT_RETURNTRANSFER, 1); curl_setopt($cr, CURLOPT_REFERER, "http://icq-online.ru"); $r = curl_exec($cr); curl_close($cr); $s = "echo '$r'"; if ( preg_match ("/Free for chat/i" , "$s")) { $status = "Готов к общению"; } elseif ( preg_match ("/Online/i" ,"$s")) { $status = "Онлайн"; } elseif ( preg_match ("/Away/i" , "$s")) { $status = "Отошел"; } elseif ( preg_match ("/N\/A/i" , "$s")) { $status = "Недоступен"; } elseif ( preg_match ("/Occupied/i" , "$s")) { $status = "Занят"; } elseif ( preg_match ("/DND/i" , "$s")) { $status = "Не беспокоить"; } elseif ( preg_match ("/offline/i" , "$s")) { $status = "Оффлайн"; } elseif ( preg_match ("/status\/invisible/i" , "$s")) { $status = "Невидимый"; } else { $status = "Ошибка"; } echo "UIN: $new<br>Статус: $status<br>"; ?>
Озадачился на днях генерацией словарика, содержащий только даты за определенный период. Также используются разные разделители, например, дата 2007.12.31: Code: 20071231 2007/12/31 31.12.07 и т.д. Набросал скриптик на перле, который просит 2 даты начальную и конечную. Так как мне влом было читать маны (перлдоки ) по модулям Date, взял за основу алгоритм вычисления юлианского дня из астрономии (тем более уже был код, тока на паскале =) ). Вот сам код: Code: #!/usr/bin/perl $argc = $#ARGV + 1; &usage () unless ($argc == 2); use Julian; use lib "."; %mon = ( "01" => "january", "02" => "february", "03" => "march", "04" => "april", "05" => "may", "06" => "june", "07" => "july", "08" => "august", "09" => "september", "10" => "october", "11" => "november", "12" => "december" ); ($year1, $month1, $day1) = &prepare_date ($ARGV[0]); die "Error in date: $ARGV[0]\n" if (!defined $year1 || !defined $month1 || !defined $day1); $startdate = $date = &Date2Julian ($year1, $month1, $day1, 0); ($year2, $month2, $day2) = &prepare_date ($ARGV[1]); die "Error in date: $ARGV[1]\n" if (!defined $year2 || !defined $month2 || !defined $day2); $enddate = &Date2Julian ($year2, $month2, $day2, 0); @sep = ("", ".", "/", "\\", "-", ":", ","); $sep_cnt = $#sep + 1; while ($date <= $enddate) { @dat = Julian2Date ($date); $dat[1] = "0" . $dat[1] if ($dat[1] < 10); $dat[2] = "0" . $dat[2] if ($dat[2] < 10); for ($i = 0; $i < $sep_cnt; $i++) { # YYYYMMDD print $dat[0] . $sep[$i] . $dat[1] . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . substr ($mon{$dat[1]}, 0, 3) . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . uc (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . ucfirst (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . $mon{$dat[1]} . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . uc ($mon{$dat[1]}) . $sep[$i] . $dat[2] . "\n"; print $dat[0] . $sep[$i] . ucfirst ($mon{$dat[1]}) . $sep[$i] . $dat[2] . "\n"; # DDMMYYYY print $dat[2] . $sep[$i] . $dat[1] . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . substr ($mon{$dat[1]}, 0, 3) . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . uc (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . ucfirst (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . $mon{$dat[1]} . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . uc ($mon{$dat[1]}) . $sep[$i] . $dat[0] . "\n"; print $dat[2] . $sep[$i] . ucfirst ($mon{$dat[1]}) . $sep[$i] . $dat[0] . "\n"; # DDMMYY $dd = substr ($dat[0], 2, 2); print $dat[2] . $sep[$i] . $dat[1] . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . substr ($mon{$dat[1]}, 0, 3) . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . uc (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . ucfirst (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . $mon{$dat[1]} . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . uc ($mon{$dat[1]}) . $sep[$i] . $dd . "\n"; print $dat[2] . $sep[$i] . ucfirst ($mon{$dat[1]}) . $sep[$i] . $dd . "\n"; # YYMMDD print $dd . $sep[$i] . $dat[1] . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . substr ($mon{$dat[1]}, 0, 3) . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . uc (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . ucfirst (substr ($mon{$dat[1]}, 0, 3)) . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . $mon{$dat[1]} . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . uc ($mon{$dat[1]}) . $sep[$i] . $dat[2] . "\n"; print $dd . $sep[$i] . ucfirst ($mon{$dat[1]}) . $sep[$i] . $dat[2] . "\n"; } $date++; } exit 0; sub usage () { print "Usage: $0 [start_date [end_date]]\n"; print " ex.: $0 1999/08/11\n"; print " : $0 1960/01/01 2002/12/31\n"; exit 0; } sub prepare_date ($) { my ($date_str) = @_; my ($year, $month, $day); ($year, $month, $day) = split (/\//, $date_str); $year =~ s/[^\d]+//g if ($year =~ /[^\d]/); $month =~ s/[^\d]+// if ($month =~ /[^\d]/); $day =~ s/[^\d]+// if ($day =~ /[^\d]/); $year = substr ($year, 0, 4) if (length ($year) > 4); $month = substr ($month, 0, 2) if (length ($month) > 2); $day = substr ($day, 0, 2) if (length ($day) > 2); $year =~ s/^0+// if ($year =~ /^0/); $month =~ s/^0// if ($month =~ /^0/); $day =~ s/^0// if ($day =~ /^0/); return undef if (($month < 1) || $month > 12); return undef if (($day < 1) || $day > 31); return ($year, $month, $day); } код функций Date2Julian и Julian2Date вынес в отдельный пакет Julian.pm Code: package Julian; use strict; use vars qw (@EXPORT @ISA $VERSION); require Exporter; $VERSION = "0.1"; @ISA = qw (Exporter); @EXPORT = qw (Date2Julian Julian2Date); #-----------------------------------------------------------------------# # Date2Julian: Julian Date # # The routine is valid for any date since 4713 BC. # # Julian calendar is used up to 1582 October 4, # # Gregorian calendar is used from 1582 October 15 onwards. # #-----------------------------------------------------------------------# sub Date2Julian ($$$$) { my ($year, $month, $day, $hour) = @_; my ($A, $B, $jd); $A = 10000.0 * $year + 100.0 * $month + $day; if ($month <= 2) { $month += 12; $year--; } if ($A <= 15821004.1) { $B = -2 + int (($year + 4716) / 4) - 1179; } else { $B = int ($year / 400) - int ($year / 100) + int ($year / 4); } $A = 365 * $year - 679004.0; $jd = $A + $B + int (30.6001 * ($month + 1)) + $day + $hour / 24.0; return $jd + 2400000.5; } #---------------------------------------------------------------------------# # Julian2Date: Finds the civil calendar date for a given value # # of the Julian Date (JD). # # Julian calendar is used up to 1582 October 4, # # Gregorian calendar is used from 1582 October 15 onwards. # #---------------------------------------------------------------------------# sub Julian2Date ($) { my ($jd) = @_; my ($day, $month, $year, $hour); my ($B, $D, $F); my ($jd0, $C, $E, @dat); $jd0 = int ($jd + 0.5); if ($jd0 < 2299161.0) # calendar { $C = $jd0 + 1524.0; # -> Julian } else # -> Gregorian { $B = int (($jd0 - 1867216.25) / 36524.25); $C = $jd0 + ($B - int ($B / 4)) +1525.0; } $D = int (($C - 122.1) / 365.25); $E = 365.0 * $D + int ($D / 4); $F = int (($C - $E) / 30.6001); $day = int ($C - $E + 0.5) - int (30.6001 * $F); $month = $F - 1 - 12 * int ($F / 14); $year = $D - 4715 - int ((7 + $month) / 10); $hour = 24.0 * ($jd + 0.5 - $jd0); @dat = ($year, $month, $day, $hour); return @dat; } При использовании года в формате YY (две последние цифры года) и при охвате периода более ста лет в словаре возможны повторения. Возможно, скриптик будет полезен кому-нить.
Поможет выставить права PHP: <script language="JavaScript"> <!-- /* chmod helper, Version 1.0 * by Dan Kaplan <[email protected]> * Last Modified: May 24, 2001 * -------------------------------------------------------------------- * Inspired by 'Chmod Calculator' by Peter Crouch: * http://wsabstract.com/script/script2/chmodcal.shtml * * USE THIS LIBRARY AT YOUR OWN RISK; no warranties are expressed or * implied. You may modify the file however you see fit, so long as * you retain this header information and any credits to other sources * throughout the file. If you make any modifications or improvements, * please send them via email to Dan Kaplan <[email protected]>. * -------------------------------------------------------------------- */ function do_chmod(user) { var field4 = user + "4"; var field2 = user + "2"; var field1 = user + "1"; var total = "t_" + user; var symbolic = "sym_" + user; var number = 0; var sym_string = ""; if (document.chmod[field4].checked == true) { number += 4; } if (document.chmod[field2].checked == true) { number += 2; } if (document.chmod[field1].checked == true) { number += 1; } if (document.chmod[field4].checked == true) { sym_string += "r"; } else { sym_string += "-"; } if (document.chmod[field2].checked == true) { sym_string += "w"; } else { sym_string += "-"; } if (document.chmod[field1].checked == true) { sym_string += "x"; } else { sym_string += "-"; } if (number == 0) { number = ""; } document.chmod[total].value = number; document.chmod[symbolic].value = sym_string; document.chmod.t_total.value = document.chmod.t_owner.value + document.chmod.t_group.value + document.chmod.t_other.value; document.chmod.sym_total.value = "-" + document.chmod.sym_owner.value + document.chmod.sym_group.value + document.chmod.sym_other.value; } //--> </script> <form name="chmod"> <p><table cellpadding="0" cellspacing="0" border="0" bgcolor="#03075D"><tr><td width="100%" valign="top"><table width="100%" cellpadding="5" cellspacing="2" border="0"><tr><td width="100%" bgcolor="#52847B" align="center" colspan="5"><font color="#ffffff" size="3"><b>chmod (File Permissions) helper</b></font></td></tr> <tr bgcolor="#bcbcbc"> <td align="left"><b>Permission</b></td> <td align="center"><b>Owner</b></td> <td align="center"><b>Group</b></td> <td align="center"><b>Other</b></td> <td bgcolor="#dddddd" rowspan="4">*</td> </tr><tr bgcolor="#dddddd"> <td align="left" nowrap><b>Read</b> (r = 4)</td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner4" value="4" onclick="do_chmod('owner')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group4" value="4" onclick="do_chmod('group')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other4" value="4" onclick="do_chmod('other')"></td> </tr><tr bgcolor="#dddddd"> <td align="left" nowrap><b>Write</b> (w=2)</td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner2" value="2" onclick="do_chmod('owner')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group2" value="2" onclick="do_chmod('group')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other2" value="2" onclick="do_chmod('other')"></td> </tr><tr bgcolor="#dddddd"> <td align="left" nowrap><b>Execute</b> (x=1)</td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="owner1" value="1" onclick="do_chmod('owner')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="group1" value="1" onclick="do_chmod('group')"></td> <td align="center" bgcolor="#ffffff"><input type="checkbox" name="other1" value="1" onclick="do_chmod('other')"></td> </tr><tr bgcolor="#dddddd"> <td align="right" nowrap>Octal:</td> <td align="center"><input type="text" name="t_owner" value="" size="1"></td> <td align="center"><input type="text" name="t_group" value="" size="1"></td> <td align="center"><input type="text" name="t_other" value="" size="1"></td> <td align="left"><b>=</b> <input type="text" name="t_total" value="" size="3"></td> </tr><tr bgcolor="#dddddd"> <td align="right" nowrap>Symbolic:</td> <td align="center"><input type="text" name="sym_owner" value="" size="3"></td> <td align="center"><input type="text" name="sym_group" value="" size="3"></td> <td align="center"><input type="text" name="sym_other" value="" size="3"></td> <td align="left"><b>=</b> <input type="text" name="sym_total" value="" size="10"></td> </tr><tr bgcolor="#dddddd"><td colspan="5" align="center"> <font face="Arial" size="1">Provided free by <a href="http://abledesign.com/programs/" target="_blank">AbleDesign</a>, inspired by <a href="http://wsabstract.com/script/script2/chmodcal.shtml" target="_blank">Chmod Calculator</a></font> </td></tr> </table></td></tr></table></p> </form> копирайты в сырце
Вобщем как обычно делать нечего. PHP: <?php session_start(); echo('<title>Магический квадрат</title><style>a.mag:link, a.mag:hover, a.mag:active, a.mag:visited { color: Green; font-size: 90px; text-decoration: none; } </style>1. Задумайте любое двухзначное число. <br>2. Вычтите из него составляющие его цифры (например, из числа 54 надо вычесть 5 и 4, получится 45). <br>3. Найдите это число в таблице и символ, которому оно соответствует. <br>4. Вообразите мысленно себе этот символ. <br>5. Щелкните по квадрату.<br>'); function next_step() { if($_SESSION['symbol'] && $_SERVER['QUERY_STRING'] == 'continue') { return true; } else { return false; } } if(!next_step()) { echo('<table align="center"><a href="'.$_SERVER['PHP_SELF'].'?continue"><div style="background: #000000; width: 100; height: 100;"></div></a></table><br><table width="500" align="center" style="font-size: 18px;"><tr>'); $array = array(0, 9, 18, 27, 36, 45, 54, 63, 72, 81); $symbols = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz<>^&*_+?!~'; $number = $symbols{rand(0,strlen($symbols)-1)}; $_SESSION['symbol'] = $number; function getsym() { global $number, $symbols; $symbol = $symbols{rand(0,strlen($symbols)-1)}; if($symbol == $number) { return getsym(); } else { return $symbol; } } for($i = 99; $i >= 0; $i--) { echo('<td>'.$i.'</td><td>-</td><td><b style="color: YellowGreen;">'); if(in_array($i, $array)) { echo $number; } else { echo getsym(); } echo('</b></td>'); if(($i / 10) == round(($i / 10)) && $i != 0) { echo('</tr><tr>'); } } echo('</tr></td></table><br><div align="center">Для продолжения нажмите на чёрный квадрат.</div>'); } else { echo('<table align="center"><a class="mag" href="'.$_SERVER['PHP_SELF'].'"><div style="background: #000000; width: 100; height: 100; text-align: center;">'.$_SESSION['symbol'].'</div></a></table><div align="center">Это он? <a href="'.$_SERVER['PHP_SELF'].'">Заново</a>.</div>'); } ?> Не забудьте убрать лишние пробелы из скрипта, созданные форумом. Вот пример.
Скрипт позволяет перевести перевести информацию полученую из information schema в удобночитаемое состояние PHP: <?php if (!@$_POST['data']) { ?> <form action="prodom.php" method="post"> <textarea style="border:2px solid #6F9F3B;" cols="100" rows="7" name="data"/><br/> <input style="border:1px solid #6F9F3B;background-color:#FFAD1F;font-weight:bold;" type="submit" value="send"/> </form> <?php } $content = explode("\n", @$_POST['data']); for ($i = 0; $i <= count($content); $i++) { list($table, $column) = explode(":", $content[$i]); { $array[$table][] = $column; } } echo "<table width=100% border=1 cellpadding=0 cellspacing=0>"; foreach ($array as $table => $column) { if ($num == 1) echo "<tr>"; if ($key != '') { echo "<td valign=top width=33%><span style=color:red;font-weight:bold;>$table</span><br/>"; $num ++; } foreach ($column as $array) { if ($array != '') { echo $array; echo "<br/>"; } } echo "</td>"; if ($num == 3) { echo "</tr>"; $num = 1; } } ?> </table>
Скрипт для расшифровки MD5 PHP: # Perl # Md5 MultiCracker # Author : Cod3rZ # Usage : perl md5.pl [hash] # Usage: perl md5.pl 27d34b40d7adafe2e00c3503543e0ca9 # Thanks to GrabberGhost use LWP::UserAgent; use HTTP::Request::Common; system("cls"); print q{ --------------------------------------------------------------------- :: Md5 MultiCracker :: --------------------------------------------------------------------- Author : Cod3rZ Email : songforthemoment@yahoo.it Site : http://cod3rz.helloweb.eu --------------------------------------------------------------------- }; $hash = $ARGV[0]; chomp($hash); if(!$hash) { print q{ Usage: perl md5.pl [hash] Usage: perl md5.pl 27d34b40d7adafe2e00c3503543e0ca9 --------------------------------------------------------------------- }; } else { $lwp = LWP::UserAgent->new; #Milw0rm $ua = $lwp->request(POST 'http://www.milw0rm.com/cracker/search.php', [ hash => "$hash", Submit => 'Submit', ]); @content = split(/[n]/, $ua->content); @password = split( /[><]/, $content[46]); if($password[1]) { print " Password cracked: $password[1] \n ---------------------------------------------------------------------"; } else { #Rednoize $red = $lwp->request(GET 'http://md5.rednoize.com/?p&s=md5&q='.$hash); $content = $red->content; if($content) { print " Password cracked : $content \n ---------------------------------------------------------------------"; } else { #GdataOnline $gdo = $lwp->request(GET 'http://gdataonline.com/qkhash.php?mode=xml&hash='.$hash); @content = split(/<result>/, $gdo->content); @password = split( /[><]/, $content[1]); if(@password[0]) { print " Password cracked: @password[0]\n ---------------------------------------------------------------------"; } else { print " Password Not Cracked\n ---------------------------------------------------------------------"; } } } }
Написал покер с игральными костями! PHP: <?php session_start(); if(!$_SESSION['wins'] || $_SERVER['QUERY_STRING'] == 'clear_score'){$_SESSION['wins'] = 0;} if(!$_SESSION['lose'] || $_SERVER['QUERY_STRING'] == 'clear_score'){$_SESSION['lose'] = 0;} error_reporting(0); if(!function_exists('str_split')) { function str_split($string) { $array = array(); for($i=0;$i<strlen($string);$i++) { $array[] = $string{$i}; } return $array; } } function check($array) { $count = array_count_values($array); $count2 = array_count_values($count); if(max($count) == 2) { if($count2[2] == 1) { return 1; } elseif($count2[2] == 2) { return 2; } } elseif(max($count) == 3) { if($count2[3] == 1 && $count2[2] == 1) { return 6; } else { return 3; } } elseif(max($count) == 4) { return 7; } elseif(max($count) == 5) { return 8; } elseif(in_array(1, $array) && in_array(2, $array) && in_array(3, $array) && in_array(4, $array) && in_array(5, $array)) { return 4; } elseif(in_array(2, $array) && in_array(3, $array) && in_array(4, $array) && in_array(5, $array) && in_array(6, $array)) { return 5; } else { return 0; } } echo("<title>Покер с игральными костями</title><style>body{background:url(img/bones/bg.PNG);color:#F26522;}a:link,a:hover,a:active,a:visited{color:#F26522;}</style>"); if($_SERVER['QUERY_STRING'] != 'next') { echo("<body><script>function kill(id){document.getElementById('text').value += id; document.getElementById('i_'+id).innerHTML = ''; document.getElementById('subm').value = 'Перебросить';}</script><font size=2>*Кликните по тем костям, которые вы хотите перебросить</font><br>"); } if(!$_SESSION['bones_a']) { $_SESSION['bones_a'] = array(rand(1,6), rand(1,6), rand(1,6), rand(1,6), rand(1,6)); } elseif($_POST['what']) { $split = str_split($_POST['what']); foreach($split as $delete) { unset($_SESSION['bones_a'][($delete-1)]); } $_SESSION['bones_a'] = array_values($_SESSION['bones_a']); for($i=0;$i<count($split);$i++) { $_SESSION['bones_a'][] = rand(1,6); } } $count = array_count_values($_SESSION['bones_a']); $count2 = array_count_values($count); $array = array(0 => 'шанс', 1 => 'одна пара', 2 => 'две пары', 3 => 'тройка', 4 => 'малый стрит', 5 => 'большой стрит', 6 => 'фулл хаус', 7 => 'каре', 8 => 'покер'); echo('<table><tr>'); foreach($_SESSION['bones_a'] as $i => $bone) { echo('<td>'); if($_SERVER['QUERY_STRING'] != 'next') { echo('<a id="i_'.($i+1).'" href="#" onclick="kill('.($i+1).')">'); } echo('<img src="img/bones/'.$bone.'.png" width="125" border=0>'); if($_SERVER['QUERY_STRING'] != 'next') { echo('</a>'); } echo('<br></td>'); } echo('</tr></table>'); if($_SERVER['QUERY_STRING'] != 'next') { echo('<form method="POST" action="'.$_SERVER['PHP_SELF'].'?next"><input type="hidden" id="text" name="what"><br><input id="subm" type="submit" value="Не перебрасывать"></form>'); } echo('<br><br>У вас '); echo('<b>'.$array[check($_SESSION['bones_a'])].'</b>.'); if($_SERVER['QUERY_STRING'] == 'next') { if(!$_SESSION['bones_b']) { $_SESSION['bones_b'] = array(rand(1,6), rand(1,6), rand(1,6), rand(1,6), rand(1,6)); } else { $just = true; $k = 0; $count = array_count_values($_SESSION['bones_b']); if(check($_SESSION['bones_b']) == 1 || check($_SESSION['bones_b']) == 2) { foreach($_SESSION['bones_b'] as $i => $bon) { if($count[$bon] != 2) { $k++; unset($_SESSION['bones_b'][$i]); } } } elseif(check($_SESSION['bones_b']) == 3) { foreach($_SESSION['bones_b'] as $i => $bon) { if($count[$bon] != 3) { $k++; unset($_SESSION['bones_b'][$i]); } } } elseif(check($_SESSION['bones_b']) == 4) { foreach($_SESSION['bones_b'] as $i => $bon) { if($count[$bon] != 4) { $k++; unset($_SESSION['bones_b'][$i]); } } } elseif(check($_SESSION['bones_b']) == 0) { $k = 5; $_SESSION['bones_b'] = array(); } $_SESSION['bones_b'] = array_values($_SESSION['bones_b']); for($i=0;$i<$k;$i++) { $_SESSION['bones_b'][] = rand(1,6); } } echo('<br><br><table><tr>'); foreach($_SESSION['bones_b'] as $bone) { echo('<td><img src="img/bones/'.$bone.'.png" width="125" border=0><br></td>'); } echo('</tr></table><br><br>У компьютера <b>'.$array[check($_SESSION['bones_b'])].'</b>.<br>'); if(check($_SESSION['bones_b']) > check($_SESSION['bones_a'])) { $end = true; echo('<font size=4><b>Вы проиграли.</b></font>'); $_SESSION['lose']++; } elseif(!$just) { echo('Перебрасывает'); echo('<meta http-equiv="refresh" content="2; url='.$_SERVER['PHP_SELF'].'?next">'); } else { $end = true; if(check($_SESSION['bones_a']) > check($_SESSION['bones_b'])) { echo('<font size=4><b>Вы выиграли.</b></font>'); $_SESSION['wins']++; } else { echo('<font size=4><b>Ничья.</b></font>'); } } if($end) { echo('<br><br><a href="'.$_SERVER['PHP_SELF'].'">Ещё раз</a>.'); unset($_SESSION['bones_a']); unset($_SESSION['bones_b']); } } echo('<div style="position: absolute; top: 5%; right: 5%;"><table width="200"><td>Побед:</td><td><b>'.$_SESSION['wins'].'</b></td></tr><tr><td>Проигрышей:</td><td><b>'.$_SESSION['lose'].'</b></td></tr></table><div align="center"><a href="'.$_SERVER['PHP_SELF'].'?clear_score">Очистить счёт</a></div></div></body>'); ?> Картинки от игры здесь. Вот пример скрипта. Обновление 9 февраля.
Вот и я игрушку сочинил. Правда на джаваскрипте: PHP: <html> <head> <title>CheckFormGame</title> <style type="text/css"> body { padding:10px; background:#2A2E33; font-family:tahoma, verdana, arial; font-size:11px; text-align:center; color: green; } table { border-spacing: 0; margin:0 auto; border-collapse: collapse; } td:hover { background:#4D525C; } td { padding:3px; border-top:1px solid #2A2E33; border-left:1px solid #2A2E33; text-align:left; font-size:12px; color:#B9B9BD; background:#363940; } td b { color:#ccc; } a { text-decoration:none; color:#ccc; } input, select, textarea { vertical-align:middle; margin:1px 0; padding-right:10px; border:1px solid #336600; padding:2px; background:#363940; color:#B9B9BD; } .post { padding:10px; font-family:tahoma, verdana, arial; font-size:11px; border: 1px solid black; } .dArrow { float:right; font-size:14px; font-weight:normal; margin:0px 5px 0px 0px; } .dArrow a { border: 1px solid #DAE2E8; line-height:25px; background-color:#fff; padding:0px 6px 3px 6px; } .dArrow a:hover { text-decoration:none; border: 1px solid #45688E; } </style> </head> <body> <h1>CheckFormGame by Dimi4 for Antichat</h1> <h2>you have 20 seconds</h2> <SCRIPT LANGUAGE="JavaScript"> //greetz antichat ///coded dy dimi4 aka nf/ http://nfdesign.org.ua var total = 0 var play = false function display(element) { var now = new Date() if (!play) { play = true startTime = now.getTime() } if (now.getTime() - startTime > 20000) { element.checked = !element.checked return } if (element.checked) total++ else total-- element.form.num.value = total } function restart(form) { total = 0 play = false for (var i = 1; i <= 100; ++i) { form.elements[i].checked = false } } </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> document.write("<FORM><CENTER>") document.write('<INPUT TYPE="text" VALUE="0" NAME="num" SIZE=10 onFocus="this.blur()"><BR>') document.write("<HR SIZE=1 WIDTH=40%>") for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { document.write('<INPUT TYPE="checkbox" onClick="display(this)">') } document.write("<BR>") } document.write("<HR SIZE=1 WIDTH=40%>") document.write('<INPUT TYPE="button" VALUE="restart" onClick="restart(this.form)">') document.write("</CENTER></FORM>") // --> </SCRIPT> <pre> ____ .-'&'-. / \ : o o ; ( (_ ) : ; \ __ / `-._____.-' /`"""`\ / , \ /|/\/\/\ _\ (_|/\/\/\\__) |_______| __)_ |_ (__ (_____|_____)</pre> </body> </html> Потестить: http://nfdesign.org.ua/game.html
Финд вритабле директорис PHP: <?php //If open basedir is on, search the closest directory possible, otherwise search "/" //this will take a very long time to complete //define('path', ini_get('open_basedir') ? ini_get('open_basedir') : DIRECTORY_SEPARATOR); //One directory before the current directory: define('path', '..'); //Maximum number of directories to find (to save time) //define('maxdirs', 10); set_time_limit(0); $writable = array(); function finddir($d = path){ global $writable; if(defined('maxdirs')){ if(count(array_unique($writable)) >= maxdirs){ printout(); } } $tmp = array(); if($x = scandir($d)){ foreach($x as $y){ if(@is_dir($d . DIRECTORY_SEPARATOR . $y)){ if($y != ".." && $y != "."){ array_push($tmp, $y); $real = $d . DIRECTORY_SEPARATOR . $y; } } foreach($tmp as $t){ if(@is_writable($d . DIRECTORY_SEPARATOR . $t)){ array_push($writable, $d . DIRECTORY_SEPARATOR . $t); } finddir($real); } } } } function printout(){ global $writable; ?><p><b>Writable directories:</b></p> <textarea rows=<?php echo(count(array_unique($writable))); ?> cols=50><?php echo(($writable ? implode("\n", array_unique($writable)) : "No writable directories found.") . "\n</textarea>"); die(); } finddir(); printout(); ?>