| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| SQLdumpster.com | 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.
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets Last edited by miseria; 03-30-2006 at 02:59 PM. |
| |
| | #2 (permalink) |
| Senior Member | 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 05:35 PM. |
| |
| | #4 (permalink) |
| Senior Member | 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 | <-- 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! |
| |
| | #7 (permalink) |
| SQLdumpster.com | Thanks for the replies. How do I output only alphanumeric characters. For example base64("1") contains '=' and so is not suitable for urls
__________________ !!!!!!! see something you like? Accepting offers for great affiliate websites !!!!!!! Free Databases for your Website | All Things Playstation 3 Website Design Books | Music While You Work? | Computer Gadgets |
| |
| | #8 (permalink) |
| Senior Member | 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 | Quote:
Last edited by Tree; 04-01-2006 at 06:11 AM. | |
| |
| | #11 (permalink) | |
| Senior Member | Quote:
urlencode() will change it to a way to transmit over a url. EDIT oops just noticed PoorDoggiewas replying to an old thread. | |
| |
| | #13 (permalink) |
| NPQ's PA, Slave, and On Call Coder Technical Services | 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! | see if you can crack mine (runs on same basis... but is more intricate!) - http://6yd.net/encryption |
| |
| | #15 (permalink) |
| Senior Member | @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! |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |