Jump to content

Recommended Posts

<?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.

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

<?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.

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.