Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-25-2012, 10:35 PM   PM User | #1
teemone2001
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
teemone2001 is an unknown quantity at this point
dynamic url help

can anybody in the forum explain how i can create a dynamic url for a website in php, i dont want my site scripts to be displayed, i want something like this
www.mywebsite.com/gbibhjsbs7i3498yhiouhf8793
that will always change if another user points to www.mywebsite.com. thanks i will be grateful if anybody can help me asap.
teemone2001 is offline   Reply With Quote
Old 10-26-2012, 04:45 AM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,396
Thanks: 18
Thanked 351 Times in 350 Posts
sunfighter is on a distinguished road
php scripts are never displayed to the user, so what your doing is not necessary. Only if someone breaks into your site will they see your php and then nothing you do will stop them.
sunfighter is offline   Reply With Quote
Old 10-26-2012, 05:04 AM   PM User | #3
teemone2001
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
teemone2001 is an unknown quantity at this point
bro, what am saying is i want all or some of my websites link to auto generate ur token after my domian, on this forum we can all see the newreply.php i dont want that make sql injection easy, but if is a one time url token, they cant sql your site, hope u understand what am trying to tell u. thanks
teemone2001 is offline   Reply With Quote
Old 10-26-2012, 11:48 AM   PM User | #4
Custard7A
Regular Coder

 
Custard7A's Avatar
 
Join Date: Jul 2010
Location: Australia
Posts: 269
Thanks: 32
Thanked 32 Times in 32 Posts
Custard7A is an unknown quantity at this point
You seem to be trying to append a session token to the URL — or a once-only deal — correct me if I'm wrong there, without the URL appearing dynamic.

A dynamic URL is simply variables passed in the URL, meaning you can't avoid something like domain.com/file.php?variable=value. However, you can 'mask' these URLs with htaccess, which works by allowing access to that path via another. For the example I just used, I could change it to be accessed as domain.com/file/value. This is a good technique for set pages, such as a user page, however I don't believe there is an efficient way to mask a random value you are passing to every page. You would need to create a new htaccess mask for every page on your site, and if you miss one.. it would be messy.

More importantly, this is an absurd approach to preventing SQL injection — or any form of attack — and is a waste of time. Knowing the name of variables, such as this page using the "t" variable, is of no benefit to an attacker if a few simple sanitations are in effect. Sanitation > security by obscurity.
Custard7A is offline   Reply With Quote
Users who have thanked Custard7A for this post:
teemone2001 (10-26-2012)
Old 10-26-2012, 08:19 PM   PM User | #5
teemone2001
New to the CF scene

 
Join Date: Oct 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
teemone2001 is an unknown quantity at this point
good, can u show me how to go about creating it? thanks
teemone2001 is offline   Reply With Quote
Old 10-27-2012, 12:15 AM   PM User | #6
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,519
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Quote:
Originally Posted by sunfighter View Post
php scripts are never displayed to the user, so what your doing is not necessary. Only if someone breaks into your site will they see your php and then nothing you do will stop them.
I think you need to stop guessing

The op is saying they don't want www.domain.com/file.php?something=else
Instead they way something like www.domain.com/something/else

The technique the op wants is url rewriting. With apache it's mod_rewrite that does the job. Its been years since I've used it so I'm not a good one to provide examples but you have to store the urls and the converted urls in a .htaccess file.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 10-28-2012, 05:05 PM   PM User | #7
Peeyush
Regular Coder

 
Join Date: Apr 2012
Posts: 104
Thanks: 27
Thanked 2 Times in 2 Posts
Peeyush is an unknown quantity at this point
http://net.tutsplus.com/tutorials/ot...r-pretty-urls/

This might help you
__________________
Everything is simpler with jQuery!
Peeyush is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:06 PM.


Advertisement
Log in to turn off these ads.