ezsmooth Posted March 30, 2011 Share Posted March 30, 2011 <?php $ACCEPT_FILE['home'] = 'home.html'; $ACCEPT_FILE['general'] = 'general.html'; $ACCEPT_FILE['attorneys'] = 'attorneys.html'; $ACCEPT_FILE['contact'] = 'contact.html'; $ACCEPT_FILE['login'] = 'login.html'; $pagename = $ACCEPT_FILE[$id]; if (!isset($pagename)) $pagename = "home.html"; // default file include( $pagename ); ?> the url looks like: www.yoursite.com/index.php?id=general Ever since i think like php 5 came out i am unnable to load pages it just defaults to the home.html no matter what variable is defined. any ideas or help would be appreciated. Its almost like its not defining the pagename variable until the bottom where $pagename = "home.html". ive been looking at it and reading the manuals for hours and figured its time to make a post. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/232230-problem-loading-website-through-url-vars-with-new-version-of-php/ Share on other sites More sharing options...
betterphp Posted March 30, 2011 Share Posted March 30, 2011 it looks like you were relying on register_globals, you need to define $id as something. Quote Link to comment https://forums.phpfreaks.com/topic/232230-problem-loading-website-through-url-vars-with-new-version-of-php/#findComment-1194673 Share on other sites More sharing options...
ezsmooth Posted March 31, 2011 Author Share Posted March 31, 2011 doesnt $id get defined in the URL such as www.yoursite.com/index.php?id=general where 'general' defines the $id variable. If this is the case where and what could i define id to other than it being defined initially in the url? thanks for the help. matt Quote Link to comment https://forums.phpfreaks.com/topic/232230-problem-loading-website-through-url-vars-with-new-version-of-php/#findComment-1194719 Share on other sites More sharing options...
ezsmooth Posted March 31, 2011 Author Share Posted March 31, 2011 its actually not passing the variable from the url bar to the code. any idea how to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/232230-problem-loading-website-through-url-vars-with-new-version-of-php/#findComment-1194722 Share on other sites More sharing options...
ezsmooth Posted March 31, 2011 Author Share Posted March 31, 2011 <?php $v1 = $_GET['id']; $ACCEPT_FILE['home'] = 'home.html'; $ACCEPT_FILE['general'] = 'general.html'; $ACCEPT_FILE['attorneys'] = 'attorneys.html'; $ACCEPT_FILE['contact'] = 'contact.html'; $ACCEPT_FILE['login'] = 'login.html'; $pagename = $ACCEPT_FILE[$v1]; if (!isset($pagename)) $pagename = "home.html"; // default file include( $pagename ); ?> does this look secure? did i define the variable in the correct space? it works now. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/232230-problem-loading-website-through-url-vars-with-new-version-of-php/#findComment-1194724 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.