Jump to content

Tell Me What Is Wrong With My Code!!!


ooblik

Recommended Posts

Well I've tried my hardest to debug this. I'm kind of a N00b. Please Help Me!

My problem is:

I am trying to take a name and parse all the characters to make them into random, look-alike,

special characers. I don't get any errors but when I run my code the characters stay

the same just all in uppercase...

 

Basically it should convert:

MyNickName

    to

МψήίČκŇǻmΞ

 

index.php

----------------------------------------------------------------------------------------

Main Function

<?php
function transNick($nick)
    {
    $nick=strtoupper($nick);

    for ($count=65; $count < 90; $count+=1)
        {
        $evaAln = "\$curarylen = count(\$" . chr($count) . ");";
        eval($evaAln);
        srand((double)microtime() * 1000000);
        $randnum=(int)rand(1, $curarylen);
        $evaNch ="\$newchar = \$" . chr($count) . "[" . $randnum . "];";
        eval($evaNch);

        str_replace(chr($count), $newchar, $nick);
        }

    return $nick;
    }

echo transNick('Hello World!!');

 

The Arrays (Database of all special characters that look like normal characters :))

 

$A=array
    (
    "&#170;",
    "&#192;",
    "&#193;",
    "&#194;",
    "&#195;",
    "&#196;",
    "&#197;",
    "&#224;",
    "&#225;",
    "&#226;",
    "&#227;",
    "&#228;",
    "&#229;",
    "&#256;",
    "&#257;",
    "&#258;",
    "&#259;",
    "&#260;",
    "&#261;",
    "&#461;",
    "&#462;",
    "&#506;",
    "&#902;",
    "&#945;",
    "&#940;",
    "&#1044;",
    "&#1051;",
    "&#1076;",
    "&#8710;",
    "/-\\"
    );

$B=array
    (
    "&#223;",
    "&#946;",
    "&#1047;",
    "&#1066;",
    "&#1068;",
    "&#1074;",
    "&#1073;",
    "&#1079;",
    "&#1098;",
    "&#1100;"
    );

$C=array
    (
    "&#169;",
    "&#164;",
    "&#199;",
    "&#231;",
    "&#262;",
    "&#263;",
    "&#264;",
    "&#265;",
    "&#266;",
    "&#267;",
    "&#268;",
    "&#269;",
    "&#1028;"
    );

$D=array
    (
    "&#208;",
    "&#240;",
    "&#271;",
    "&#270;",
    "&#273;",
    "&#948;"
    );

$E=array
    (
    "&#200;",
    "&#201;",
    "&#202;",
    "&#203;",
    "&#232;",
    "&#233;",
    "&#234;",
    "&#235;",
    "&#274;",
    "&#276;",
    "&#277;",
    "&#278;",
    "&#279;",
    "&#280;",
    "&#281;",
    "&#282;",
    "&#283;",
    "&#399;",
    "&#601;",
    "&#904;",
    "&#926;",
    "&#931;",
    "&#949;",
    "&#941;",
    "&#1025;",
    "&#1028;",
    "&#1069;",
    "&#1105;",
    "&#1108;",
    "&#1240;",
    "&#1241;",
    "&#7868;",
    "&#7867;",
    "&#7866;",
    "&#7865;",
    "&#7864;",
    "&#7869;",
    "&#7870;",
    "&#7871;",
    "&#7872;",
    "&#7873;",
    "&#7874;",
    "&#7875;",
    "&#7876;",
    "&#7877;",
    "&#7878;",
    "&#7879;",
    "&#8494;",
    "€",
    "&#8721;"
    );

$F=array
    (
    "f",
    "&#1170;",
    "&#1171;",
    "&#8355;",
    "&#9554;",
    "&#8747;"
    );

$G=array
    (
    "&#284;",
    "&#285;",
    "&#286;",
    "&#287;",
    "&#288;",
    "&#289;",
    "&#290;",
    "&#291;"
    );

$H=array
    (
    "#",
    "&#292;",
    "&#293;",
    "&#294;",
    "&#295;",
    "&#955;",
    "&#1026;",
    "&#1035;",
    "&#1048;",
    "&#1049;",
    "&#1080;",
    "&#1081;",
    "&#1085;
    ",
    "&#1106;",
    "&#1115;",
    "&#1186;",
    "&#1187;",
    "&#1210;",
    "&#1211;",
    "&#9579;",
    "|-|"
    );

$I=array
    (
    "&#166;",
    "&#166;",
    "&#204;",
    "&#205;",
    "&#206;",
    "&#207;",
    "&#236;",
    "&#237;",
    "&#238;",
    "&#239;",
    "&#296;",
    "&#297;",
    "&#298;",
    "&#299;",
    "&#300;",
    "&#301;",
    "&#302;",
    "&#303;",
    "&#304;",
    "&#305;",
    "&#322;",
    "&#463;",
    "&#464;",
    "&#938;",
    "&#943;",
    "&#953;",
    "&#031;",
    "&#1110;",
    "&#1111;"
    );

$J=array
    (
    "&#308;",
    "&#309;",
    "&#1032;",
    "&#1112;",
    "&#1604;",
    "&#8730;"
    );

$K=array
    (
    "&#310;",
    "&#311;",
    "&#312;",
    "&#954;",
    "&#1036;",
    "&#1050;",
    "&#1082;",
    "&#1178;",
    "&#1179;",
    "&#1180;",
    "&#1181;",
    "|<"
    );

$L=array
    (
    "&#163;",
    "&#313;",
    "&#314;",
    "&#315;",
    "&#316;",
    "&#317;",
    "&#318;",
    "&#319;",
    "&#320;",
    "&#321;",
    "&#322;",
    "&#9492;",
    "|_"
    );

$M=array
    (
    "&#1052;",
    "&#1084;",
    "|\/|"
    );

$N=array
    (
    "&#209;",
    "&#241;",
    "&#323;",
    "&#324;",
    "&#325;",
    "&#326;",
    "&#327;",
    "&#328;",
    "&#329;",
    "&#330;",
    "&#331;",
    "&#928;",
    "&#951;",
    "&#942;",
    "&#1051;",
    "&#1055;",
    "&#1087;",
    "&#8362;",
    "&#8319;",
    "&#8745;",
    "|\|"
    );

$O=array
    (
    "&#176;",
    "&#164;",
    "&#186;",
    "&#210;",
    "&#211;",
    "&#212;",
    "&#213;",
    "&#214;",
    "&#216;",
    "&#242;",
    "&#243;",
    "&#244;",
    "&#245;",
    "&#246;",
    "&#248;",
    "&#332;",
    "&#333;",
    "&#334;",
    "&#335;",
    "&#336;",
    "&#337;",
    "&#465;",
    "&#466;",
    "&#417;",
    "&#416;",
    "&#510;",
    "&#511;",
    "&#730;",
    "&#908;",
    "&#911;",
    "&#920;",
    "&#934;",
    "&#937;",
    "&#952;",
    "&#959;",
    "&#963;",
    "&#966;",
    "&#972;",
    "&#1060;",
    "&#1086;",
    "&#1256;",
    "&#1257;",
    "&#7884;",
    "&#7885;",
    "&#7886;",
    "&#7887;",
    "&#7888;",
    "&#7889;",
    "&#7890;",
    "&#7891;",
    "&#7892;",
    "&#7893;",
    "&#7894;",
    "&#7895;",
    "&#7896;",
    "&#7897;",
    "&#7898;",
    "&#7899;",
    "&#7900;",
    "&#7901;",
    "&#7902;",
    "&#7903;",
    "&#7904;",
    "&#7905;",
    "&#7906;",
    "&#7907;",
    "&#8486;",
    "&#9675;",
    "&#9679;",
    "&#9689;",
    "&#9688;",
    "&#9702;",
    "&#9788;"
    );

$P=array
    (
    "&#182;",
    "&#961;",
    "&#1088;"
    );

$Q=array
    (
    "&#1641;",
    "&#1785;",
    "&#1782;"
    );

$R=array
    (
    "&#174;",
    "&#340;",
    "&#341;",
    "&#342;",
    "&#343;",
    "&#344;",
    "&#345;",
    "&#960;",
    "&#1103;",
    "&#1107;"
    );

$S=array
    (
    "$",
    "&#167;",
    "&#346;",
    "&#347;",
    "&#348;",
    "&#349;",
    "&#350;",
    "&#351;",
    "&#950;",
    "&#962;",
    "&#958;",
    "&#1109;"
    );

$T=array
    (
    "+",
    "&#177;",
    "&#354;",
    "&#355;",
    "&#356;",
    "&#357;",
    "&#358;",
    "&#359;",
    "&#964;",
    "&#1027;",
    "&#1043;",
    "&#1058;",
    "&#1090;"
    );

$U=array
    (
    "&#217;",
    "&#218;",
    "&#219;",
    "&#220;",
    "&#249;",
    "&#250;",
    "&#251;",
    "&#252;",
    "&#360;",
    "&#361;",
    "&#362;",
    "&#363;",
    "&#364;",
    "&#365;",
    "&#366;",
    "&#367;",
    "&#368;",
    "&#369;",
    "&#370;",
    "&#371;",
    "&#431;",
    "&#432;",
    "&#467;",
    "&#468;",
    "&#469;",
    "&#470;",
    "&#471;",
    "&#472;",
    "&#473;",
    "&#474;",
    "&#475;",
    "&#476;",
    "&#956;",
    "&#1062;",
    "&#1094;",
    "&#1119;",
    "&#7908;",
    "&#7909;",
    "&#7910;",
    "&#7911;",
    "&#7912;",
    "&#7913;",
    "&#7914;",
    "&#7915;",
    "&#7916;",
    "&#7917;",
    "&#7918;",
    "&#7919;",
    "&#7920;",
    "&#7921;",
    "|_|"
    );

$V=array
    (
    "&#957;",
    "&#965;",
    "&#971;",
    "&#973;",
    "&#9660;",
    "\/"
    );

$W=array
    (
    "&#372;",
    "&#373;",
    "&#969;",
    "&#974;",
    "&#1064;",
    "&#1065;",
    "&#1096;",
    "&#1097;",
    "\/\/"
    );

$X=array
    (
    "&#215;",
    "&#1061;",
    "&#1093;",
    "&#1202;",
    "&#1203;",
    "><"
    );

$Y=array
    (
    "&#165;",
    "&#221;",
    "&#253;",
    "&#255;",
    "&#374;",
    "&#375;",
    "&#910;",
    "&#939;",
    "&#947;",
    "&#968;",
    "&#1038;",
    "&#1091;",
    "&#1095;",
    "&#1118;",
    "&#1198;",
    "&#1199;",
    "&#1200;",
    "&#1201;",
    "&#7922;",
    "&#7923;",
    "&#7924;",
    "&#7925;",
    "&#7926;",
    "&#7927;",
    "&#7928;",
    "&#7929;"
    );

$Z=array
    (
    "&#1581;",
    "z",
    "Z"
    );

?>

Link to comment
Share on other sites

[...] but i described it above for you  :)

No you didn't. We need to know your expected result.

 

There I added what I wanted it to do. It should be clear now. If not just read the code! If a 15 yo noob can read it and know what it should do i think you can :)

Link to comment
Share on other sites

well here you go first of all, all those variables should be in an array passed to the function will make things easier I've used the easiest way out so don't me for bad coding  :P just wanted you to get the idea,

 

 

<?php


$A=array
    (
    "&#170;",
    "&#192;",
    "&#193;",
    "&#194;",
    "&#195;",
    "&#196;",
    "&#197;",
    "&#224;",
    "&#225;",
    "&#226;",
    "&#227;",
    "&#228;",
    "&#229;",
    "&#256;",
    "&#257;",
    "&#258;",
    "&#259;",
    "&#260;",
    "&#261;",
    "&#461;",
    "&#462;",
    "&#506;",
    "&#902;",
    "&#945;",
    "&#940;",
    "&#1044;",
    "&#1051;",
    "&#1076;",
    "&#8710;",
    "/-\\"
    );

$B=array
    (
    "&#223;",
    "&#946;",
    "&#1047;",
    "&#1066;",
    "&#1068;",
    "&#1074;",
    "&#1073;",
    "&#1079;",
    "&#1098;",
    "&#1100;"
    );

$C=array
    (
    "&#169;",
    "&#164;",
    "&#199;",
    "&#231;",
    "&#262;",
    "&#263;",
    "&#264;",
    "&#265;",
    "&#266;",
    "&#267;",
    "&#268;",
    "&#269;",
    "&#1028;"
    );

$D=array
    (
    "&#208;",
    "&#240;",
    "&#271;",
    "&#270;",
    "&#273;",
    "&#948;"
    );

$E=array
    (
    "&#200;",
    "&#201;",
    "&#202;",
    "&#203;",
    "&#232;",
    "&#233;",
    "&#234;",
    "&#235;",
    "&#274;",
    "&#276;",
    "&#277;",
    "&#278;",
    "&#279;",
    "&#280;",
    "&#281;",
    "&#282;",
    "&#283;",
    "&#399;",
    "&#601;",
    "&#904;",
    "&#926;",
    "&#931;",
    "&#949;",
    "&#941;",
    "&#1025;",
    "&#1028;",
    "&#1069;",
    "&#1105;",
    "&#1108;",
    "&#1240;",
    "&#1241;",
    "&#7868;",
    "&#7867;",
    "&#7866;",
    "&#7865;",
    "&#7864;",
    "&#7869;",
    "&#7870;",
    "&#7871;",
    "&#7872;",
    "&#7873;",
    "&#7874;",
    "&#7875;",
    "&#7876;",
    "&#7877;",
    "&#7878;",
    "&#7879;",
    "&#8494;",
    "€",
    "&#8721;"
    );

$F=array
    (
    "f",
    "&#1170;",
    "&#1171;",
    "&#8355;",
    "&#9554;",
    "&#8747;"
    );

$G=array
    (
    "&#284;",
    "&#285;",
    "&#286;",
    "&#287;",
    "&#288;",
    "&#289;",
    "&#290;",
    "&#291;"
    );

$H=array
    (
    "#",
    "&#292;",
    "&#293;",
    "&#294;",
    "&#295;",
    "&#955;",
    "&#1026;",
    "&#1035;",
    "&#1048;",
    "&#1049;",
    "&#1080;",
    "&#1081;",
    "&#1085;
    ",
    "&#1106;",
    "&#1115;",
    "&#1186;",
    "&#1187;",
    "&#1210;",
    "&#1211;",
    "&#9579;",
    "|-|"
    );

$I=array
    (
    "&#166;",
    "&#166;",
    "&#204;",
    "&#205;",
    "&#206;",
    "&#207;",
    "&#236;",
    "&#237;",
    "&#238;",
    "&#239;",
    "&#296;",
    "&#297;",
    "&#298;",
    "&#299;",
    "&#300;",
    "&#301;",
    "&#302;",
    "&#303;",
    "&#304;",
    "&#305;",
    "&#322;",
    "&#463;",
    "&#464;",
    "&#938;",
    "&#943;",
    "&#953;",
    "&#031;",
    "&#1110;",
    "&#1111;"
    );

$J=array
    (
    "&#308;",
    "&#309;",
    "&#1032;",
    "&#1112;",
    "&#1604;",
    "&#8730;"
    );

$K=array
    (
    "&#310;",
    "&#311;",
    "&#312;",
    "&#954;",
    "&#1036;",
    "&#1050;",
    "&#1082;",
    "&#1178;",
    "&#1179;",
    "&#1180;",
    "&#1181;",
    "|<"
    );

$L=array
    (
    "&#163;",
    "&#313;",
    "&#314;",
    "&#315;",
    "&#316;",
    "&#317;",
    "&#318;",
    "&#319;",
    "&#320;",
    "&#321;",
    "&#322;",
    "&#9492;",
    "|_"
    );

$M=array
    (
    "&#1052;",
    "&#1084;",
    "|\/|"
    );

$N=array
    (
    "&#209;",
    "&#241;",
    "&#323;",
    "&#324;",
    "&#325;",
    "&#326;",
    "&#327;",
    "&#328;",
    "&#329;",
    "&#330;",
    "&#331;",
    "&#928;",
    "&#951;",
    "&#942;",
    "&#1051;",
    "&#1055;",
    "&#1087;",
    "&#8362;",
    "&#8319;",
    "&#8745;",
    "|\|"
    );

$O=array
    (
    "&#176;",
    "&#164;",
    "&#186;",
    "&#210;",
    "&#211;",
    "&#212;",
    "&#213;",
    "&#214;",
    "&#216;",
    "&#242;",
    "&#243;",
    "&#244;",
    "&#245;",
    "&#246;",
    "&#248;",
    "&#332;",
    "&#333;",
    "&#334;",
    "&#335;",
    "&#336;",
    "&#337;",
    "&#465;",
    "&#466;",
    "&#417;",
    "&#416;",
    "&#510;",
    "&#511;",
    "&#730;",
    "&#908;",
    "&#911;",
    "&#920;",
    "&#934;",
    "&#937;",
    "&#952;",
    "&#959;",
    "&#963;",
    "&#966;",
    "&#972;",
    "&#1060;",
    "&#1086;",
    "&#1256;",
    "&#1257;",
    "&#7884;",
    "&#7885;",
    "&#7886;",
    "&#7887;",
    "&#7888;",
    "&#7889;",
    "&#7890;",
    "&#7891;",
    "&#7892;",
    "&#7893;",
    "&#7894;",
    "&#7895;",
    "&#7896;",
    "&#7897;",
    "&#7898;",
    "&#7899;",
    "&#7900;",
    "&#7901;",
    "&#7902;",
    "&#7903;",
    "&#7904;",
    "&#7905;",
    "&#7906;",
    "&#7907;",
    "&#8486;",
    "&#9675;",
    "&#9679;",
    "&#9689;",
    "&#9688;",
    "&#9702;",
    "&#9788;"
    );

$P=array
    (
    "&#182;",
    "&#961;",
    "&#1088;"
    );

$Q=array
    (
    "&#1641;",
    "&#1785;",
    "&#1782;"
    );

$R=array
    (
    "&#174;",
    "&#340;",
    "&#341;",
    "&#342;",
    "&#343;",
    "&#344;",
    "&#345;",
    "&#960;",
    "&#1103;",
    "&#1107;"
    );

$S=array
    (
    "$",
    "&#167;",
    "&#346;",
    "&#347;",
    "&#348;",
    "&#349;",
    "&#350;",
    "&#351;",
    "&#950;",
    "&#962;",
    "&#958;",
    "&#1109;"
    );

$T=array
    (
    "+",
    "&#177;",
    "&#354;",
    "&#355;",
    "&#356;",
    "&#357;",
    "&#358;",
    "&#359;",
    "&#964;",
    "&#1027;",
    "&#1043;",
    "&#1058;",
    "&#1090;"
    );

$U=array
    (
    "&#217;",
    "&#218;",
    "&#219;",
    "&#220;",
    "&#249;",
    "&#250;",
    "&#251;",
    "&#252;",
    "&#360;",
    "&#361;",
    "&#362;",
    "&#363;",
    "&#364;",
    "&#365;",
    "&#366;",
    "&#367;",
    "&#368;",
    "&#369;",
    "&#370;",
    "&#371;",
    "&#431;",
    "&#432;",
    "&#467;",
    "&#468;",
    "&#469;",
    "&#470;",
    "&#471;",
    "&#472;",
    "&#473;",
    "&#474;",
    "&#475;",
    "&#476;",
    "&#956;",
    "&#1062;",
    "&#1094;",
    "&#1119;",
    "&#7908;",
    "&#7909;",
    "&#7910;",
    "&#7911;",
    "&#7912;",
    "&#7913;",
    "&#7914;",
    "&#7915;",
    "&#7916;",
    "&#7917;",
    "&#7918;",
    "&#7919;",
    "&#7920;",
    "&#7921;",
    "|_|"
    );

$V=array
    (
    "&#957;",
    "&#965;",
    "&#971;",
    "&#973;",
    "&#9660;",
    "\/"
    );

$W=array
    (
    "&#372;",
    "&#373;",
    "&#969;",
    "&#974;",
    "&#1064;",
    "&#1065;",
    "&#1096;",
    "&#1097;",
    "\/\/"
    );

$X=array
    (
    "&#215;",
    "&#1061;",
    "&#1093;",
    "&#1202;",
    "&#1203;",
    "><"
    );

$Y=array
    (
    "&#165;",
    "&#221;",
    "&#253;",
    "&#255;",
    "&#374;",
    "&#375;",
    "&#910;",
    "&#939;",
    "&#947;",
    "&#968;",
    "&#1038;",
    "&#1091;",
    "&#1095;",
    "&#1118;",
    "&#1198;",
    "&#1199;",
    "&#1200;",
    "&#1201;",
    "&#7922;",
    "&#7923;",
    "&#7924;",
    "&#7925;",
    "&#7926;",
    "&#7927;",
    "&#7928;",
    "&#7929;"
    );

$Z=array
    (
    "&#1581;",
    "z",
    "Z"
    );


function transNick($nick)
{	

$nick=strtoupper($nick);

    for ($count=65; $count < 90; $count++)
        {
	$char = $GLOBALS[chr($count)];
        $evaAln = count($char);
        $randnum=(int)rand(1, $evaA1n);
        $evaNch =$char[$randnum];
        $nick = str_replace(chr($count), $evaNch, $nick);
        }

    return $nick;
}

echo transNick('myNick');



?>

Link to comment
Share on other sites

I knew that i just wanted the important stuff up front so someone would take time to even try and fix it  :P

what you did worked except i want the new characters to be random!!!

 

EDIT:

NEVERMIND YOU JUST PUT a 1 instead if an L

 

Thanks Alot!!

Link to comment
Share on other sites

well left out the unnecessary stuff here only the function

 

 

function transNick($nick)
{	

$nick=strtoupper($nick);

    for ($count=65; $count < 90; $count++)
        {
	$char = $GLOBALS[chr($count)];
        $intCount = count($char);
        $randnum=rand(1, $intCount);
	$evaNch =$char[$randnum];
        $nick = str_replace(chr($count), $evaNch, $nick);
        }

    return $nick;
}

 

hope its helpful

 

Link to comment
Share on other sites

just forgot one tiny thing out here is the function which will work perfectly

 

function transNick($nick)
{	

$nick=strtoupper($nick);

    for ($count=65; $count < 90; $count++)
        {
	$char = $GLOBALS[chr($count)];
        $intCount = count($char);
        $randnum=rand(1, $intCount);
	$evaNch =$char[$randnum-1];
        $nick = str_replace(chr($count), $evaNch, $nick);
        }

    return $nick;
}

 

hope its helpful to ya

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.