Jump to content

problem loading website through url vars with new version of php


ezsmooth

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.