Re: menu andfolder question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 5, 2008 10:36 PM, Alain Roger <raf.news@xxxxxxxxx> wrote:
> ok, maybe i did not write my question well.
> i already used it because i setup the DirectoryIndex to index.php,
> index.html
>
> my concern for now, how to have the same behavior on my local computer
> (development computer) ?
> my computer has IP 200.170.1.2 (for example)
> so in my brower i type : 200.170.1.2/myWebSite
>
> this load my firt index.php webpage to browser... if i pass my mouse cursor
> over menu link "Company", it displays
> http://200.170.1.2/myWebSite/200.170.1.2/company
> which is not great :-(
>
> here is the code i use :
> print "<div class='MenuItem4'><a
> href='".$_SERVER['SERVER_NAME']."/company'>Company</a></div>";

In your case it's taking the existing url and tacking the rest on
which is not what you want.

If you print out $_SERVER['SERVER_NAME'] - it doesn't include the
http[s]:// at the start to make it a complete absolute url. It also
doesn't include your current directory (myWebSite) so even with
http:// at the start you'd end up with http://ip.address/company - not
what you want either.

You should probably have a variable or define for your application url
in your config file so you can:

print "<a href='" . APPLICATION_URL . "/company'>Company</a>";

It's much safer this way than relying on any $_SERVER variables (which
believe it or not are suspect to XSS attacks/vulnerabilities).

-- 
Postgresql & php tutorials
http://www.designmagick.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux