Visa ett inlägg
Oläst 2005-07-26, 03:39 #12
Jonas Jonas är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Feb 2004
Inlägg: 3 364
Jonas Jonas är inte uppkopplad
Klarade millennium-buggen
 
Reg.datum: Feb 2004
Inlägg: 3 364
Citat:
Originally posted by koala@Jul 25 2005, 23:14
Kod:
$email = $_REQUEST['email'];
$text = $_REQUEST['text'];

if (is_not_email($email) && is_not_correct($text)) {
  echo 'Hoppsan.';
} else {
  mail('info@localhost', 'kontakt', $text . $email);
  echo 'Ditt meddelande har skickats.';
}

function is_not_email ($email) {
  if (!preg_match("/^[\w\xe6\xc6\xf8\xd8\xe5\xc5\xf6\xd6\xe4\xc4]\.x$/", $email)) 
    return false;
  return true;
}

function is_not_correct ($text) {
  $status = eval($text);
  if ($status === true) return true;
  else return $status;
}
Som text räcker det att jag skriver:

[email protected]&test=<?return true;?>[massa fulkod o headers...]
Jonas är inte uppkopplad   Svara med citatSvara med citat