LiveKeeper
Losesammler
- 30 April 2006
- 2.196
- 148
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature may not be available in some browsers.
$text = str_replace("\r\n\r\n", "\r\n", $text); // Windows
$text = str_replace("\n\n", "\n", $text); // Unix
$text = str_replace("\r\r", "\r", $text); // Mac
<?php
$ids = $_POST["ids"]; //Die KlammID`s aus dem Formular
$loseanzahl = $_POST["loseanzahl"]; //Anzahl der Lose die verschenkt wird
$check = str_replace(",",";",$ids); //Ersetzt ein eventuelles , durch einen ;
$check2 = str_replace("\r\n\r\n", "\r\n", $check); //Das soll dann die Leerzeilen entfernen
$klammid = explode(";", $check2); //Das soll alle vorhandenen ID`s in ein Array schreiben
$result = array_unique($klammid); //Das soll doppelte ID`s aus dem Array entfernen
$user = count($result); //Zählt wieviele ID`s im Array enthalten sind
$summe = round ($loseanzahl/$user); //Anzahl der Lose die jeder einzelne bekommt (gerundet)
echo "Loseanzahl: ",number_format($loseanzahl, '', '', '.')," Lose <br>";
echo "An ",number_format($user, '', '', '.')," User wurden je ",number_format($summe, '', '', '.')," Lose überwiesen:";
echo"<br><br>";
for($count = 0; $count < $user; $count++)
{
echo $result[$count]," "; //Listet alle ID`s auf
}
?>
/* 8 */ print_r($result);
$ids = ...($ids);
dann sind es wieder Leerzeilen, also:...PHP:$check2 = str_replace("\r\n\r\n", "", $check);
$check2 = str_replace("\r\n", "", $check);
dann sind es wieder Leerzeilen, also:
PHP:$check2 = str_replace("\r\n", "", $check);
$ids = array_unique(array_filter(array_map('trim', explode(';', str_replace(array("\n", "\r"), ';', $input)))));


JaVerwende ich im Betreff ein Leerzeichen, meldet der EF einen unbekannten Fehler.
Ist das normal?