I have a problem in my script and if this problem can be solved my script should be complete. What my script does is it records every possible combination string into a database however some strings ending with a space are not being recorded. My full code is as follows:
<?php
set_time_limit(90);
$load=file_get_contents('/proc/loadavg');
$load=explode(' ',$load);
echo 'Load='.$load[0];
if ($load[0]<=0.60) {
mysql_connect('localhost','user','password');
mysql_select_db('database');
$char=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','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','1','2','3','4','5','6','7','8','9','0','~','`','!','@','#','$','%','^','&',
'*','(',')','-','_','+','=','\\','|','{','}','[',']',';',':','"','\'',',','<','.','>','?','/',' ');
$bchar=array(''=>0,'a'=>2,'b'=>3,'c'=>4,'d'=>5,'e'=>6,'f'=>7,'g'=>8,'h'=>9,'i'=>10,'j'=>11,
'k'=>12,'l'=>13,'m'=>14,'n'=>15,'o'=>16,'p'=>17,'q'=>18,'r'=>19,'s'=>20,'t'=>21,'u'=>22,
'v'=>23,'w'=>24,'x'=>25,'y'=>26,'z'=>27,'A'=>28,'B'=>29,'C'=>30,'D'=>31,'E'=>32,'F'=>33,
'G'=>34,'H'=>35,'I'=>36,'J'=>37,'K'=>38,'L'=>39,'M'=>40,'N'=>41,'O'=>42,'P'=>43,'Q'=>44,
'R'=>45,'S'=>46,'T'=>47,'U'=>48,'V'=>49,'W'=>50,'X'=>51,'Y'=>52,'Z'=>53,'1'=>54,'2'=>55,
'3'=>56,'4'=>57,'5'=>58,'6'=>59,'7'=>60,'8'=>61,'9'=>62,'0'=>63,'~'=>64,'`'=>65,'!'=>66,
'@'=>67,'#'=>68,'$'=>69,'%'=>70,'^'=>71,'&'=>72,'*'=>73,'('=>74,')'=>75,'-'=>76,'_'=>77,
'+'=>78,'='=>79,'\\'=>80,'|'=>81,'{'=>82,'}'=>83,'['=>84,']'=>85,';'=>86,
':'=>87,'"'=>88, '\''=>89,','=>90,'<'=>91,'.'=>92,'>'=>93,'?'=>94,'/'=>95,' '=>95,"\r"=>0);
$r=mysql_query('SELECT `id` FROM `hash`');
$n=mysql_num_rows($r);
if ($n>0) {
$re=mysql_query('SELECT uncompress(`id`) as `id` FROM `hash` LIMIT '.($n-1).',1');
$d=mysql_fetch_assoc($re);
$d['id']=$d['id'];
if (strlen($d['id'])<7) {
while (strlen($d['id'])<=6) {
$d['id']="\r".$d['id'];
}
}
$x=str_split($d['id'],1);
$j[1]=$bchar[$x[0]];
$j[2]=$bchar[$x[1]];
$j[3]=$bchar[$x[2]];
$j[4]=$bchar[$x[3]];
$j[5]=$bchar[$x[4]];
$j[6]=$bchar[$x[5]];
$j[7]=$bchar[$x[6]];
} else {
$j[1]=0;
$j[2]=0;
$j[3]=0;
$j[4]=0;
$j[5]=0;
$j[6]=0;
$j[7]=0;
}
unset($bchar);
$m=0;
$l=0;
$p=true;
$passgo=0;
$sleeper=0;
for ($i[1]=$j[1];$i[1]<15;$i[1]++) { //16.0655625GB Database
for ($i[2]=$j[2];isset($char[$i[2]]);$i[2]++) {
for ($i[3]=$j[3];isset($char[$i[3]]);$i[3]++) {
for ($i[4]=$j[4];isset($char[$i[4]]);$i[4]++) {
for ($i[5]=$j[5];isset($char[$i[5]]);$i[5]++) {
for ($i[6]=$j[6];isset($char[$i[6]]);$i[6]++) {
$m+=$l;
$l=0;
for ($i[7]=$j[7];isset($char[$i[7]]);$i[7]++) {
if ((!empty($i[6]) && empty($i[7])) || (!empty($i[5]) && (empty($i[6]) || empty($i[7]))) || (!empty($i[4]) && (empty($i[5]) || empty($i[6]) || empty($i[7]))) || (!empty($i[3]) && (empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) || (!empty($i[2]) && (empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7]))) || (!empty($i[1]) && (empty($i[2]) || empty($i[3]) || empty($i[4]) || empty($i[5]) || empty($i[6]) || empty($i[7])))) {
echo $char[$i[1]].$char[$i[2]].$char[$i[3]].$char[$i[4]].$char[$i[5]].$char[$i[6]].$char[$i[7]].'<br>';
} else {
$v=$char[$i[1]].$char[$i[2]].$char[$i[3]].$char[$i[4]].$char[$i[5]].$char[$i[6]].$char[$i[7]];
$z=hash('sha1',$v);
$hash=mysql_real_escape_string(substr($z,0,4).hash('crc32',$z).hash('crc32b',$z));
$s=mysql_real_escape_string($v);
$r=mysql_query('SELECT `id` FROM `hash` WHERE `id`=compress("'.$s.'") AND `sha1`=compress("'.$hash.'")');
if (mysql_num_rows($r)==0 || $i[7]==' ') {
mysql_query('INSERT INTO `hash` SET `id`=compress("'.$s.'"), `crc32`=compress("'.mysql_real_escape_string(hash('crc32',$v)).'"), `crc32b`=compress("'.mysql_real_escape_string(hash('crc32b',$v)).'"), `sha1`=compress("'.$hash.'")');$l++;
}
$l++; if ($l==45){sleep(6);}
}
if(($l+$m)>140) {
$exits=true;
break;
}
$j[7]=0;
}
sleep(7);
if ($exits==true) { break; }
$j[6]=0;
}
if ($exits==true) { break; }
$j[5]=0;
}
if ($exits==true) { break; }
$j[4]=0;
}
if ($exits==true) { break; }
$j[3]=0;
}
if ($exits==true) { break; }
$j[2]=0;
}
if ($exits==true) { break; }
$j[1]=0;
}
flush();
} //end server load if
Does anybody know why some combinations with spaces are not being recorded. Also I checked the empty function and it returns false like it should when it checks for a space. Thanks.