Jump to content

DeathRay2K

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by DeathRay2K

  1. As it is, when one ends I'm not really sure what will happen, but I think it will error.This script is slightly better: <?php $code1 = file('first.combo'); $code2 = file('second.combo'); $code3 = file('third.combo'); $code4 = file('fourth.combo'); $code5 = file('fifth.combo'); $code6 = file('sixth.combo'); $total = count($code1)+count($code2)+count($code3)+count($code4)+count($code5)+count($code6); $totaleach = array(count($code1),count($code2),count($code3),count($code4),count($code5),count($code6)); sort($totaleach); for($i=0; $i<=$totaleach[5]; $i++){ $output[] = $code1[$i].' - '.$code2[$i].' - '.$code3[$i].' - '.$code4[$i].' - '.$code5[$i].' - '.$code6[$i]."<br>\n"; } ?> You should see what happens when you run it.
  2. I know, and thats fine, the only problem is that checking 6 variables is exponentially longer than checking for variables (For duplicates) in server time and writing time.Right now, as you can see, it check four variables in groups of four. With six variables, it would have to check them in groups of six, and there would be more groups as well.So, this will combine the six variables, but it doesn't do any duplicate checking yet.Also, what do you want to happen when it runs ot of lines in one of the files? <?php $code1 = file('first.combo'); $code2 = file('second.combo'); $code3 = file('third.combo'); $code4 = file('fourth.combo'); $code5 = file('fifth.combo'); $code6 = file('sixth.combo'); $total = count($code1)+count($code2)+count($code3)+count($code4)+count($code5)+count($code6); for($i=0; $i<=$total; $i++){ $output = $code1[$i].' - '.$code2[$i].' - '.$code3[$i].' - '.$code4[$i].' - '.$code5[$i].' - '.$code6[$i]."<br>\n"; }?>
  3. I don't really think I can... :)My script gets exponentially larger with every possibility added, and I'd have to redo the whole duplicate-finding routine...If I find a better way I'll get back to you.
  4. For PHP 5 or earlier?I'm not really quite sure what you mean, do you want every possible combination of the files, or their contents?
  5. Then you change it to <?php for($num1=1; $num1<=26; $num1++){ for($num2=1; $num2<=26; $num2++){ for($num3=1; $num3<=26; $num3++){ for($num4=1; $num4<=26; $num4++){ if($num1-$num2+$num3-$num4 == 50){ echo $num1.' - '.$num2.' + '.$num3.' - '.$num4."<br />\n"; } } } } }?> Also, I've almost figured out how to do the repeat checking, it'll just take a couple minutes. :)Edit:Alright, this code will check to make sure there are no duplicates, in any order: <?php $i = 0; $donearray = array(); for($num1=1; $num1<=26; $num1++){ for($num2=1; $num2<=26; $num2++){ for($num3=1; $num3<=26; $num3++){ for($num4=1; $num4<=26; $num4++){ if($num1+$num2+$num3+$num4 == 50){ if( in_array($num1.' + '.$num2.' + '.$num3.' + '.$num4."<br>\n", $donearray) == false && in_array($num2.' + '.$num3.' + '.$num4.' + '.$num1."<br>\n", $donearray) == false && in_array($num3.' + '.$num4.' + '.$num1.' + '.$num2."<br>\n", $donearray) == false && in_array($num4.' + '.$num1.' + '.$num2.' + '.$num3."<br>\n", $donearray) == false && in_array($num1.' + '.$num2.' + '.$num4.' + '.$num3."<br>\n", $donearray) == false && in_array($num2.' + '.$num4.' + '.$num3.' + '.$num1."<br>\n", $donearray) == false && in_array($num4.' + '.$num3.' + '.$num1.' + '.$num2."<br>\n", $donearray) == false && in_array($num3.' + '.$num1.' + '.$num2.' + '.$num4."<br>\n", $donearray) == false && in_array($num1.' + '.$num4.' + '.$num3.' + '.$num2."<br>\n", $donearray) == false && in_array($num4.' + '.$num3.' + '.$num2.' + '.$num1."<br>\n", $donearray) == false && in_array($num3.' + '.$num2.' + '.$num1.' + '.$num4."<br>\n", $donearray) == false && in_array($num2.' + '.$num1.' + '.$num4.' + '.$num3."<br>\n", $donearray) == false && in_array($num1.' + '.$num3.' + '.$num2.' + '.$num4."<br>\n", $donearray) == false && in_array($num3.' + '.$num2.' + '.$num4.' + '.$num1."<br>\n", $donearray) == false && in_array($num2.' + '.$num4.' + '.$num1.' + '.$num3."<br>\n", $donearray) == false && in_array($num4.' + '.$num1.' + '.$num3.' + '.$num2."<br>\n", $donearray) == false && in_array($num4.' + '.$num2.' + '.$num3.' + '.$num1."<br>\n", $donearray) == false && in_array($num2.' + '.$num3.' + '.$num1.' + '.$num4."<br>\n", $donearray) == false && in_array($num3.' + '.$num1.' + '.$num4.' + '.$num2."<br>\n", $donearray) == false && in_array($num1.' + '.$num4.' + '.$num2.' + '.$num3."<br>\n", $donearray) == false && in_array($num3.' + '.$num2.' + '.$num1.' + '.$num4."<br>\n", $donearray) == false && in_array($num2.' + '.$num1.' + '.$num4.' + '.$num3."<br>\n", $donearray) == false && in_array($num1.' + '.$num4.' + '.$num3.' + '.$num2."<br>\n", $donearray) == false && in_array($num4.' + '.$num3.' + '.$num2.' + '.$num1."<br>\n", $donearray) == false && in_array($num2.' + '.$num1.' + '.$num3.' + '.$num4."<br>\n", $donearray) == false && in_array($num1.' + '.$num3.' + '.$num4.' + '.$num2."<br>\n", $donearray) == false && in_array($num3.' + '.$num4.' + '.$num2.' + '.$num1."<br>\n", $donearray) == false && in_array($num4.' + '.$num2.' + '.$num1.' + '.$num3."<br>\n", $donearray) == false){ $donearray[$i]=$num1.' + '.$num2.' + '.$num3.' + '.$num4."<br>\n"; echo $donearray[$i]; $i++; } } } } } }?> See why it took me a while?There must be an easier way...
  6. Its possible, but its a bit too complicated for me... I'm pretty new to PHP.
  7. Oh, I see. That would be a little bit more complex. :)Well, I guess you could do this: <?php for($num1=1; $num1<=26; $num1++){ for($num2=1; $num2<=26; $num2++){ for($num3=1; $num3<=26; $num3++){ for($num4=1; $num4<=26; $num4++){ if($num1+$num2+$num3+$num4 == 50){ echo $num1.' + '.$num2.' + '.$num3.' + '.$num4."<br />\n"; } } } } }?> I have to warn you though, that it will output 456976 lines...It could actually be modified to remove any such as 18 + 22 + 4 + 6 where there's already 22 + 6 + 4 + 18 and so on.
  8. What you could do is:// Get catid and pagenum$catid=2;$pagenum=2;//Make sure they're only numbers, and then include the file pm{catid}_{pagenum}.txtif(is_numeric($catid) & is_numeric($pagenum))include('pm'.$catid.'_'.$pagenum.'.txt');
  9. You could do something like:if($var_array[0]+$var_array[1]+$var_array[2]+$var_array[3]==50){//Code for if the numbers equal 50.} Or, if you don't know how many indices in the array there are, $sum = 0;foreach($var_array as $key=>$value){$sum += $value;}if($sum == 50){//Code for if the numbers equal 50.} I think that should work...
  10. Yeah, the page is http://www.d2kstudios.com/index.php, and the CSS in questioon is what I posted above.The full CSS for the content div is #content { position: absolute; width: auto; height: auto; top: 197px; left: 110px; right: 145px; padding: 10px; background-color: #222222; border: 3px solid #363636; -moz-border-radius-topleft: 2px; -moz-border-radius-topright: 2px; -moz-border-radius-bottomleft: 2px; -moz-border-radius-bottomright: 2px; -moz-border-top-colors: #252525 #4a4a4a #363636; -moz-border-bottom-colors: #252525 #4a4a4a #363636; -moz-border-left-colors: #252525 #4a4a4a #363636; -moz-border-right-colors: #252525 #4a4a4a #363636; cursor: default; overflow: visible; }
  11. Yeah, I tried that, but it had no effect on IEs behaviour.
  12. Right now I'm using CSS that should work, but doesn't in IE. #content { position: absolute; width: auto; height: auto; top: 197px; left: 110px; right: 145px } It's content's width is set to 100%, but still, it should always have 197px left of it and 145px right of it, no matter what size the browser window is, and this works great in Firefox and Opera, but in IE the content stretches it until it is 100% the width of the entire browser window.Is there any way I can get IE to display the same results as Firefox and Opera? Or do need to use (*ugh*) tables?
×
×
  • Create New...