Niccaman Posted December 21, 2009 Share Posted December 21, 2009 I want to be able to identify every page by a unique ID I dont want to manually assign every page i have with a personal ID. Is there a way of giving each page a unique ID based on file location or something?? I thought the URL using HTTP_REFERRER, but when u have a GET variable, it seems to be empty... Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/ Share on other sites More sharing options...
Niccaman Posted December 21, 2009 Author Share Posted December 21, 2009 Whoops, im using referrer, but ofcourse thats the page your come from. How do u get ur current url? Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981622 Share on other sites More sharing options...
optikalefx Posted December 21, 2009 Share Posted December 21, 2009 try doing print_r($_SERVER); and take a look at all that info Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981625 Share on other sites More sharing options...
premiso Posted December 21, 2009 Share Posted December 21, 2009 You can use md5 to generate a unique hash using the file itself or file location. Then just store that hash as to accessing the file. Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981626 Share on other sites More sharing options...
teamatomic Posted December 21, 2009 Share Posted December 21, 2009 why not just use the page name? $path = $_SERVER['SCRIPT_FILENAME']; $unique = basename($path); HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981627 Share on other sites More sharing options...
optikalefx Posted December 21, 2009 Share Posted December 21, 2009 If he is using Post data to change the page display then the URL might be the same so md5 won't help. There really is only way true way to do this IF and thats a big IF the pages have different URL's. and that is define a constant for each page, like vbulletin. But if the pages truley all have different URL's then hashing the URL is the perfect way to go, of course, capital letters might change that identifier so make sure you toLowerCase() before you md5() Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981631 Share on other sites More sharing options...
Niccaman Posted December 21, 2009 Author Share Posted December 21, 2009 If he is using Post data to change the page display then the URL might be the same so md5 won't help. There really is only way true way to do this IF and thats a big IF the pages have different URL's. and that is define a constant for each page, like vbulletin. But if the pages truley all have different URL's then hashing the URL is the perfect way to go, of course, capital letters might change that identifier so make sure you toLowerCase() before you md5() Thanks, I will do that. As long as I understand what you mean by pages having different urls. They are all their own filenames in say a single folder. Good enough?? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/185893-any-ideas/#findComment-981637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.