Jump to content

Encode php line code url, please help


danjapro

Recommended Posts

 

Need a little direction with this.

 

I am trying to encode this line so it write the URL dislayed as somewhat encode form souorce viewer.

 

The URL:

http://sitepoint.com/images/user/media/song.mp3

 

I would like it to appear as something gebirsh or encoded:

 

http://%%5dfsitepoint%%%/@#$%%./CD%20%%%%&*

 

 

Line

 

$js_songs_url[] = "songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i])."';" ;

 

I have tried these methods none work

 

 

 


$js_songs_url[] = mb_convert_encoding("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = rawurldecode("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = html_entity_decode("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;

$js_songs_url[] = preg_replace("songs_position_url[".$i."] = '".MusColHelper::getSongFileURLslashes($songs[$i]))."';" ;



 

NONE worked for me...

Link to comment
Share on other sites

You're trying to replace a string with gibberish?

 

What exactly are you trying to accomplish?

 

<?php

$string = 'this is a string';

$chars = str_split($string);
foreach( $chars as &$char ) {
while( rand(0,1) )
	$char .= chr(rand(33,126));
}
unset($char);

$string = implode($chars);

echo $string;


?>

Link to comment
Share on other sites

Dont no what else to say really, except there is mycript might help.

 

Most people encrypt the showing info that in a link like

<?php

$song_name=sha1(md5('song.mp3'));

$url="http://sitepoint.com/images/user/media/page.php?song=$song_name";

echo "This is the url ($url) and this is the encript code $song_name";

?>

remember it one way encrypting so song.mp3 matches the result.

 

<?php


//This is un safe as you can see very easy to decode.
$url="http://sitepoint.com/images/user/media/song.mp3";

$encoded=base64_encode($url);

echo "<br /> <br />";

$decode=base64_decode($encoded);

echo "This is encoded (($encoded)) <Br />This is decoded (($decode))";

?>

 

<?php

//This is very safe but not decode able. one way encoding

$url="http://sitepoint.com/images/user/media/song.mp3";

$encode=sha1($url);

echo "<br>This is encoded but it one way not deco able (($encode))";

?>

 

<?php

//This is safe but not as safe as sha1,one way encoding

$url="http://sitepoint.com/images/user/media/song.mp3";

$encode=md5($url);

echo "<br>This is encoded but it one way not deco able (($encode))";

?>

 

<?php

//This is very safe but one way encoding sha1 and md5 are best for passwords

$url="http://sitepoint.com/images/user/media/song.mp3";

$encode=sha1(md5(($url)));

echo "<br>This is encoded but it one way not deco able (($encode))";

?>

Link to comment
Share on other sites

If he use a database he can win, with sha1 and md5.

 

But knowing the encrypted results via a database relating to row name and the the link="name"

 

but it a pain but i have done it before.

 

 

but looking at the code i don't no why he not just encoding the song name only.

Link to comment
Share on other sites

Kinda like those stupid lyrics sites that try to stop you from copy/pasting? :P

 

If he use a database he can win, with sha1 and md5.

 

But knowing the encrypted results via a database relating to row name and the the link="name"

 

but it a pain but i have done it before.

 

 

but looking at the code i don't no why he not just encoding the song name only.

 

No offence, but like most of the help you try to provide, this is nonsense and unrelated to the actual issue.

 

Even with client-side solutions, I'm still downloading and storing an unencrypted version of the data for playback. Even if this could be avoided, it's easy to set a recording application's source to whatever's being output over speakers. It's an 'analog hole' of sorts.

 

The only solution is to give a low quality or truncated version of the data as a sample. Digital makes it easier to produce, distribute and, not coincidentally, steal.

Link to comment
Share on other sites

use mod rewrite then that hide the link .

 

easy as that.

 

 

xyph trying anything is better then nothing.

 

 

might not of eat the whole php manual but im allowed my written opinion

staff dan administrator told me that years ago on here

 

i remember even you asking me questions lol not saying who i am.

 

 

i see a lot off mods that are mods know from when i was on here as a helper over 2 years ago roughly, but i left phpfreaks to use the knowledge that i learned and put it into programs and ideas, but now 2012 i got the car, the home and every think, i do php for good  leisure ,  but it was down to learning php on here i got wealthy, but i notice some off you continue to live the same old lives and have nothing to show for it, some of you are really good programmers and still got no money but why?

 

 

Link to comment
Share on other sites

danjapro tell us what you was trying to do with all this encrypting.

 

 

I want to no in detail what it was all for, so we don't guess no more.

 

please tell us.

 

you might need different programming language or even a dns solution.

 

 

Link to comment
Share on other sites

xyph trying anything is better then nothing.

 

Not always. Bad advice can lead to security holes, which can lead to lost information, which can lead to liability.

 

Again, I didn't mean to offend you... more to guide you into putting more effort into your responses. Understand the problem thoroughly before trying to offer advice, or warn the user you're not entirely sure what they're trying to accomplish. You're welcome to post whatever you'd like, assuming the mods/admins allow it. I'm not saying you aren't.

 

Can you explain how mod_rewrite would help anything? It's simply taking a request and translating it into another. How does this help obfuscate anything besides the file structure? The user is still receiving the same data.

 

How would hashing a name obfuscate anything beyond the original name? This would only force the user to rename any file he/she may have downloaded. It doesn't offer any sort of protection. The data is still the same. Obfuscating doesn't help in this case, or any really.

 

danjapro tell us what you was trying to do with all this encrypting.

 

 

I want to no in detail what it was all for, so we don't guess no more.

 

please tell us.

 

 

 

and sure enough, as I'm posting this, you've already applied my advice :P

Link to comment
Share on other sites

PHP-REAL-DEGREE.

 

You are a freaking genuis, not only did you make it simple. You also, allowed the file to be encrypted in Database Read file also.

Freaking niceee.

 

You're good man, thank you.

 

----------

requinix

----------

The files are being loaded into dynamic data read file, I was trying to get the <location> in read file to encrypt the file url, as double-up on protection. They cannot download without permissions, but still want to HIDE the exact file location.

The files load into a file library read file after DB, then to xhtml.

 

- Dig your understanding, appreciate the direction.

 

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

xyph

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

Lock Doors, Lock windows & alarm systems, are all anticipated.

But who will be expecting boobi-traps upon entrance. NO ONE!!!

 

 

Link to comment
Share on other sites

no i no nothing only over #200.000 a year ask dan and i sit on my bum watching my money grow.

 

i can not even spell but can swim in it lol

 

 

to many programmers look at the manual never look outside there own bedroom window.

 

even html can earn you 100 a day on my fat bum

 

php for life my old saying lol

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.