root directory & php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wot
Forum Newbie
Posts: 3
Joined: Fri Aug 06, 2004 9:03 am

root directory & php

Post by wot »

feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color] 


Hi there

Was wondering if any of the php profis here could help me out. (I am very new to php so it's really basic)

I am trying to use a language navigation and unfortunately it's not picking it up??? That means is not changing from one language version to another??? 


Here is what I have:



index.php
langnav.php


--> docs 
------> serbsce
------> nemsce

here are the links to change the language version on my langnav.php:

Code: Select all

<a href= 'index.php?langnav=langnav&main=docs/serbsce/main&nav=docs/serbsce/nav'>serbsce</a>

<a href= 'index.php?langnav=langnav&main=docs/nemsce/mainde&nav=docs/nemsce/navde'>deutsch</a>

On my index page I use the following code:

Code: Select all

<?php 


$main = (isset($_GET['main']))? basename($_GET['main']) : "main"; 
$nav = (isset($_GET['nav'])) ? basename($_GET['nav']) : "nav"; 
$langnav = (isset($_GET['langnav'])) ? basename($_GET['langnav']) : "langnav"; 
$wobraz = (isset($_GET['wobraz'])) ? basename($_GET['wobraz']) : "wobraz"; 



$mainContent = "$main.php"; 
$langnavContent = "$langnav.php"; 
$navContent = "$nav.php"; 
$wobrazContent = "$wobraz.php"; 
?> 

<?php include("$langnavContent") ?>

What am I doing wrong or forgetting???


feyd | Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
User avatar
xjake88x
Forum Commoner
Posts: 50
Joined: Sun Aug 01, 2004 7:05 pm

Post by xjake88x »

Your code:

Code: Select all

$mainContent = "$main.php"; 
$langnavContent = "$langnav.php"; 
$navContent = "$nav.php"; 
$wobrazContent = "$wobraz.php";
Last time I checked, php thinks the . is part of the variable, so do this:

Code: Select all

$mainContent = "{$main}.php"; 
$langnavContent = "{$langnav}.php"; 
$navContent = "{$nav}.php"; 
$wobrazContent = "{$wobraz}.php";
wot
Forum Newbie
Posts: 3
Joined: Fri Aug 06, 2004 9:03 am

Post by wot »

Thanks I have tried this and still is not finding the files...?

What I am tring to do is to change 2 files with language navigation: content of "main" and "nav" cells...

What is happening is the following:

"nav" is not changing and "main" gets the following error:

Warning: main() [function.main]: open_basedir restriction in effect. File(/usr/share/php/docs/serbsce/mainde.php) is not within the allowed path(s): (/home/www/web2/) in /home/www/web2/html/sorben/chroscicy/sn/index.php on line 77

Warning: main(docs/serbsce/mainde.php) [function.main]: failed to create stream: Operation not permitted in /home/www/web2/html/sorben/chroscicy/sn/index.php on line 77

Warning: main() [function.main]: Failed opening 'docs/serbsce/mainde.php' for inclusion (include_path='.:/usr/share/php') in /home/www/web2/html/sorben/chroscicy/sn/index.php on line 77


What am I doing wrong?
Post Reply