Jump to content

DeathRay2K

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by DeathRay2K

  1. I'm terrible with Javascript, but fortunately I got a friend to help, and this was the result:

    function resize(el){var step = 0.1;var dir = items[el];var elem = document.getElementById(el);var t = parseFloat(elem.style.letterSpacing);if(isNaN(t)){  t = 0;}t += (dir * step);if(items[el] == dir){  if(t <= 1 && t >= 0)  {   elem.style.letterSpacing = t + 'px';   setTimeout("resize('" + el + "')", 0);  }}}function expand(){items[this.id] = 1;resize(this.id);}function contract(){items[this.id] = -1;resize(this.id);}window.onload = function(){for (var i in items){  var item = document.getElementById(i);  item.onmouseover = expand;  item.onmouseout = contract;}};var items = {'w' : 0, 'q' : 0}; // ids of stylable items

    And it works perfectly. :)

  2. I'm trying to make a function that smoothly increases/decreases an elements letter-spacing.So far, I've tried this:

    			function expand(id)			{				space = document.getElementById(id).style.letterSpacing				space = space + 0.1				document.getElementById(id).style.letterSpacing = space				alert(space)				if(space < 1)				{					expand(el)				}			}			function shrink(id)			{				space = document.getElementById(id).style.letterSpacing				space = space - 0.1				document.getElementById(id).style.letterSpacing = space				alert(space)				if(space > 0)				{					shrink(id)				}			}

    And that output and endless stream of alerts with no content and the following error:

    Warning: Error in parsing value for property 'letter-spacing'. Declaration dropped.
    Then, someone told me I had to add 'px' to the end, and I tried this:
    			function expand(id)			{				space = document.getElementById(id).style.letterSpacing				space = space + 0.1				document.getElementById(id).style.letterSpacing = space & 'px'				alert(document.getElementById(id).style.letterSpacing)				if(space < 1)				{					expand(id)				}			}			function shrink(id)			{				space = document.getElementById(id).style.letterSpacing				space = space - 0.1				document.getElementById(id).style.letterSpacing = space & 'px'				alert(space)				if(space > 0)				{					expand(id)				}			}

    That alerted 0pt on mouseOver, and NaN on mouseOutFinally, here's the HTML:

    <span id="previousyear"><a id="pyear" href="index.php?month=<?= $month - 12; ?>" onMouseOver="expand('pyear')" onMouseOut="shrink('pyear')">Previous Year</a></span>

    I realise that I haven't added a delay yet, I just want to make it work first.

  3. An image in a div seems to be offset in IE (I have 7, so I don't know what it looks like in 6...)But it works fine in Firefox...Well, this is the site: http://www.d2kstudios.com/designs/designs/...20Blue/preview/And this is the CSS:

    #logo { position: absolute; width: 100%; left: 0px; top: 0px; background-image: url(logobg.gif); }#divider { position: absolute; width: 100%; left: 0px; top: 90px; background-image: url(sbtopbg.gif); }#nav { position: absolute; min-height: 100%; left: 0px; top: 100px; background-image: url(sb.gif); background-repeat: repeat-y; }#content { padding: 20px; padding-left: 201px; }

    And the HTML corresponding to it:

    <div id="logo">	<img src="logo.jpg"></div><div id="divider">	<img src="sbtop.gif"></div><div id="nav">	<div id="content">  ...	</div></div>

  4. I'm not quite sure what you mean, but this may be it:

    $string1 = "Hello ";$string2 = "World!";$string1 .= $string2;echo $string1;

    This will make $string1 = "Hello World!" and output it.

    $string1 = "Hello ";$string2 = "World!";$string3 = $string1 . $string2;echo $string3;

    This will make a $string3 = "Hello World!" and output it. Only do it this way if you want to keep the parts of the string seperate.

  5. If you're using PHP5+, you can do it this way.

    $dir = "path_to_directory";if($filesarray = scandir($dir)){    $numberoffiles = count($filesarray);    echo $numberoffiles;}else{    echo "Failed to open directory.";}

  6. Well if you're going to do that you may as well enable Register Globals. :) The security risk is quite simple.Take this piece of code as an example:

    <?php$password="snicklefritz";if($foo == $password)include("sensitivedata.inc");else{?><html><head>    <title>Log In</title></head><body>    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="Get">        <input type="text" name="foo" />        <input type="submit" />    </form></body></html><?php}?>

    Obviously this is highly simplified, but this could have been avoided by using $_GET, or even using Post instead altogether.This exploit could also be used to view, modify, and/or delete files like .htaccess, and other such files.

  7. I believe that would be register globals. Its disabled in newer versions of PHP by default, as it allowed easy access to sensitive material (ie. passwords) on badly scripted websites. You can reenable it if you wish in php.ini, but I'd advise against it.

  8. Yes, that's how I noticed that the error just moves to the next line when I comment strings out...And unfortunately there are no problems like that in my script, they'd be easy to fix...I also tried changing it to this:

    11	function whatis($name){12  if(substr_count($name, '|Category')>0)13 	 return "Category";14  elseif(substr_count($name, '|Subcategory')>0)15 	 return "Subcategory";16  elseif(is_file($name))17 	 return "File";18  else19 	 return "Undesirable";20	}

    But then instead of an unexpected T_STRING I get unexpected T_CONSTANT_ENCAPSED_STRING on line 14...Maybe it doesn't like | in a string? But that doesn't make much sense... :(Edit:Wait, I did, in fact have an escaped quote! :) Thanks for the help! :)

  9. I made a simple function to check a filename to see if there was |Category, |Subcategory, or something else, but nearly everyy line is generating errors...

    11	function whatis($name){12  $checktype = explode('|', $name);13  $checkfile = explode('.', $name);14  if(count($checktype) >=2 && $checktype[1] == 'Category')15 	 return 'Category';16  elseif(count($checktype) >=2 && $checktype[1] == 'Subcategory')17 	 return 'Subcategory';18  elseif(count($checkfile) <= 3)19 	 return 'File';20  else21 	 return 'Undesirable';22	}

    I wrote the line number before each line... This error starts at line 14, but even if I remove everything in the if statement after >=2, line 15 errors:Parse error: parse error, unexpected T_STRING in /my/website/foo/bar/script.php on line 14

  10. I for one, can change the text size at www.paypal.com, as I am using FireFox. Px is actually a relative measurement as well.The only fixed measurements are:

        * in: inches — 1 inch is equal to 2.54 centimeters.    * cm: centimeters    * mm: millimeters    * pt: points — the points used by CSS 2.1 are equal to 1/72nd of an inch.    * pc: picas — 1 pica is equal to 12 points.
    Source
  11. Do I ever have the solution for you!

    <?php	function nocrypt($num,$s){  return $num;	}	$i = 0;	$donearray = array();	$min = 1;	$max = 80;	$total = 83;	$crypt = crypt;	$maxlines = 500;	for($num1=$min; $num1<=$max; $num1++){  for($num2=$min; $num2<=$max; $num2++){   for($num3=$min; $num3<=$max; $num3++){    for($num4=$min; $num4<=$max; $num4++){      if($i<$maxlines && $num1+$num2+$num3+$num4 == $total && 	 in_array($crypt($num1,s1).' + '.$crypt($num2,s2).' + '.$crypt($num3,s3).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num3,s3).' + '.$crypt($num4,s4).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num4,s4).' + '.$crypt($num1,s1).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num1,s1).' + '.$crypt($num2,s2).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false &&	 	 in_array($crypt($num1,s1).' + '.$crypt($num2,s2).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num1,s1).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num1,s1).' + '.$crypt($num2,s2).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false &&	 	 in_array($crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false &&	 	 in_array($crypt($num1,s1).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num4,s4).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num4,s4).' + '.$crypt($num1,s1).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num1,s1).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false &&	 	 in_array($crypt($num4,s4).' + '.$crypt($num2,s2).' + '.$crypt($num3,s3).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num3,s3).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num2,s2).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false &&	 	 in_array($crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false && 	 in_array($crypt($num1,s1).' + '.$crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num3,s3).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num3,s3).' + '.$crypt($num4,s4)."<br>\n", $donearray) == false && 	 in_array($crypt($num1,s1).' + '.$crypt($num3,s3).' + '.$crypt($num4,s4).' + '.$crypt($num2,s2)."<br>\n", $donearray) == false && 	 in_array($crypt($num3,s3).' + '.$crypt($num4,s4).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1)."<br>\n", $donearray) == false && 	 in_array($crypt($num4,s4).' + '.$crypt($num2,s2).' + '.$crypt($num1,s1).' + '.$crypt($num3,s3)."<br>\n", $donearray) == false){ 	 $donearray[$i]=$crypt($num1,s1).' + '.$crypt($num2,s2).' + '.$crypt($num3,s3).' + '.$crypt($num4,s4)."<br>\n"; 	 echo $donearray[$i]; 	 $i++;      }    }   }  }	}	if(count($donearray)!==$maxlines)  $checknums = '<br>Try increasing $max and $total to achieve the '.$maxlines.' keys you requested. For best results, $max should be 3 less than $total.';	echo '<br>' . count($donearray) . ' keys generated.' . $checknums;?>

    This will generate the keysYou give them each one of these. (You can do it automatically with easy modification. When they enter one, you compare it against $donearray. This also allows you to set how many keys you want to generate.

      //The minimum number in one of the fields.	$min = 1;  //The maximum number in one of the fields. For best results this should be 3 less than $total.	$max = 80;  //What the fields should add up to.	$total = 83;  //Set to crypt if you want to encode them (One way process), or nocrypt if you don't.	$crypt = crypt;  //How many keys you want to generate.	$maxlines = 500;

    For assigning them, you can give each person the value for the next indice in $donearray. That indice would also act as that person's id, of sorts, and it would be used to check to make sure that they key belongs to them.

  12. Right, this should fix that:

    	<?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";  }  foreach($output as $key => $value){ 	 $return = strtr($value, "\n", ""); 	 echo $return  }	?>

  13. No there wasn't one, I just needed to know if it errored or not.Anyways, here's one that should display it.

    <?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";	}	foreach($output as $key => $value)  echo $value;?>

×
×
  • Create New...