Jump to content

PHP - URL Encoding


cheetahten

Recommended Posts

Newbie here ;D

 

I been playing with a php script that receives allot of paramaters

 

Things like , Size, Upload directory, File names, etc...

 

Anyways, I noticed that allot of the URL for dynamic pages in other sites look like gibberish, specially many image urls... Am assuming these are dynamic or something.

 

Anyways, My question...

 

Do people Encode URL? is this a common practice? for security?

Link to comment
https://forums.phpfreaks.com/topic/164078-php-url-encoding/
Share on other sites

I tend to use urlencode when I'm sending data from page to page using the GET request. THen I'll decode it one the receiving page so it is in the format I want it to be in.

 

As far as the gibberish question with reagrds to displaying images, if the image has been uploaded, and it's path/filename stored in a db, this can be a unique id for referencing the image, maybe the hash of a timestamp and the filename.

 

Consider the following;

 

<?php
$filename="myfile"; //file extension removed
$timestamp=1246274928; //put it in statically for your viewing pleasure
$hashed_filename=md5($timestamp.$filename);
echo $hashed_filename;//echos 'd5f9f505a1f710e2f146c32e42e6ad73'

Link to comment
https://forums.phpfreaks.com/topic/164078-php-url-encoding/#findComment-865548
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.