Hay Leutz...
hab ein kleines Problemchen mit dem befehl str_replace und der zusätzlichen nutzung von Arrays....
ScriptA=test.php
ScriptB=test2.php
Das besagte ScriptA soll einen Text ""verschlüsseln"" und ScriptB soll das ganze wieder ""entschlüsseln"".
Aber schon ScriptA arbeitet nicht richtig...
Die Ausgabe müsste so aussehen,
Iotk_tof_ytby7894561230
sieht aber so aus,
Ggnk_ngf_nnbn2301111230
Wad hab ich falsch gemacht?
Oder war die grundüberlegung falsch?
Greeze Jaydabi
EDIT: PHP4
test.php
test2.php
hab ein kleines Problemchen mit dem befehl str_replace und der zusätzlichen nutzung von Arrays....
ScriptA=test.php
ScriptB=test2.php
Das besagte ScriptA soll einen Text ""verschlüsseln"" und ScriptB soll das ganze wieder ""entschlüsseln"".
Aber schon ScriptA arbeitet nicht richtig...
Die Ausgabe müsste so aussehen,
Iotk_tof_ytby7894561230
sieht aber so aus,
Ggnk_ngf_nnbn2301111230
Wad hab ich falsch gemacht?
Oder war die grundüberlegung falsch?
Greeze Jaydabi
EDIT: PHP4
test.php
PHP-Code:
<?php
$text="Hier ein text0123456789";
$abc=array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
$ABC=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$cba=array("q","w","e","r","t","z","u","i","o","p","a","s","d","f","g","h","j","k","l","y","x","c","v","b","n","m");
$CBA=array("Q","W","E","R","T","Z","U","I","O","P","A","S","D","F","G","H","J","K","L","Y","X","C","V","B","N","M");
$ezd=array("0","1","2","3","4","5","6","7","8","9");
$dze=array("7","8","9","4","5","6","1","2","3","0");
$text=str_replace($abc,$cba,$text);
$text=str_replace($ABC,$CBA,$text);
$text=str_replace($ezd,$dze,$text);
$text=str_replace(" ","_",$text);
echo $text;
?>
test2.php
PHP-Code:
<?php
header("Content-type: text/html");
$i=$_GET["i"];
$i=str_replace("_"," ",$i);
$i=str_replace("-@-","<br>",$i);
$abc=array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
$ABC=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
$cba=array("q","w","e","r","t","z","u","i","o","p","a","s","d","f","g","h","j","k","l","y","x","c","v","b","n","m");
$CBA=array("Q","W","E","R","T","Z","U","I","O","P","A","S","D","F","G","H","J","K","L","Y","X","C","V","B","N","M");
$ezd=array("0","1","2","3","4","5","6","7","8","9");
$dze=array("7","8","9","4","5","6","1","2","3","0");
$i=str_replace($dze,$ezd,$i);
$i=str_replace($CBA,$ABC,$i);
$i=str_replace($cba,$abc,$i);
echo $i;
?>
Kommentar