Jump to content

Strange Error, That I need help with


darktimesrpg

Recommended Posts

Um, this is really weird I didn't touch a file and this happened:

Parse error: syntax error, unexpected ','

This is the line it's talking about:

a=>"?",b=>"?",c=>"?,d=>"?",e=>"?,f=>"?",g=>"?",h=>"%",i=>"?",j=>"?",k=>"?",l=>"?,m=>"?",n=>"?,o=>"!",p=>"?",

 

What I don't understand is why even after a restore it still gives that error.

Any advice or help?

Link to comment
Share on other sites

Acually it has nothing to do with those lines they haven't been changed, but here they are:

 

q=>"?,r=>"?",s=>"@",t=>"?,u=>"?",v=>"?,w=>"?",x=>"?,y=>"?",z=>"?,

  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=>",",

  0=>"?,1=>"?",2=>"?,3=>"?",4=>"?",5=>"?",6=>"?",7=>"?,8=>"?,9=>"?);

 

Link to comment
Share on other sites

You have a bunch of open strings with no ending and literal strings for tags Examplke:

t=>"? should be 't'=>'?' or 't'=>"?"

Also, that's not even a complete statement. It's starting with the assignment of keys in an array, but no creation of the array or assignment.

 

Please post the lines surrounding this.

Link to comment
Share on other sites

You want to quit telling us what's not the problem? obviously you can't figure it out as you're asking for help, and I can assure you the code you have posted is far from valid code. So if you want our help, quit arguing and post the code.

Link to comment
Share on other sites

Don't post all 450 lines, post SOME of the lines BEFORE and AFTER the STATEMENT causing the ERROR.

Or, you can simply choose to believe you're infalliable, and it was a gremlin who went in and changed it, and maybe if you post the fing code you might be able to fix it.

 

I don't believe you that it "worked" before as the code you've posted IS NOT VALID CODE.

Link to comment
Share on other sites

I agree Tom, heck, for all we know it's top secret CIA code - if we change one line we might bomb Russia or something right? Best to leave it as it's always been with that error there :)

 

Here's a little clue for you dude. If we can't see the code, we can't fix the problem. You seem to refuse to admit that there even IS a problem, and think the error in the code is "not a coding error". We're not psychics, we're programmers. If you're not going to post code, you're going to have to fix it yourself. Have fun kiddo.

Link to comment
Share on other sites

Fine I'll post the "invalid code"

 

Code:

### Encryption ###

function encrypt($str,$salt=2) {

 

  $chr = 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=>"?,

  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=>",",

  0=>"?,1=>"?",2=>"?,3=>"?",4=>"?",5=>"?",6=>"?",7=>"?,8=>"?,9=>"?);

 

    for ($i=0;$i<=strlen($str)-1;$i++) {

 

        $c = substr($str,$i,1);

 

        for ($t=0;$t<=$i+$salt;$t++) {

 

            if ($chr[$c] != "") { $c = $chr[$c]; }

 

        }

 

        $encrypt .= $c;

 

    }

 

    return $encrypt;

}

 

 

### Decryption ###

function decrypt($str,$salt=2) {

 

  $chr = 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,

  "#"=>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,

  "?=>"0","?"=>1,"?=>2,"?"=>3,"?"=>4,"?"=>5,"?"=>6,"?=>7,"?=>8,"?=>9);

 

    for ($i=0;$i<=strlen($str)-1;$i++) {

 

        $c = substr($str,$i,1);

 

        for ($t=0;$t<=$i+$salt;$t++) {

 

            if ($chr[$c] != "") { $c = $chr[$c]; }

 

        }

 

        $decrypt .= $c;

 

    }

 

    return $decrypt;

}

 

Link to comment
Share on other sites

You never fixed the first error I pointed out - that you have unclosed strings. Fix that and that will likely fix it. After the t=>"? you need ANOTHER " to CLOSE the string. If you don't believe me, you've got bigger problems.

 

That missing " means that PHP thinks the string ends at the next ", and the next char after that is ? which doesn't make sense to PHP.

It's on t, 8, 9 and probably others.

Link to comment
Share on other sites

Now I get unexpected t-string and here's the code:

 

### Encryption ###

function encrypt($str,$salt=2) {

 

  $chr = 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=>"?",

  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=>",",

  0=>"?",1=>"?",2=>"?",3=>"?",4=>"?",5=>"?",6=>"?",7=>"?",8=>"?",9=>"?");

 

    for ($i=0;$i<=strlen($str)-1;$i++) {

 

        $c = substr($str,$i,1);

 

        for ($t=0;$t<=$i+$salt;$t++) {

 

            if ($chr[$c] != "") { $c = $chr[$c]; }

 

        }

 

        $encrypt .= $c;

 

    }

 

    return $encrypt;

}

 

 

### Decryption ###

function decrypt($str,$salt=2) {

 

  $chr = 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,

  "#"=>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,

  "?"=>"0","?"=>1,"?"=>2,"?"=>3,"?"=>4,"?"=>5,"?"=>6,"?"=>7,"?"=>8,"?"=>9);

 

    for ($i=0;$i<=strlen($str)-1;$i++) {

 

        $c = substr($str,$i,1);

 

        for ($t=0;$t<=$i+$salt;$t++) {

 

            if ($chr[$c] != "") { $c = $chr[$c]; }

 

        }

 

        $decrypt .= $c;

 

    }

 

    return $decrypt;

}

 

Link to comment
Share on other sites

You need to get yourself a editor with syntax highlighting.

 

"?=>q

 

SAME PROBLEM.

You're still not doing your strings correctly. This should be '?'=>'q'

" " strings are for strings that have variables in them, ' ' are for literal strings.

 

Download textpad and use the syntax highlighting.

 

Also, md5() dude. Reinventing the wheel, shoddily, is never a good idea.

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.