ANTICHAT.XYZ    VIDEO.ANTICHAT.XYZ    НОВЫЕ СООБЩЕНИЯ    ФОРУМ  
Баннер 1   Баннер 2
Antichat снова доступен.
Форум Antichat (Античат) возвращается и снова открыт для пользователей. Здесь обсуждаются безопасность, программирование, технологии и многое другое. Сообщество снова собирается вместе.
Новый адрес: forum.antichat.xyz
Вернуться   Форум АНТИЧАТ > Программирование > PHP, PERL, MySQL, JavaScript
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

  #501  
Старый 07.11.2008, 01:44
Аватар для D1mka
D1mka
Участник форума
Регистрация: 02.01.2008
Сообщений: 116
Провел на форуме:
1013405

Репутация: 58
По умолчанию

PHP код:
<?
set_time_limit
(0);

echo 
"
<form method=POST>
    <div align=center>
    <table cellpadding=0 cellspacing=0 width=242 id=table1 height=113 border=1>
        <tr>
            <td valign=top><span lang=en-us>Slil.ru</span></td>
            <td height=22 valign=top>
            <input type=radio value=slil checked name=s></td>
        </tr>
        <tr>
            <td valign=top><span lang=en-us>
            WebFile.ru</span></td>
            <td height=22 valign=top>
            <input type=radio name=s value=webfile></td>
        </tr>
        <tr>
            <td valign=top><span lang=en-us>
            Ifolder.ru</span></td>
            <td height=22 valign=top>
            <input type=radio name=s value=ifolder></td>
        </tr>

        <tr>
            <td valign=top><span lang=en-us>
            DepositFiles.com</span></td>
            <td height=22 valign=top>
            <input type=radio name=s value=depositfiles></td>
        </tr>
        <tr>
            <td valign=top>Сканить </td>
            <td height=22 valign=top>С&nbsp;&nbsp;<input type=text name=ot size=7> <br>До<input type=text name=do size=7></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td height=25 valign=top>
            <input type=submit value=Скан name=B1></td>
        </tr>
        <tr>
            <td width=87>&nbsp;</td>
            <td height=22 valign=top width=155>&nbsp;</td>
        </tr>
    </table>
    </div>
</form>
<hr>
"
;
echo 
"$s<br><br>";

if(
$ot=="" || $do==""){exit();}

if(
$s=="webfile"){
$c "1573042";
ob_flush();
flush();
for(
$i=$ot;$i<$do;$i++) {
$url "http://webfile.ru/$i";
$html=file_get_contents("$url");
preg_match("/\<font size=\"\+1\"\>\<b\>(.*?)\<\/b\>\<\/font\>/si"$html$text);
$fn=strip_tags($text[1],"");
$fn str_replace("","",$fn);
ob_flush();
flush();
if(
$fn==""){$fn="Eroor";}
echo 
"[<a target=_blank href=http://webfile.ru/$i>$i</a>:$fn]<br>\n\r";
ob_flush();
flush();
}
}

if(
$s=="slil"){
$c "25034857";
for(
$i=$ot;$i<$do;$i++) {
$url "http://slil.ru/$i";
$html=file_get_contents("$url");
preg_match("/Спасибо всем, кто помогает развивать ресурс(.*?)\закачка файла/si"$html$text);
$fn=strip_tags($text[1],"");
$fn str_replace("","",$fn);
ob_flush();
flush();
echo 
"[<a target=_blank href=http://slil.ru/$i>$i</a>:$fn]<br>\n\r";
ob_flush();
flush();
}
}

if(
$s=="ifolder"){
for(
$i=$ot;$i<$do;$i++) {
$url "http://ifolder.ru/$i";
$html=file_get_contents("$url");
preg_match("/\Название(.*?)\<\/b\>\<br\>/si"$html$text);
//print_r($text);
$fn=strip_tags($text[1],"");
ob_flush();
flush();
echo 
"[$i:$fn]<br>";
ob_flush();
flush();
}
}

if(
$s=="depositfiles"){
for(
$i=$ot;$i<$do;$i++) {
$url "http://depositfiles.com/ru/files/$i";
$html=file_get_contents("$url");
preg_match("/\Имя Файла: \<b title=\"(.*?)\"\>/si"$html$text);
$fn=strip_tags($text[1],"");
$fn str_replace("","",$fn);
ob_flush();
flush();

if(
$fn==""){$fn="Eroor";}
echo 
"[<a target=_blank href=$url>$i</a>:$fn]<br>\n\r";

}
}

?>
 
Ответить с цитированием

  #502  
Старый 13.11.2008, 14:39
Аватар для Ru}{eeZ
Ru}{eeZ
Постоянный
Регистрация: 19.02.2008
Сообщений: 438
Провел на форуме:
956872

Репутация: 186
Отправить сообщение для Ru}{eeZ с помощью ICQ
По умолчанию

Функция, генерирующая случайные буквы или цифры с заданным количеством символов.
Первый параметр функции gen() - количество символов, второй - буквы(1)/цифры(2).

PHP код:
<?php

gen
(3,1);

function 
gen($num$vari) {

for(
$i 0$i $num$i++) {
switch(
$vari) {
  case 
1:
    
$abc = array('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');
    echo 
$abc[mt_rand(0,9)];
  break;
  case 
2:
    echo 
mt_rand(0,9);
  break;
}}}

?>

Последний раз редактировалось Ru}{eeZ; 13.11.2008 в 14:48..
 
Ответить с цитированием

  #503  
Старый 15.11.2008, 22:59
Аватар для heretic1990
heretic1990
Постоянный
Регистрация: 02.07.2008
Сообщений: 472
Провел на форуме:
3728999

Репутация: 444
По умолчанию

скрипт показывает Координаты мыши

Код:
<form name="Show">
X <input type="text" name="MouseX" value="0" size="4"><br>
Y <input type="text" name="MouseY" value="0" size="4"><br>
</form>

<script language="JavaScript1.2">
<!-- Original: CodeLifter.com (support@codelifter.com) -->
<!-- Begin
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
} 
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;} 
document.Show.MouseX.value = tempX;
document.Show.MouseY.value = tempY;
return true;
}
// End -->
</script>

Последний раз редактировалось heretic1990; 15.11.2008 в 23:04..
 
Ответить с цитированием

  #504  
Старый 18.11.2008, 00:43
Аватар для rushter
rushter
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме:
9257858

Репутация: 979


Отправить сообщение для rushter с помощью ICQ
По умолчанию

Пример 3d капчи..
PHP код:
<?
$capthca 
= new Capthca3d(); 
$capthca->render(); 

class 
Capthca3d
    const 
CHARS 'WEafRTYIPAGHJKXBNM3479j'
    protected 
$hypot 8
    protected 
$image null
     
    protected 
$text 'achat'
     
    public function 
__construct() 
    { 
        
$this->time microtime(true); 
        
$this->generateCode(); 
     
    } 
    protected function 
generateCode() 
    { 
        
$chars self::CHARS
        for(
$i =0$i<5$i++){ 
            
$this->text .= $charsmt_rand(0,22)}; 
        } 
    } 
     
    public function 
getText() 
    { 
        return 
$this->text
    } 
    protected function 
getProection($x1,$y1,$z1
    { 
        
$x $x1 $this->hypot;  
        
$y $z1 $this->hypot
        
$z = -$y1 $this->hypot
         
        
$xx 0.707106781187;  
        
$xy 0
        
$xz = -0.707106781187;  
         
        
$yx 0.408248290464;  
        
$yy 0.816496580928;  
        
$yz 0.408248290464
         
        
$cx $xx*$x $xy*$y $xz*$z
        
$cy $yx*$x $yy*$y $yz*$z20 $this->hypot
        return array( 
            
'x' => $cx
            
'y' => $cy 
            
);  
    } 
     
    function 
zFunction($x,$y){ 
        
$z imagecolorat($this->image,$y/2,$x/2)>0?2.6:0
        if( 
$z != ){ 
            
$z += mt_rand(0,60)/100
        } 
        
$z += 1.4 sin(($x+$this->startX)*3.141592654/15)*sin(($y+$this->startY)*3.141592654/15); 
        return 
$z
    } 
    public function 
render()     
    { 
        
$xx =30
         
$yy =60
         
         
$this->image imageCreateTrueColor($yy $this->hypot  $xx $this->hypot); 
         
        
$whiteColor imageColorAllocate($this->image,255,255,255); 
        
imageFilledRectangle($this->image,0,0,$yy $this->hypot  $xx $this->hypot,$whiteColor); 
         
        
$textColor imageColorAllocate($this->image,0,0,0); 
        
imageString($this->image530$this->text$textColor); 
         
         
         
$this->startX mt_rand(0,$xx);     
         
$this->startY mt_rand(0,$yy); 
         
         
$coordinates = array(); 
          
        for(
$x 0$x $xx 1$x++){ 
            for(
$y 0$y $yy 1$y++){ 
                
$coordinates[$x][$y] = $this->getProection($x,$y,$this->zFunction($x,$y)); 
             } 
         } 
          
        for(
$x 0$x $xx$x++){ 
            for(
$y 0$y $yy$y++){ 
                 
$coord = array(); 
                 
$coord[] = $coordinates[$x][$y]['x']; 
                 
$coord[] = $coordinates[$x][$y]['y']; 
                  
                 
$coord[] = $coordinates[$x+1][$y]['x']; 
                 
$coord[] = $coordinates[$x+1][$y]['y']; 
                  
                 
$coord[] = $coordinates[$x+1][$y+1]['x']; 
                 
$coord[] = $coordinates[$x+1][$y+1]['y']; 
                  
                 
$coord[] = $coordinates[$x][$y+1]['x']; 
                 
$coord[] = $coordinates[$x][$y+1]['y']; 
                 
                
$c = (int) ($this->zFunction($x,$y)*32); 
                
$linesColor imageColorAllocate($this->image$c$c$c); 
                
imageFilledPolygon($this->image$coord4$whiteColor); 
                
imagePolygon($this->image$coord4$linesColor); 
             } 
         } 
         
        
$textColor imageColorAllocate($this->image,0,0,0); 
        
imageString($this->image530$this->text$whiteColor); 
        
imageString($this->image130, (microtime(true)-$this->time), $textColor); 
        
header('Content-Type: image/png'); 
         
        
imagepng($this->image); 
        
imagedestroy($this->image); 
    } 
}
?>
KAndy(С)

Последний раз редактировалось rushter; 18.11.2008 в 01:08..
 
Ответить с цитированием

  #505  
Старый 19.11.2008, 15:27
Аватар для rushter
rushter
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме:
9257858

Репутация: 979


Отправить сообщение для rushter с помощью ICQ
По умолчанию

Анализатор логов PHP-на-Apache
Иногда бывает полезен..
PHP код:
#!/usr/local/bin/php
<?php

//Jenkins 0.2a - a php-on-apache log analyzer
//by coldFlame [http://coldflame.in.ua]
//Feel free to send comments or suggestions to [me@coldflame.in.ua]
//Feel free to modify the script to suit your personal needs.
//Do not redistribute the script in any form.
//
//Crontab line to run Jenkins daily, rotate logs, and send a report to your morning mail:
//05 00 * * * www ~/scripts/jenkins.php -mme@coldflame.in.ua -r/var/log/apache2/*.error.log


//Usage: jenkins.php <errorlog> <errorlog> ...
//options: -m<email_address> emails the log instead of displaying it
//         -r<file_mask> emails the log instead of displaying it
$log_files = array();

for (
$i 1$i $_SERVER['argc']; ++$i) {
    if (
$_SERVER['argv'][$i][0] == '-') {
        
$code $_SERVER['argv'][$i][1];
        
$value substr($_SERVER['argv'][$i],2);
        
        switch(
$code) {
        case 
'm':
            
$mailto $value;
            break;
        case 
'r':
            
$rotatelogmask $value;
            break; 
        default:
            echo 
"Unrecognized parameter: -$code\n";
            die;
        }
    } else {
        
$log_files[] = $_SERVER['argv'][$i];
    }

 
if (isset(
$rotatelogmask)) {
    
    
$glob glob($rotatelogmask);
    
    
//rotate logs
    
foreach ($glob as $filename) {
        
$filename strval($filename);
        if (
is_file($filename)) {
            
$new_log_filename $filename.'.j'
            if (
is_file($new_log_filename)) {
                
unlink($new_log_filename);
            }
            
            
rename($filename$new_log_filename);
            
$log_files[] = $new_log_filename;
        } 
    }
    
    
//HUP the apache server
    
$pid intval(trim(file_get_contents('/var/run/httpd.pid')));
    
posix_kill($pid1);
}
 
if (empty(
$log_files)) {
    echo 
"Usage: jenkins.php <log_file> <log_file> ...\n";
    echo 
"    -m<email> - send report to <email> instead of displaying it\n";
    echo 
"    -r<file_mask> - rotate logs and sighup apache";
    die; 
}
 
if (isset(
$mailto)) {
    
ob_start();
}

foreach (
$log_files as $log_filename) {
    
    
$log_file fopen($log_filename,'r');
    
    
$error_times = array();
    
$error_counts = array();
    
    
$total_count 0;
    
$php_count 0;
    
$unique_count 0;
    
    while (
$line trim(fgets($log_file))) {
        ++
$total_count;
        if (
preg_match('@^\[([^\]]+)] \[[^\]]+] \[[^\]]+] PHP ([^:]+): (.+) in (.+) on line (\d+)(, referer: (.+)|)$@',$line,$matches)) {
            
//it's a php error message
            
++$php_count;
            
            
$error_msg trim($matches[2]) . "\n" trim($matches[3]) . "\n" trim($matches[4]) . "\n" trim($matches[5]);
            
$error_times[$error_msg] = date('d.m.y H:i',strtotime$matches[1] ));
            if (!isset(
$error_counts[$error_msg])) {
                
$error_counts[$error_msg] = 1;
            } else {
                ++
$error_counts[$error_msg];
            }
        }
        
    }
    
    
fclose($log_file);

    
arsort($error_counts);
    
    
$error_messages array_keys$error_counts );
    
    
$unique_count count($error_messages);
    
    
?>
    <h1>Jenkins report for <?php echo htmlspecialchars($log_filename);?></h1>
    Total lines in log: <b><?php echo $total_count?></b><br> 
    Lines recognized as PHP errors: <b><?php echo $php_count?></b><br>
    Unique PHP error messages: <b><?php echo $unique_count?></b><br>
    
<?php if ($unique_count == 0) { ?>
    Hooray, no errors!<br>
<?php } else { ?>
    <h2>Error messages</h2>
    <?php foreach ($error_messages as $message) {
        
$count $error_counts[$message];
        
$time $error_times[$message];
     
        
$message explode("\n",$message);
        
        
$colors = array(
            
'Notice' => '#4a6d00',
            
'Error' => '#ff9c00',
            
'Warning' => '#dace48',
            
'Fatal error' => '#cb0808'
        
);
            
        
$message_color = isset($colors[$message[0]]) ? $colors[$message[0]] : '#000000';
        
    
?>
        <span style="color:<?php echo $message_color ?>"><b><?php echo htmlspecialchars($message[0]); ?>:</b></span> 
        <?php echo htmlspecialchars($message[1]); ?> 
        <code>[<?php echo htmlspecialchars($message[2]); ?>:<?php echo htmlspecialchars($message[3]); ?>]</code> 
        <span style="color:#aaaaaa">(<?php echo $count;?>
        @<?php echo $time?>)</span><br>
<?php 

}
?>
<hr>
Report generated at <?php echo date('r'); ?><br>
<a href="http://coldflame.in.ua/jenkins">Jenkins</a> 0.2a - an PHP-on-Apache error log analyzer<br>
&copy; 2008 <a href="http://coldflame.in.ua">coldFlame</a> 
<?php 

if (isset($mailto)) {
    
$contents ob_get_contents();
    
ob_end_clean();
    
    
$headers  'MIME-Version: 1.0' "\r\n";
    
$headers .= 'Content-type: text/html; charset=utf-8' "\r\n";
    
mail($mailto'Jenkins analyzer report for '.date('d.m.Y'), $contents$headers);
}

?>
Закачка ролика на ruTube с использованием cURL
PHP код:
if (move_uploaded_file($_FILES['data']['tmp_name'], $fname))
{
  
$array_var = array('save' => 'y',
             
'rt_mode' => 'do_upload',
             
'rt_developer_key' => $rt_developer_key,
             
'rt_redirect_ok' => 'http://'.$_SERVER['SERVER_NAME'].'/upload.html?redirect=ok',
             
'rt_redirect_error' => 'http://'.$_SERVER['SERVER_NAME'].'/upload.html?redirect=error',
             
'rt_auto_publish' => $auto_publish,
             
'rt_user' => '',
             
'rt_sign' => '',
             
'rt_enc' => 'UTF-8',
             
'referer' => 'http://'.$_SERVER['SERVER_NAME'].'/upload.html',
             
'title' => $name,
             
'rt_tags' => $tags,
             
'comment' => $description,
             
'category' => $rutube_cat,
             
'data'=> '@'.$fname
            
);
            
  
$ch curl_init();
  
curl_setopt($chCURLOPT_URL"http://uploader.rutube.ru/cgi-bin/jsapi.cgi"); 
  
curl_setopt($chCURLOPT_FOLLOWLOCATION0);
  
curl_setopt($chCURLOPT_POSTFIELDS$array_var);
  
curl_setopt($chCURLOPT_RETURNTRANSFER1);
  
  
$response curl_exec($ch);
  
curl_close($ch);
 
  if (
$response)
  {
    
$response split("\r\n\r\n"$response);
    
$response trim(preg_replace('/.*Location:.*redirect=(\S*).*/i''$1'strtr($response[0],array("\n" =>' '"\r" => ' '))));
      
    if (
strpos($response'error') === false
    {
      
//ролик успешно загружен на rutube
      
$response preg_replace('/.*rt_movie_id=(.*)/i''$1'$response); //полученный временный id
      
$sql->Query('INSERT INTO movie SET category_id='.$category.',name="'.SQL_STR.'",description="'.SQL_STR.'",date='.time().', author = "'.SQL_STR.'",user_id='.$user['id'].',status=1,rutube_id="'.SQL_STR.'", tags="'.SQL_STR.'"'$name$description$author$response$tags);
        
      
header('Location: http://'.$_SERVER['SERVER_NAME'].'/upload.html?successful');
    }
  }


Последний раз редактировалось rushter; 19.11.2008 в 15:32..
 
Ответить с цитированием

  #506  
Старый 19.11.2008, 21:35
Аватар для heretic1990
heretic1990
Постоянный
Регистрация: 02.07.2008
Сообщений: 472
Провел на форуме:
3728999

Репутация: 444
Wink

Скрипт для проверки Информации о IP используя whois
infoip.php
PHP код:
<? 
if (!isset($_POST['submit'])) 

?> 
<html> 
<head> 
  <title>Информация о IP</title> 
</head> 
<body> 
  <center> 
     <H4>Информация об IP-адресе</H4> 
       <FORM action=infoip.php method=post> 
         <INPUT type=text name=ip size=35> 
         <input type=submit name = submit value = 'Проверить'> 
       </form> 
  </center> 

<? 

else 

if (
$_POST['ip']!= ""

    
$sock fsockopen ("whois.ripe.net",43,$errno,$errstr); 
     
    if (!
$sock) { 
      echo(
"$errno($errstr)"); 
      return; 
    } 
    else { 
      
fputs ($sock$_POST['ip']."\r\n"); 
      
      while (!
feof($sock)) { 
        echo (
str_replace(":",":      ",fgets ($sock,128))."<br>"); 
              } 
    } 
    
fclose ($sock); 
      } 


?>
 
Ответить с цитированием

  #507  
Старый 22.11.2008, 00:35
Аватар для geforce
geforce
Постоянный
Регистрация: 21.08.2008
Сообщений: 302
Провел на форуме:
458686

Репутация: -25
Отправить сообщение для geforce с помощью ICQ
По умолчанию

У кого есть скрипт как вот здеся http://avatka.ru/??? Или где моно взять?
 
Ответить с цитированием

  #508  
Старый 25.11.2008, 17:45
Аватар для rushter
rushter
Reservists Of Antichat - Level 6
Регистрация: 23.05.2008
Сообщений: 756
Провел на форуме:
9257858

Репутация: 979


Отправить сообщение для rushter с помощью ICQ
По умолчанию

учи gd2
 
Ответить с цитированием

  #509  
Старый 26.11.2008, 20:47
Аватар для [dei]
[dei]
Участник форума
Регистрация: 24.11.2008
Сообщений: 205
Провел на форуме:
1123418

Репутация: 362
Отправить сообщение для [dei] с помощью ICQ
По умолчанию

пара перл скриптов, использовались при спаме vконтактe.

Удаление повторяющихся строк
Код:
#!/usr/bin/perl -w
# Удаление повторяющихся строк
# by [dei]
############ Config #############
$file = 'acs.txt';
#############################

open(F1,"< $file");

@lines = <F1>;
close F1;

for($i=0;$i<@lines;$i++) {
    for($i2=$i+1;$i2<@lines;$i2++) {
        if($lines[$i] eq $lines[$i2]) { splice @lines, $i2, 1; }
    }
}

open(F2,"> $file");
print F2 join('',@lines);
close F2;

Разбивка одного файла на равные мелкие файлы
Код:
#!/usr/bin/perl -w
# Разбивка файла на мелкие
# by [dei]
############ Config #############
$file = 'groups.txt';
$newname = 'groups.txt';#к имени прибавляется порядковый номер
$count = 10;
#############################
use POSIX qw(ceil);

open(FF,"< $file");

@lines = <FF>;
close FF;

$x = ceil(($#lines+1)/$count);

for($i=1;$i<=$count;$i++){
    $newname =~ s/([0-9]*|)\.txt/$i\.txt/;
    
    $f = F.$i;
    open($f,"> $newname");
    
    $n1 = $i * $x - $x;
    if($i==$count) { $n2 = $#lines+1; }
    else { $n2 = $i * $x; }
    
    for($i2=$n1;$i2<$n2;$i2++) {
        print $f $lines[$i2];
    }
}

Последний раз редактировалось [dei]; 26.11.2008 в 21:10..
 
Ответить с цитированием

  #510  
Старый 26.11.2008, 21:03
Аватар для Tigger
Tigger
Познавший АНТИЧАТ
Регистрация: 27.08.2007
Сообщений: 1,107
Провел на форуме:
5386281

Репутация: 1177


Отправить сообщение для Tigger с помощью ICQ
По умолчанию

[dei], написал бы для чего какой скрипт!
 
Ответить с цитированием
Ответ





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT.XYZ