| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() | Encoding and decoding Hey, Is there an easy way to encode and then decode a string in PHP? Probably base64 but I want to add a custom string to make it un-decodable without the string..if that makes sense. eg, $code = 'encode me'; $str = base64_encode("blah".$code); How would I decode that? Thanks.
__________________ Encenta - Amazon Associates CMS
Last edited by Encenta.com; 03-30-2006 at 03:59 PM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | i know what you can do. just make the "custom string" that u mentioned to be a number and then just use that number to determine how many times the script will encode the $code (or decode). heres a working sample: http://nasaboy007.t35.com/coder64/index.html
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated!
Last edited by nasaboy007; 03-30-2006 at 06:35 PM.
|
| |
| | #4 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | php file source: PHP Code: ![]() hope it helps.
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | #6 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | <-- uses free host that i dont give a crap about so sry bout the max exec time etc lol. plz do optimize it cuz if u can make it work faster, post the code too, id like to see it.
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | THREAD STARTER #7 (permalink) |
| SQLdumpster.com Join Date: Jun 2005 Location: West Sussex, UK
Posts: 573
![]() ![]() | Thanks for the replies. How do I output only alphanumeric characters. For example base64("1") contains '=' and so is not suitable for urls
__________________ Encenta - Amazon Associates CMS |
| |
| | #8 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | hmm... dont know if it will work, but i read somewhere that replacing the = with a . (period). also, from numerous tests i found that the decode option still works even if you take out the equal signs. try it yourself: do sumtin with a key of 1, copy paste it, and take out the ='s. it shud still decode properly (it did for me). how bout sum rep for my hard work? ![]() any more questions feel free to ask.
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | #9 (permalink) | ||||
| NamePros Regular Join Date: Feb 2006 Location: Atlanta, GA, USA
Posts: 335
![]() ![]() |
Last edited by Tree; 04-01-2006 at 07:11 AM.
| ||||
| |
| | #11 (permalink) | ||||
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=182172 urlencode() will change it to a way to transmit over a url. EDIT oops just noticed PoorDoggiewas replying to an old thread. | ||||
| |
| | #13 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | http://www.scriptgod.com/encode.php Since we're bringing up an old thread I've edited it a tad:PHP Code: |
| |
| | #14 (permalink) |
| Soon to be RICHdoggie! Join Date: Jan 2005 Location: UK
Posts: 2,408
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | see if you can crack mine (runs on same basis... but is more intricate!) - http://6yd.net/encryption |
| |
| | #15 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | @poordoggie urs uses mcrypt, rite? i didnt use that cuz some hosts dont have it installed. the manual said u gotta install it i think X_X @secondversion problem with ur updated version: when u try to decrypt something it decrypts it fine, but it doubles (or triples, quadrouples, etc) the cleartext.
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |