Показать сообщение отдельно

  #2  
Старый 18.07.2009, 14:00
mailbrush
Познавший АНТИЧАТ
Регистрация: 24.06.2008
Сообщений: 1,996
С нами: 9410786

Репутация: 2731


По умолчанию

ТС, зачем темы дублировать? http://forum.antichat.ru/thread130318.html

Я пост свой тоже сюда скопирую, даже добавлю кое-что...

1. Есть такие функции - isset, error_reporting, ты про них не знаешь?
2. Никогда не пробовал делать код читабелным, не? Читабельный:
PHP код:
<html><body bgcolor=black>
<style>
a
{
text-decoration:none;
}
</style><font color=dcdcdc size=-1 face=verdana>FTP Parser 1.0 By [QwyZ] (for antichat.ru and seclab.ru)<br>
<br>
Variables: www.your.host.com/parser.php?<font color=orange>z</font>=com&amp;<font color=orange>m</font>=14&amp;<font color=orange>base</font>=ftps.txt&amp;<font color=orange>all</font>=0&amp;<font color=orange>save</font>=yes&amp;<font color=orange>word</font>=freehostia.com<br><br>
$z = domain zone (ex. &z=com),for all zones use * (&z=*)<br>
$m = maxlength of domain name (ex. &m=14),for all domains use * (&m=*)<br>
$base = ftp database (ex. &base=file.txt),bases must to be in "/bases" folder<br>
$all = searching at subdomains too (ex. &all=1,&all=0)<br>
$save = saving/not saving results to "/queries" folder (ex. &save=yes,&save=no)<br>
$word = search word (ex. &word=freehostia.com)<br><font color=blue>___________________________________________________________________</font><br><br>
<?php

//vars
$zone = $_GET['z'];
$maxl = $_GET['m'];
$i = $_GET['base'];
$all = $_GET['all'];
$save = $_GET['save'];
$sw = $_GET['word'];
//vars

if ($save == "yes")
{
    
$saveTo = fopen("./queries/" . $zone . "." . $maxl . "." . $i . "." . $all . "." .
        
$sw . ".txt", "w+");
    
fclose($saveTo);
}
function 
check_ftps($i, $zone, $maxl, $all, $save, $sw)
{
    
$current_base = file("./bases/" . $i);
    
$k = 0;
    for (
$k = 0; $k < count($current_base); $k++)
    {
        
$current_ftp = $current_base[$k];
        if (
substr_count($current_ftp, "@") == 1)
        {
            
$current_ftp = explode("@", $current_ftp);
            
$current_ftp = $current_ftp[1];
            if ((
substr_count($current_ftp, ".") == 1) || ($all == "1"))
            {
                if ((
strlen($current_ftp) <= $maxl) || ($maxl == "*"))
                {
                    if ((
strstr($current_ftp, $sw)) || ($sw == "*"))
                    {
                        
$suba = explode(".", $current_ftp);
                        
$suba = $suba[count($suba) - 1];
                        
$suba = substr($suba, 0, (strlen($suba) - 2));
                        if ((
$suba == $zone) || ($zone == "*"))
                        {
                            if (
substr($current_base[$k], 0, 6) == "ftp://")
                            {
                            } else
                            {
                                
$current_base[$k] = "ftp://" . $current_base[$k];
                            }
                            
$account = explode("@", $current_base[$k]);
                            
$lp = $account[0] . "@";
                            
$button = substr($account[1], 0, strlen($account[1]) - 2);
                            
$dom = "<font color=orange>" . $account[1] . "</font><br>";
                            
$dom = str_replace($sw, "<b><font color=yellow>" . $sw . "</font></b>", $dom);
                            echo (
"<input type=button value=\"Open\" onclick='location.href=\"" . $lp . $button .
                                
"\"'>&nbsp;&nbsp;" . $lp . $dom);
                            if (
$save == "yes")
                            {
                                
$add = fopen("./queries/" . $zone . "." . $maxl . "." . $i . "." . $all . "." .
                                    
$sw . ".txt", "a+");
                                
fputs($add, $current_base[$k]);
                                
fclose($add);
                            }
                        }
                    }
                }
            }
        }
    }
}

//call function
check_ftps($i, $zone, $maxl, $all, $save, $sw);
//call function


?></font>
</body>
</html>
Нечитабельный (твой):
PHP код:
<html><body bgcolor=black>
<style>
a
{
text-decoration:none;
}
</style><font color=dcdcdc size=-1 face=verdana>FTP Parser 1.0 By [QwyZ] (for antichat.ru and seclab.ru)<br>
<br>
Variables: www.your.host.com/parser.php?<font color=orange>z</font>=com&amp;<font color=orange>m</font>=14&amp;<font color=orange>base</font>=ftps.txt&amp;<font color=orange>all</font>=0&amp;<font color=orange>save</font>=yes&amp;<font color=orange>word</font>=freehostia.com<br><br>
$z = domain zone (ex. &z=com),for all zones use * (&z=*)<br>
$m = maxlength of domain name (ex. &m=14),for all domains use * (&m=*)<br>
$base = ftp database (ex. &base=file.txt),bases must to be in "/bases" folder<br>
$all = searching at subdomains too (ex. &all=1,&all=0)<br>
$save = saving/not saving results to "/queries" folder (ex. &save=yes,&save=no)<br>
$word = search word (ex. &word=freehostia.com)<br><font color=blue>___________________________________________________________________</font><br><br>
<?php
//vars
$zone=$_GET['z'];
$maxl=$_GET['m'];
$i=$_GET['base'];
$all=$_GET['all'];
$save=$_GET['save'];
$sw=$_GET['word'];
//vars

if ($save=="yes"){
$saveTo=fopen("./queries/" . $zone . "." . $maxl . "." . $i . "." . $all . "." . $sw . ".txt","w+");
fclose($saveTo);}
function 
check_ftps($i,$zone,$maxl,$all,$save,$sw)
{
 
$current_base=file("./bases/" . $i);
 
$k=0;
 for(
$k=0;$k<count($current_base);$k++)
 {
  
$current_ftp=$current_base[$k];
  if (
substr_count($current_ftp,"@")==1)
  {
  
$current_ftp=explode("@",$current_ftp);
  
$current_ftp=$current_ftp[1];
  if ((
substr_count($current_ftp,".")==1) || ($all=="1"))
  {
  if ((
strlen($current_ftp)<=$maxl) || ($maxl=="*"))
  {
  if ((
strstr($current_ftp,$sw)) || ($sw=="*")){
  
$suba=explode(".",$current_ftp);
  
$suba=$suba[count($suba)-1];
  
$suba=substr($suba,0,(strlen($suba)-2));
  if ((
$suba==$zone) || ($zone=="*"))
  {
  if (
substr($current_base[$k],0,6)=="ftp://"){}else
  {
$current_base[$k]="ftp://" . $current_base[$k];}
  
$account=explode("@",$current_base[$k]);
  
$lp=$account[0] . "@";
  
$button=substr($account[1],0,strlen($account[1])-2);
  
$dom="<font color=orange>" . $account[1] . "</font><br>";
  
$dom=str_replace($sw,"<b><font color=yellow>" . $sw . "</font></b>",$dom);
  echo(
"<input type=button value=\"Open\" onclick='location.href=\"" . $lp . $button . "\"'>&nbsp;&nbsp;" . $lp . $dom);
  if (
$save=="yes"){
  
$add=fopen("./queries/" . $zone . "." . $maxl . "." . $i . "." . $all . "." . $sw . ".txt","a+");
  
fputs($add,$current_base[$k]);
  
fclose($add);}
}}}}}}
}

//call function
check_ftps($i,$zone,$maxl,$all,$save,$sw);
//call function
?></font>
</body>
</html>
3. Функции работы со строками - прошлый век. Сейчас есть регулярки.
4. Про формы не читал никогда?
5. В коде есть строчки вида
PHP код:
if(условие)
{
#xD кода нету... обычные фигурные скобки
} else 
{ 
#code 
} 
6. Используй switch-case вместо if.

Последний раз редактировалось mailbrush; 18.07.2009 в 14:12..
 
Ответить с цитированием