Dienstag, 22. November 2011

Encode and decode Dreamweaver password in PHP

If you want to generate a Dreamweaver site file (.ste) so you can import it, you need to encode the password for Dreamweaver. You can learn from Andrew Odri that the encryption is very bad. He wrote encode and decode functions for this in Javascript. Doing the same in PHP is way easier. Of course you can use this page to decode your side export. But they do not explain how it works:

function encodePassword($input)
{
  $output = '';
  
  for($i = 0; $i < strlen($input); $i++)
  {
    $output .= dechex(ord($input[$i]) + $i);
  }

  return strtoupper($output);
}


function decodePassword($input)
{
  $output = '';
  
  for($i = 0; $i < strlen($input); $i += 2)
  {
    $output .= chr(hexdec($input[$i].$input[$i+1]) - $i/2);
  }

  return ($output);
}

Like it? Share it! Flattr this

Dienstag, 8. November 2011

CSS position: relative vs absolute

Mit position: absolute, liegt die Div Box manchmal im nirgendwo. Mit position: relative bleibt jedoch der Platz für die Box reserviert auch wenn man sie verschiebt. Das löst man einfach in dem man mit margin-bottom: -10px die Box weg macht. Das klappt gut.


Noch bessere ist es richtig zu lernen mit div Boxen umzugehen. Dieses kurze und doch nette Tutorial zeigt, dass die absolute Box nicht mehr abhaut, wenn man sie in ein relatives Div legt.



Like it? Share it! Flattr this