echoing wrong function<

admin

Administrator
Staff member
Hi, I am making a l337 translator for my CS site and this is what I have right now:

<?php


$l337 = "abc";
str_replace("a", "@", $l337);
str_replace("b", "B", $l337);
str_replace("e", "3", $l337);
str_replace("b", "B", $l337);
str_replace("b", "B", $l337);

echo("$l337");


?>

And when I open that file it is echoing $l337 before it is parsing the replace function. So it is echoing abc not the after function. Does anyone know what function I would use?


ThanksYou are calling the str_replace() function but not assigning it to anything.


$test = "abc";
$test = str_replace("a", "@", $test);
echo $test;Hey, thanks alot man, I am have another question, I got the script to work and this is what I have

<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<textarea name="translate"></textarea>
<input type="submit" value="Tr@ns@t3">
</form>


<?php


$l337 = "$translate";
$l337 = str_replace("a", "@", $l337);
$l337 = str_replace("b", "B", $l337);
$l337 = str_replace("e", "3", $l337);
$l337 = str_replace("g", "6", $l337);
$l337 = str_replace("e", "3", $l337);
$l337 = str_replace("h", "H", $l337);
$l337 = str_replace("i", "!", $l337);
$l337 = str_replace("i", "!", $l337);
$l337 = str_replace("l", "1", $l337);
$l337 = str_replace("o", "0", $l337);
$l337 = str_replace("s", "5", $l337);
$l337 = str_replace("t", "7", $l337);
$l337 = str_replace("z", "2", $l337);
?>

Translated: <?php echo "$l337" ?>


I am going to add a select box in the and you can choose which type of translate you want ex. "light l337" "hard l337" and I tried and I have had no luck. Does anyone know?<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea name="translate"></textarea>
<select name="type">
<option value="light">lite
<option value="hard">hard
</select>
<input type="submit" value="Tr@ns@t3">
</form>

<?php
if (isset($_POST['translate'])) {
if ($_POST['type']=='light') {
$search = array('a','b');
$replace = array('@','B');
}
else {
$search = array('a','b','e','g','h','i','l','o','s','t','z');
$replace = array('@','B','3','6','H','!','1','0','5','7','2');
}
$new = str_replace($search,$replace,$_POST['translate']);
echo 'Translated: ',$new;
}
?>Thanks man. where would I add the data for hard leet?

Would I change anything in here?
if ($_POST['type']=='light') {
$search = array('a','b');
$replace = array('@','B');
}
else {
$search = array('a','b','e','g','h','i','l','o','s','t','z');
$replace = array('@','B','3','6','H','!','1','0','5','7','2');

To like?
if ($_POST['type']=='hard') {
$search = array('a','b');
$replace = array('@','B');
}
else {
$search = array('letters for leet in here');
$replace = array('letters for leet in here');

Would i added a section like that above for the hard selectionsI got this and I tried it and I got a error.

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea name="translate"></textarea>
<select name="type">
<option value="light">lite
<option value="hardcore">hard
</select>
<input type="submit" value="Tr@ns@t3">
</form>
<?php


$l337 = "$translate";
$l337 = str_replace("a", "@", $l337);
$l337 = str_replace("b", "B", $l337);
$l337 = str_replace("e", "3", $l337);
$l337 = str_replace("g", "6", $l337);
$l337 = str_replace("e", "3", $l337);
$l337 = str_replace("h", "H", $l337);
$l337 = str_replace("i", "!", $l337);
$l337 = str_replace("i", "!", $l337);
$l337 = str_replace("l", "1", $l337);
$l337 = str_replace("o", "0", $l337);
$l337 = str_replace("s", "5", $l337);
$l337 = str_replace("t", "7", $l337);
$l337 = str_replace("z", "2", $l337);

if (isset($_POST['translate'])) {
if ($_POST['type']=='light') {
$search = array('a','b');
$replace = array('@','B');
if
}
else {
$search = array('a','b','e','g','h','i','l','o','s','t','z');
$replace = array('@','B','3','6','H','!','1','0','5','7','2');
}
$new = str_replace($search,$replace,$_POST['translate']);
echo 'Translated: ',$new;
}

if (isset($_POST['translate'])) {
if ($_POST['type']=='hardcore') {
$search = array('a','b');
$replace = array('4','|3 ');
if
}
else {
$search = array('a','b', 'c', 'd', 'e', 'f', 'g','h','i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'w', 'z');
$replace = array('4','|3', '(', '|)', '|[', '3','6','|{','!', '_|', '|<', '|_', '|V|', '|\|', '0', '|o', '|2', '5','7', '|_|', '\/', '|/\|', '2');
}
$new = str_replace($search,$replace,$_POST['translate']);
echo 'Translated: ',$new;
}
?>

does anyone know why it isnt working?

Thanks.
 
Back
Top