Apache Wrong $_SERVER[REQUEST_URI]
I'm facing a weird problem for $_SERVER["REQUEST_URI"]
Here is the example:....
View Complete Forum Thread with Replies
Related Forum Messages:
$_SERVER['REQUEST_URI']', Apache 1.x/2.x IIS 5/6
When I have a page not found in Apache I can have it redirected to a custom ../error.php file and I can use $_SERVER['REQUEST_URI'] to get the file that was not found. But as some of you might know, IIS does not have '$_SERVER['REQUEST_URI']'. So what is a 100% secure way of finding the path of the requested uri using IIS? What I was thinking of doing is if $_SERVER['REQUEST_URI'] exists the return it else if $_SERVER[QUERY_STRING'] exists strip the relevant info from it and return the data but how do I know for certain what the format will be? in my case, (IIS6) I get $_SERVER[QUERY_STRING'] = 404;http://www.example.com/unknown_page.php?var1=12&var2=14 but it that the case for all of them? shall I return anything after ñ“'? else return self? I obviously did a search on google, but most example/work around just don't work or don't achieve the expected result.
View Replies !
$_SERVER['REQUEST_URI']?
On my webpage i'm using <?php echo $_SERVER['REQUEST_URI'] ;?> to get the URL of the page, which is returning the URL in my html page as: /index.php?section=news&story_id=4 Now that's fine, but I want it to return the code in HTML ie: /index.php?section=news&story_id=4 ie amp' in my html instead of &. Is there any way I can do this?
View Replies !
$_SERVER['REQUEST_URI'] Problem
I have create a custom error 404 file (404.php) I have test the script in 404.php with echo $_SERVER["REQUEST_URI"]; When I test by request a file that not exist in my site like http://www.example.com/abc.html Why the result is ==> /404.php? I think it should be http://www.example.com/abc.html
View Replies !
PHP 404 Document's REQUEST_URI Does Not Hold Expected Value In $_ENV And $_SERVER
I wanted to migrate some custom 404 error pages from shtml to php for the ease of email notification of lost pages. However when PHP processes the page $_ENV['REQUEST_URI'] and $_SERVER['REQUEST_URI'] both now hold the error page eg "404.php". Does anyone have advice on how to dodge this? Should I just continue to use shtml error pages and do an shtml include on a little php script to do the mail?
View Replies !
Remote IP Address ($_SERVER) Wrong
I need to know the remote IP of users to a chatroom I manage here to log troublemakers. I found the function: $_SERVERREMOTE_ADDR or alternatively $_SERVER["REMOTE_ADDR"] the strange thing is: when displaying the remote address in the room each user sees his/her correct IP but I myself see _always_ only the address of my site (fixed IP behind a French "livebox" DSL modem). I could understand that I internally to my network see that address as that "livebox" also does the WiFi for the whole house but not the external users who, as mentioned, see the correct IPs themselves.
View Replies !
Win98 + Apache 1.3.up + PHP 4.3.up Something Wrong
I been first times setup. So Who have experience the Win98 + Apache + php (not run PWS or IIS) I begin download and installed the Apache. I test the run is working on browser (http://localhost) show the apache page. But Apache Console Running under the DOS Window say :- ===================================== [Thu Nov 20 15:13:49 2003] [warn] (2)No such file or directory: exec() may not be safe Apache/1.3.29 (Win32) running... ===================================== I expect that it. So, I shall the php installer from download. I try changed the httpd.conf under the Apache directory. Restart Apaches Console. I testing the (http://localhost/test.php), show error page say "HTTP - Error 400 Bad Request" also "HTTP - Error 404 Not found" I have tried times.... But unknown.... Apaches Directory - c:apacheapaches*.* PHP Directory - c:apacheapachesphpwin32*.* httd.conf -: (was add the line) ScriptAlias /php/ "C:/Apache/Apache/phpwin32/" AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Action application/x-httpd-php "/php.exe" I didn't change php.ini yet I copy and paste the "php4ts.dll" under to C:windowsystem from PHP What I have done that above ?
View Replies !
Apache Pointers & $_SERVER['HTTP_REFERER']
I have a url with information residing on http://www.hostnamea.com I have a pointer set up in apache to redirect all traffic to from http://www.hostnameb.com to http://hostnamea.com. My problem is $_SERVER['HTTP_REFERER'] is blank in all cases when people are being redirected from hostnameb.com. Is there a way I can track (using php) all people who used the hostnameb pointer? I googled without success, and I can't seem to find an alternative variable for what i'm looking for other than $_SERVER['HTTP_REFERER'] (ref site: http://ca.php.net/reserved.variables).
View Replies !
Opendir With $_SERVER['HTTP_HOST'] Or $_SERVER['DOCUMENT_ROOT']
Is there a way to use opendir() using some sort of absolute path? I want a file to open the same directory on my site, no matter from what directory it is called. For example, I have the following variables, but no combination seems to work for me. Q: Does opendir() ONLY deal with relative paths? Q: If opendir() works with absolute path, am I missing something?PHP Code:
View Replies !
REQUEST_URI
At some point, $_SERVER["REQUEST_URI"] started including the query string. It seems to me that it didn't do this before. Example: for URL "http://www.foo.bar/path/script?thing=value" $_SERVER["REQUEST_URI"] should be "/path/script" But it's now "/path/script?thing=value". Is this supposed to happen? Is there a configuration that controls this?
View Replies !
About 'REQUEST_URI' ?
'REQUEST_URI' Definition: The URI which was given in order to access this page; for instance, '/index.html'. How reliable is this variable?? Can I be sure allways to see from what website the user is coming from, or is it up to the server??
View Replies !
$request_uri
I used to be able to detect a var within URL but it doesn't appear to be working on my new server. I also can not find it in the manual... kinda lost at the moment. What is the best way to detect if a variabel is present in the URL? PHP Code: if (!ereg("VAR1",$REQUEST_URI)) { echo "blah"; } My register_global is currently set to OFF. It appear I am unable to use somethign like: PHP Code: (if (isset ($blah))
View Replies !
Request_uri For Windows IIS 5
the request_uri is not working for windows IIS How can i get it work? is there any other code? i just want the url right after the domain name; http://www.domain.com/blahblah/blah.htm
View Replies !
Problem With REQUEST_URI
I hope I'm not doing something really stupid .... but I can't get this to work properly. I'm using $_SERVER['REQUEST_URI'] to get the name of the *referring* page for use in a custom 404 page. All works hunky-dory (with an .htaccess script and so on) ... but the value always seems to return the *current* page (ie. the actual error page that the user lands on) - not the "from" (referring) page. OK ... so I tried a simple page with a regular URL link to another page. The value of $_SERVER['REQUEST_URI'] on that 2nd page was also the name of that 2nd page - yet $_SERVER['HTTP_REFERER'] gives the required value.
View Replies !
Use The Request_uri Command
trying to make a small function that will determine what directory the file is in, and based on that, display a specific link. I'm trying to use the request_uri command but I can only put in an exact directory..it doesn't work if you're in a sub-directory of that initial directory. I'll try to explain a little better :) Here's the code I have now: --- $url = $_SERVER['REQUEST_URI']; if($url == '/red-widgets/'){ --- But I want it to work if say someone goes to /red-widgets/small/smallredwidgets.php
View Replies !
REQUEST_URI And Explode
I am trying to fetch the data given by the user after the / from a domain, for example 'www.domain.com/fetchthis' now this works, but if a user adds another / for the dir to it, e.g. 'www.domain.com/fetchthis/dirhere' then it gets '/dirhere' too and adds it to the string. I want the REQUEST_URI to stop at a slash '/' , e.g. 'www.domain.com/fetchthis/dontfetch' My current code: $str = explode('/', $_SERVER['REQUEST_URI']);
View Replies !
REQUEST_URI Issue
I'm hoping this will be an easy one.. I'm trying to use a custom 404 to redirect pages from my old url to a new url. The code i'm using is like this: $redir = $_SERVER["REQUEST_URI"]; header("Location: http://www.domain.com$redir"); However this is not working, for some reason the $redir is going through as "404.php", rather than the trailing part of the address.
View Replies !
Regex For REQUEST_URI
I am trying to gain a greater grasp on regex patterns but in the mean time, could someone help me out and edit my code below so it checks to see if either articles or news is part of the URI rather than just articles which is what I have at the moment? PHP Code: if (preg_match('/articles/',$_SERVER['REQUEST_URI'],$matches)) { Â Â Â Â Â Â Â Â include($_SERVER['DOCUMENT_ROOT'] . '/articles'); Â Â Â Â Â Â Â Â exit(); Â Â Â Â }
View Replies !
Parsing SERVER['REQUEST_URI'] For Includes And Such
I might be tangling up my logic, or overlooking something whether it be elegance or security.. Is there any problem with doing something like this? htaccess: RewriteRule ^[a-zA-Z0-9/_-]+/?$ /index.php index.php: $uriArr = explode('/', $_SERVER['REQUEST_URI']); include($uriArr[1].'php'); Is there something obviously bad about this? Code:
View Replies !
What's Wrong W/this (if / Or) ?
When ppmode is set to "cancel" or "thankyou", the header and exit are still processed. I'm trying to search on "if" and "or" in google, but it keeps removing "or" from my searches. Is there something wrong w/this ? if (($ppmode != "cancel") or ($ppmode != "thankyou")) { header("Location: index.php"); exit(); }
View Replies !
Wrong Id
I have a table named 'choose' with the fields site_id, user_id and values, with 2 rows : row1 : site_id = 1 user_id = 2 value = 0 row2 : site_id = 4 user_id = 2 value = 0 I use the following form, that get's it's info from another table Code:
View Replies !
Wrong Headers
I just transfered and patched up some files because I moved them from Linux/PHP/Apache/mySQL to Windows XP Home/PHP/Apache/mySQL. I fixed all the problems that come up, but, when I load the page in IE6, it reloads a bunch of times and just loads normally. I tried the best I can to make the page HTML 4.01 Transitional. So, on Linux, after I patched the page to be HTML 4.01 Transitional I put a link for my visitors to validate my page if they want to. So I notice also, that when I validate the page, I rarely get it to work. 90% of the time, this is what I receive from the W3C validator: Quote: I got the following unexpected response when trying to retrieve <http://*****/>: 500 Bad header: ' <img src="/images/menu/other_stuff-off.gif" alt="Other Stuff" name="menu-other_stuff" width="186" height="17" border="0">' Please make sure you have entered the URI correctly. I get this error most of the time, but sometimes there is a different part of my PHP HTML output in the page. And then, when it works, half of the page is trimmed off, thus, I get errors about my page not being HTML 4.01 Transitional. I tried a couple experiments with my layout code, and the same code makes the browser reload, and reload... I've tried debugging my layout code but it brought up nothing... I switched from the PHP module to using the CGI executable. Some things changed: The page no longer reloads repetitively; when the validator fails, I sometimes get a 'Header too long' message; using the validator brings success more often, but other letters are in the output (degree marks, little squares -- these don't appear when viewing the source of the page in IE6). Anybody know why this header is being sent by my server? *Note* I am not trying to load an image. I am trying to load a dynamic PHP page.
View Replies !
What's Wrong With This Code?
I keep getting parse errors on line 10 (the "if (isset($LOGINID)) {" line). Can any of you figure out why the hell I keep getting this? Is is just something simple I'm overlooking? And if you have any comments on my code (security, structure, tips, etc), I'd like to know as well... [edit] Oh yeah, the db_connect, db_array, db_query, and decrypt functions are all defined in database.php and crypt.php. PHP Code:
View Replies !
What's Wrong In This Code
$link = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD); $selectStmt = "SELECT * FROM user_profile WHERE userid = 'david'"; if (!($result = mysql_db_query($DB, $selectStmt, $link))){ header("Location:http://$HTTP_HOST/$DOCROOT/error.html"); exit(); } here is the case, the userid 'David' is NOT in the table 'user_profile', the program should launch the error.html, and exit(), But it is not.
View Replies !
What's Wrong With This Php Code?
I put the following php code inside my index.html page. I upload it to my host server (free.prohosting.com), change the extension to php (and another one with php3)and CHMOD it to 644. When i viewed it in a browser, the normal html appeared but the items inside the php code failed to appear. Can somebody help me to confirm whether there is something wrong with my php code (it is a news grabber code) or is it because my webhost don't support php (the unofficial FAQ says that the server support php). If there is something wrong with my php code, here is the code: PHP code:
View Replies !
What Am I Doing Wrong With This Regex
I'm just trying to check and see if this name is valid. I submit things like "12345" and it evaluates to true... function checkName ($name) { $status = FALSE; $pattern = "/^[A-Za-z]+$/"; if (preg_match($pattern, $name)); $status = TRUE; return $status; }
View Replies !
Preg_replace - What Is Wrong Here?
preg_replace - What is wrong here? Suppose I have this: $words = array('piece','people'); $profile_text = "I would like to meet people to help me to work in the world piece project."; $marked = MarkWords($profile_text, $words); Should return the same sentece but with the 2 words replaced with the <span> tag, am I wrong? function MarkWords($profile_text, $words){ for($i=0; $i<count($words); $i++){ $patern[$i] = "/@".$words[$i]."/"; $replace[$i] = "<span style='color:white'>".$words[$i]."</span>"; } // print_r($patern); // print_r($replace); $pro = preg_replace($patern, $replace, $profile_text); return $pro; }
View Replies !
Something Wrong With $_POST
I don't seem to be able to access the keys in an associative array. I have a script that dynamically generates a form. The form element names are generated based on image filenames, so I can't just access them the normal way in the form handler script. I tried looping through the $_POST array like this: foreach ($_POST as $key=>$value) { echo $key.'=>'.$value.'<br>' } and i get this output: 0=>Pay 1=>Pay 2=>on 3=>on 4=>tn__DSC2602.jpg 5=>tn__DSC2603.jpg Thos numbers are where I expected to see the form element names. Can anyond advise me on why this is happening?
View Replies !
PHP.ini File Wrong?
I run a test server of apache/php/mysql on my laptop. I just switched from one to another and I'm moving everything over. I downloaded the latest versions of each. (Found that apache 2.0 doesn't work very well and went back to 1.3) Everything is working, DBs are being hit properly and such except: $SERVER_ADDR is no longer being passed back to PHP. When I run PHP_INFO() it shows up there as 飗.0.0.1' as expected, but I can't pick it up in my code. I'm guessing there is something going on with the variables I have turned on/off. Any ideas?
View Replies !
What's Wrong With My Script?
<?php include"dbconn.php"; $db=mysql_select_db(creative_Articles,$connection) ; $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category"; $mysql_Parent=mysql_query($Parent); while ($row=mysql_fetch_array($mysql_Parent)) { $Cat_Parent=$row["Cat_Parent"]; echo "$Cat_Parent"; } ?>
View Replies !
What Is Wrong With This Code?
I am trying to setup a set of radio buttons from a table. I am getting the error: Parse error: parse error, unexpected '[', expecting ',' or '' in /var/www/html/liberty/prototype1.php on line 251 This is the snippet of code. <?php $getnormwtA = getnormwt(); $numct = count($getnormwtA); $tab = 16; $wt = 'weight' $typ = 'radio' for ($i=0; $i<$numct; $i++){ echo "<input name=". $wt ." tabindex=". $tab ." value=". $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>". getnormwtA[$i]['bodyweightnorm'] .">"; $tab++; ?>} ?> This is line 251 echo "<input name=". $wt ." tabindex=". $tab ." value=". $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>". getnormwtA[$i]['bodyweightnorm'] .">";
View Replies !
What's Wrong With REBOL?
I first came across rebol a while ago; it seemed interesting but then i was put off by its proprietary nature, although the core of the language is a free download. Recently however, i can't help but say i was totally impressed. I needed an open source wikiblog/wikilog, whatever you wanna call it, basically a hybrid of a blog and a wiki. I checked out snipsnap, which uses java, it was said on their site to be a clone of vanilla, a wikilog written with rebol. I wanted an open source thing so i could modify it to my needs. snipsnap turned out to be, even apparent on the first day of use, way too far from being mature and reliable, and although they said it doesn't require a server, it required a download of the sun java sdk, which, when installed, was well over 400Mbs of space on my hard drive. Not to mention another over 100Mbs for the JVM. So as i needed a mature enough solution, but liked the way snipsnap worked, i looked around, and on freshmeat i found vanilla, with a development status of 5; production/stable. I went to its site, where a working demo impressed with its capabilities. The site is though poorly documented, very poorly documented i had to use trial and error to work out how to install it. Anyhow, what impressed me was that the download, which was less than half a megabyte, installed vanilla, which is the wikilog, an apache server, and the rebol interpreter, which is the free download version. And it self-installed! It turned out to be a very very capable wikilog, and highly extensible. I am still amazed and impressed by it after a couple of days of use. Rebol itself seemed a very easy to read language. Sorta like ho readable SQL is. I might even say more readable than python or ruby, or at least as readable. I have the intention to learn it over the coming few days, at least to customize vanilla to my needs. So i ask you guys, what's wrong with Rebol? i mean other than it's proprietary nature. 'cos anyway, there are many commercial IDEs for open source languages, and if smitten enough i might even consider a rebol SDK. It just amazes me for how readable it is, how much it seems to enable to do with so little code, and the size and capability of the final solution.
View Replies !
What Is Wrong With This Line ?
It has to be something with the characters, right ? $search = array(".", "", "+", "-", "*", "/", "!", "%", ">", "<", "^", "(", ")", "[", "]", "{", "}", "", "=", "$", "#", "?", "~", ":", "_", "&", "©", " ", """, "ü", "&", ";", " "); $line = str_replace($search, " ", $line);
View Replies !
What Is Wrong With This If Test?
I am at a toral loss after having programmed for forty years. Here are my results: selHint_2=1 It is clear that for the second time through the loop ($i=1) that $index=1 and $selHint_2=1, while for the first pass through ($i=0) $index=0 and $selHint=1. Yet, the " selected " comes up for the first time and not for the second. It should be the other way around. Any clues? Here is the code: $numHint_2 = 2; $hint_2_Lookup = array(0, 1); $hint_2 = array(); $hint_2[] = " Family member's name"; $hint_2[] = " Mothers maiden name"; $foo = ""; // put in for debugging only $tmpHint2 = array(); $tmpHint2[] = '<td class="stdBold"' . $readonly . '>' $tmpHint2[] = '<select name="hint_1" value="" >' for ($i=0; $i<$numHint_2; $i++) { $index = $hint_2_Lookup[$i]; if ($index == $selHint_2) { $sel = " selected "; } else { $sel = ""; }
View Replies !
Age Function Wrong
I have this code to show a users age on there profile, The problem is it shows the correct age for some users and the wrong age for others. Example birthdate 1983-04-21 should show age 24 but instead returns age 23. PHP Code: //calculate years of age (input string: YYYY-MM-DD)   function birthday ($birthday){     list($year,$month,$day) = explode("-",$birthday);     $year_diff  = date("Y") - $year;     $month_diff = date("m") - $month;     $day_diff   = date("d") - $day;     if ($day_diff < 0 || $month_diff < 0)       $year_diff--;     return $year_diff;   }
View Replies !
PHP Time Is Wrong
I just installed php 5.1RC1, mysql 4.1.14, apache1.3.33 on a windows 2000 server machine. Anyway some wierd bugs are happening, the time for the server is incorrect. The time set on the machine is right, the time in the apache error log is right, but when i do a simple time() call in php is gives some ridiculous time like 6:30PM and its really 2:01PM. another problem i just remembered was something i'm hoping is simple. I do a simple printing of the date using the date function. I believe i did something like this, $today = date("F j, Y, g:i a"); From what i remember it had a "f" after the month and the year was repeated twice. The day and month were correct though. Anyone know whats going on? I'm not at the machine now but once they set up their vpn and can go in and change whatever it is.
View Replies !
Date()'s Wrong.
so I'm using echo date ("r"); and it's returning the time an hour late. Is that set wrong on the server? And if so how to go about fixing that. email them I guess? I mean, I guess I could learn to parse nist.gov output, but that seems like alot of trouble for something so small. Since I don't have another box to check with, could someone click my site link below and tell me if the time in the nav bar is late for them also?
View Replies !
Query Right Or Wrong
this errors out and i dont know why. PHP Code: $sql = "SELECT s.`id`, s.`topic`, s.`username`, s.`date`, s.`subject`, s.`post` COUNT(c.`posts_id`) AS `ct` FROM `forum-posts` s LEFT JOIN `forum-reply` c ON s.`subject` = c.`posts_id` WHERE `topic` = '$topic'";
View Replies !
If Else Statement Wrong
Could anyone tell me what's wrong with this code? <?php If ($CategoryName == 'U-100') { ($UnitPrice = 500); } else if ($CategoryName == 'U-130') { ($UnitPrice = 400); } else if ($CategoryName == 'U-105') { ($UnitPrice = 350); } else if ($CategoryName == 'U-95') { ($UnitPrice = 200); }else if($CategoryName == 'U-85') { ($UnitPrice = 445); $Total = $ProductUnits*UnitPrice echo $Total ?>
View Replies !
PHP Fetch_array() WRONG
I have this simple code: <?php include("connect.php"); $sql = "select * from post"; $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row['post_id']; ?> But the page result is this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in #############index.php on line 5.
View Replies !
|