SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Hybrid View
-
May 26, 2007, 07:11 #1
- Join Date
- Apr 2002
- Posts
- 2,322
- Mentioned
- 3 Post(s)
- Tagged
- 0 Thread(s)
appended slash dissapearing but not with changed variable name?!
i hate these sort of problems. weird unexplainable ones. on my not found page i have this right at the start:
Code:<?php /* if a corrected url submission redirect to it */ include ('/home/users/theusername/html/thewebsiteaddress.com/includes/contact.inc.php'); /* for mystriptslashes() and email address */ $host = $_SERVER['HTTP_HOST'].'/'; if( isset( $_POST['uri-submit']) ) { $corrected_uri = str_replace(' ','%20',trim(mystripslashes($_POST['corrected-uri']))); header( "Location: http://$host$corrected_uri" ); exit; } /* bits for later */ $request_uri = substr( mystripslashes($_SERVER['REQUEST_URI']), 1 ); ?><!DOCTYPE html PUBLIC "-//W3C//DTD ....
echo '<h1>', $host, '</h1>';
in after where $host is set prints out:
www.domainname.com/
the important thing for this question is the slash.
then later on in the not found page's code i have:
Code:<h2><span class="url"><?php echo $host; ?><span class="wrong"><?php echo $request_uri; ?></span></span> not found</h2>
www.domainname.comxyz
where xyz is the not found page's part -- no slash. same $host variable ?!? wtfworked on a different server ok as well.
any ideas why the slash isn't on the $host variable a little later on, on the same page?
ok, just before posting this i though "i'd better check just in case $host isn't some previously used variable or something" and changed all (four) occurances of $host to $hostxyz and it's now printing out the slash ?!? any ideas what's going on there?
thanks.
-
May 26, 2007, 07:37 #2
- Join Date
- Apr 2002
- Posts
- 2,322
- Mentioned
- 3 Post(s)
- Tagged
- 0 Thread(s)
sorry, forget this -- i was importing another php file which happened to be using a $host variable also.
thanks.
Bookmarks