Jump to content

Recommended Posts

Hi Guys,

 

I'm setting up a shortURL generator for my blog, at the moment it just uses the articles ID number but obviously that is not secure so before I put it out into the real world I want to convert it into a code (eg: 3sF428EDD3 or something like that), the code needs to be unique for each article and preferably needs to be something that can be converted back into the ID. Although if thats too much of a pain then I don't mind it being one way as I can always just add a 'shortcode' field to the database.

 

Any ideas?

I have the same question. What makes you think that is not secure?

 

Edit:

Just assumed showing the world the ID from the database would be a bad idea

 

In programming, you cannot assume anything. You must have a state-able problem before you can solve it. What about showing the world the ID do you think makes it not secure?

To be honest I don't know. I learned PHP at university and my tutor always said not to show people the primary key but now I think about it, he never really told us why. I guess thats my problem solved then :)

 

The reason your tutor told you that was most likely so if anybody found a vulnerability in your application, they at least may not know the PK of your articles, they may need to work a bit harder to find those out (if you used another mechanism).

 

IMO that is not a good enough reason to justify using a different mechanism for identifying records.

What he probably was trying to say, is that database IDs should not be on users' interest. You shouldn't have your login form asking for 'User's ID' instead of 'Username' etc. As long as you take precautions against SQL injections, and have proper access control in place, there's no harm in showing these IDs to the world.

 

Look at the url bar on this forums. It will show you a topic id, and also possibly a message id. Click on any users nickname, to see their ID. Is there anything you can do with these numbers? I doubt it.

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.